-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
92 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,55 @@ | |
name: Archive artifact logs and data | ||
description: Archive logs, pods and events | ||
|
||
inputs: | ||
junit-paths: | ||
description: 'Path to junit reports' | ||
default: '/artifacts/data/reports/*.xml' | ||
required: true | ||
stage: | ||
description: 'Stage name' | ||
default: ${{ github.job }}${{ github.run_attempt > 1 && format(".%d", github.run_attempt) || "" }} | ||
required: true | ||
trunk_token: | ||
description: 'Trunk token' | ||
required: false | ||
zenko-name: | ||
description: 'Zenko name' | ||
default: 'end2end' | ||
required: false | ||
zenko-namespace: | ||
description: 'Namespace' | ||
default: 'default' | ||
required: false | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: test #TODO: remove before merge | ||
shell: bash | ||
run: |- | ||
echo "job: ${{ github.job }}" | ||
echo "job status: ${{ job.status }}" | ||
echo "job failure(): ${{ failure() }}" | ||
echo "job cancelled(): ${{ cancelled() }}" | ||
echo "STAGE: ${{ inputs.stage }}" | ||
continue-on-error: true | ||
|
||
- name: Publish test report | ||
uses: mikepenz/action-junit-report@v4 | ||
with: | ||
report_paths: ${{ inputs.junit-paths }} | ||
continue-on-error: true | ||
|
||
- name: Upload results | ||
if: inputs.trunk_token && job.status!="cancelled" | ||
uses: trunk-io/[email protected] | ||
with: | ||
junit-paths: ${{ inputs.junit-paths }} | ||
org-slug: ${{ github.repository_owner }} | ||
token: ${{ inputs.trunk_token }} | ||
continue-on-error: true | ||
|
||
- name: Archive artifact logs and data | ||
shell: bash | ||
run: |- | ||
|
@@ -16,15 +62,18 @@ runs: | |
kubectl get zenkodrsource -A -o yaml > /tmp/artifacts/data/${STAGE}/kind-logs/all-zenkodrsources.log; | ||
kubectl get zenkodrsink -A -o yaml > /tmp/artifacts/data/${STAGE}/kind-logs/all-zenkodrsinks.log; | ||
kind export logs /tmp/artifacts/data/${STAGE}/kind-logs/kind-export; | ||
tar zcvf /tmp/artifacts/${{ github.sha }}-${STAGE}-logs-volumes.tgz /tmp/artifacts/data/${STAGE}/kind-logs; | ||
tar zcvf /tmp/artifacts/${{ github.sha }}-${STAGE}-logs-volumes.tgz | ||
/tmp/artifacts/data/${STAGE}/kind-logs; | ||
env: | ||
STAGE: ${{ inputs.stage }} | ||
continue-on-error: true | ||
|
||
- name: Dump kafka | ||
shell: bash | ||
continue-on-error: true | ||
run: |- | ||
set -exu | ||
NAMESPACE=${NAMESPACE:-default} | ||
KAFKA=$(kubectl get pods -n ${NAMESPACE} -lkafka_cr=${ZENKO_NAME:-end2end}-base-queue -o jsonpath='{.items[0].metadata.name}') | ||
KAFKA=$(kubectl get pods -n ${NAMESPACE} -lkafka_cr=${ZENKO_NAME}-base-queue -o jsonpath='{.items[0].metadata.name}') | ||
kubectl exec -in ${NAMESPACE} ${KAFKA} -c kafka -- \ | ||
env KAFKA_OPTS= kafka-topics.sh --bootstrap-server :9092 --list \ | ||
|
@@ -38,10 +87,24 @@ runs: | |
env KAFKA_OPTS= kafka-consumer-groups.sh --bootstrap-server :9092 --describe --all-groups \ | ||
> /tmp/artifacts/data/${STAGE}/kafka-offsets.log | ||
KAFKA_SERVICE=$(kubectl get services -n ${NAMESPACE} -lkafka_cr=${ZENKO_NAME:-end2end}-base-queue -o jsonpath='{.items[0].metadata.name}') | ||
KAFKA_SERVICE=$(kubectl get services -n ${NAMESPACE} -lkafka_cr=${ZENKO_NAME}-base-queue -o jsonpath='{.items[0].metadata.name}') | ||
kubectl run -n ${NAMESPACE} kcat --image=edenhill/kcat:1.7.1 --restart=Never --command -- sleep 300 | ||
kubectl wait -n ${NAMESPACE} pod kcat --for=condition=ready | ||
cat /tmp/artifacts/data/${STAGE}/kafka-topics.log | grep -v '^__' | xargs -P 15 -I {} \ | ||
sh -c "kubectl exec -i -n ${NAMESPACE} kcat -- \ | ||
kcat -L -b ${KAFKA_SERVICE} -t {} -C -o beginning -e -q -J \ | ||
> /tmp/artifacts/data/${STAGE}/kafka-messages-{}.log" | ||
env: | ||
STAGE: ${{ inputs.stage }} | ||
NAMESPACE: ${{ inputs.zenko-namespace }} | ||
ZENKO_NAME: ${{ inputs.zenko-name }} | ||
continue-on-error: true | ||
|
||
- name: Upload artifacts # move into `archive-artifacts` action | ||
uses: scality/action-artifacts@v4 | ||
with: | ||
method: upload | ||
url: https://artifacts.scality.net | ||
user: ${{ inputs.artifacts-user }} | ||
password: ${{ inputs.artifacts-password }} | ||
source: /tmp/artifacts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters