Skip to content

Commit

Permalink
fix: rename label handling outputs (#158)
Browse files Browse the repository at this point in the history
* fix: rename step outputs

* ci: bump actionlint

* chore: fix pre-commit
  • Loading branch information
mkolasinski-splunk authored Jun 2, 2023
1 parent c337191 commit fd75521
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
python-version: "3.7"
- name: Install actionlint
run: |
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/v1.6.22/scripts/download-actionlint.bash)
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/v1.6.24/scripts/download-actionlint.bash)
- uses: pre-commit/[email protected]

publish:
Expand Down
32 changes: 16 additions & 16 deletions .github/workflows/reusable-build-test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ jobs:
execute-modinput_functional: ${{ steps.delay-destroy-setup.outputs.execute-modinput_functional }}
execute-scripted_inputs: ${{ steps.delay-destroy-setup.outputs.execute-scripted_inputs }}
execute-requirement_test: ${{ steps.delay-destroy-setup.outputs.execute-requirement_test }}
execute-labeled-knowledge: ${{ steps.configure-tests-on-labels.outputs.execute-labeled-knowledge }}
execute-labeled-ui: ${{ steps.configure-tests-on-labels.outputs.execute-labeled-ui }}
execute-labeled-escu: ${{ steps.configure-tests-on-labels.outputs.execute-labeled-escu }}
execute-labeled-modinput: ${{ steps.configure-tests-on-labels.outputs.execute-labeled-modinput_functional }}
execute-labeled-scripted_inputs: ${{ steps.configure-tests-on-labels.outputs.execute-labeled-scripted_inputs }}
execute-labeled-requirement: ${{ steps.configure-tests-on-labels.outputs.execute-labeled-requirement_test }}
execute-labeled-knowledge: ${{ steps.configure-tests-on-labels.outputs.execute_knowledge_labeled }}
execute-labeled-ui: ${{ steps.configure-tests-on-labels.outputs.execute_ui_labeled }}
execute-labeled-escu: ${{ steps.configure-tests-on-labels.outputs.execute_escu_labeled }}
execute-labeled-modinput: ${{ steps.configure-tests-on-labels.outputs.execute_modinput_functional_labeled }}
execute-labeled-scripted_inputs: ${{ steps.configure-tests-on-labels.outputs.execute_scripted_inputs_labeled }}
execute-labeled-requirement: ${{ steps.configure-tests-on-labels.outputs.execute_requirement_test_labeled }}
steps:
- name: skip workflow if description is empty for labeled pr
id: skip-workflow
Expand Down Expand Up @@ -104,8 +104,8 @@ jobs:
set +e
TESTSET="${{ steps.skip-workflow.outputs.testset }}"
for test_type in $TESTSET; do
eval DELAY_DESTROY_"$test_type"="No"
eval EXECUTE_"$test_type"="No"
eval DELAY_DESTROY_$test_type="No"
eval EXECUTE_$test_type="No"
done
if [[ '${{ github.event.label.name }}' == 'preserve_infra' ]]; then
echo "$PR_BODY" >> body.txt
Expand All @@ -115,8 +115,8 @@ jobs:
fi
for test_type in $TESTSET; do
if [[ $tests =~ $test_type ]]; then
eval EXECUTE_"$test_type"="Yes"
eval DELAY_DESTROY_"$test_type"="Yes"
eval EXECUTE_$test_type="Yes"
eval DELAY_DESTROY_$test_type="Yes"
fi
done
fi
Expand Down Expand Up @@ -180,8 +180,8 @@ jobs:
echo "Tests to execute based on labels:"
for test_type in "${TESTSET[@]}"; do
echo "execute-labeled-$test_type=${EXECUTE_LABELED["$test_type"]}" >> "$GITHUB_OUTPUT"
echo "execute-labeled-$test_type: ${EXECUTE_LABELED["$test_type"]}"
echo "$test_type""_labeled=${EXECUTE_LABELED["$test_type"]}" >> "$GITHUB_OUTPUT"
echo "$test_type""_labeled: ${EXECUTE_LABELED["$test_type"]}"
done
meta:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -1015,7 +1015,7 @@ jobs:
id: get-argo-token
run: |
ARGO_TOKEN=$(aws secretsmanager get-secret-value --secret-id ta-github-workflow-automation-token | jq -r '.SecretString')
echo "::set-output name=argo-token::$ARGO_TOKEN"
echo "argo-token=$ARGO_TOKEN" >> "$GITHUB_OUTPUT"
- name: create job name
id: create-job-name
shell: bash
Expand All @@ -1025,7 +1025,7 @@ jobs:
JOB_NAME=${JOB_NAME//TEST-TYPE/${{ env.TEST_TYPE }}}
JOB_NAME=${JOB_NAME//[_.]/-}
JOB_NAME=$(echo "$JOB_NAME" | tr '[:upper:]' '[:lower:]')
echo "::set-output name=job-name::$JOB_NAME"
echo "job-name=$JOB_NAME" >> "$GITHUB_OUTPUT"
- name: Splunk instance details
id: splunk-instance-details
if: ${{ needs.setup-workflow.outputs.delay-destroy-requirement_test == 'Yes' }}
Expand Down Expand Up @@ -1064,7 +1064,7 @@ jobs:
run: |
set -o xtrace
if argo watch ${{ steps.run-tests.outputs.workflow-name }} -n workflows | grep "pod deleted"; then
echo "::set-output name=retry-workflow::true"
echo "retry-workflow=true" >> "$GITHUB_OUTPUT"
fi
- name: Retrying workflow
id: retry-wf
Expand All @@ -1078,7 +1078,7 @@ jobs:
if [[ "${{ steps.is-pod-deleted.outputs.retry-workflow }}" == "true" ]]
then
WORKFLOW_NAME=$(argo resubmit -v -o json -n workflows "${{ steps.run-tests.outputs.workflow-name }}" | jq -r .metadata.name)
echo "::set-output name=workflow-name::$$WORKFLOW_NAME"
echo "workflow-name=$WORKFLOW_NAME" >> "$GITHUB_OUTPUT"
argo logs --follow "${WORKFLOW_NAME}" -n workflows || echo "... there was an error fetching logs, the workflow is still in progress. please wait for the workflow to complete ..."
else
echo "No retry required"
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

# GitHub repository details
OWNER="your_username"
REPO="your_repository"

# GitHub API endpoint for labels
API_URL="https://api.github.com/repos/$OWNER/$REPO/labels"

# GitHub personal access token (replace with your own)
TOKEN="your_personal_access_token"


# Array of label details
LABELS=(
'{"name": "execute_knowledge", "description": "Trigger execution of knowledge objects tests", "color": "4040F2"}'
'{"name": "execute_ui", "description": "Trigger execution of ui tests", "color": "F79D34"}'
'{"name": "execute_modinput_functional", "description": "Trigger execution of modinput functional tests", "color": "7ED321"}'
'{"name": "execute_scripted_inputs", "description": "Trigger execution of scripted inputs tests", "color": "9013FE"}'
'{"name": "execute_escu", "description": "Trigger execution of escu tests", "color": "F5A623"}'
'{"name": "execute_requirement_test", "description": "Trigger execution of requirement tests", "color": "F8E71C"}'
'{"name": "execute_all_tests", "description": "Trigger execution of all tests types", "color": "006B76"}'
)

# Loop through the labels and add them to the repository
for label in "${LABELS[@]}"; do
gh label create "$(echo "$label" | jq -r '.| .name')" --color "$(echo "$label" | jq -r '.| .color')" --description "$(echo "$label" | jq '.| .description')" --force
done

0 comments on commit fd75521

Please sign in to comment.