Skip to content

Commit efced57

Browse files
mkolasinski-splunkmbruzda-splunkdkaras-splunkpoojpat2
authored
fix: GSSA inputs and version update (#467)
### Description fix: update GSSA default image version fix: add pass/fail for GSSA job fix: scheduled workflows only on latest Splunk feat: add inputs for GSSA and GS standard versions ### Checklist - [x] `README.md` has been updated or is not required - [ ] push trigger tests - [ ] manual release test - [ ] automated releases test - [ ] pull request trigger tests - [ ] schedule trigger tests - [ ] workflow errors/warnings reviewed and addressed ### Testing done splunk/splunk-add-on-for-microsoft-windows#575 splunk/splunk-add-on-for-google-cloud-platform#917 splunk/splunk-add-on-for-okta-identity-cloud#412 --------- Co-authored-by: Marcin Bruzda <94437843+mbruzda-splunk@users.noreply.github.com> Co-authored-by: Dariusz Karas <dkaras@splunk.com> Co-authored-by: Dariusz Karas <78362586+dkaras-splunk@users.noreply.github.com> Co-authored-by: poojpat2 <poojpat2@cisco.com> Co-authored-by: poojpat2 <poojpat2@splunk.com>
1 parent 40159b8 commit efced57

File tree

2 files changed

+65
-17
lines changed

2 files changed

+65
-17
lines changed

.github/workflows/reusable-build-test-release.yml

Lines changed: 64 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ on:
6262
description: "Python version to use for testing"
6363
type: string
6464
default: "3.9"
65+
gs-image-version:
66+
required: false
67+
description: "Version of the GS scorecard Docker image"
68+
type: string
69+
default: "1.1"
70+
gs-version:
71+
required: false
72+
description: "Version of the GS scorecard"
73+
type: string
74+
default: "0.3"
6575
secrets:
6676
GH_TOKEN_ADMIN:
6777
description: Github admin token
@@ -118,8 +128,8 @@ env:
118128
PYTHON_VERSION: ${{ inputs.python-version }}
119129
POETRY_VERSION: "2.1.4"
120130
POETRY_EXPORT_PLUGIN_VERSION: "1.9.0"
121-
GS_IMAGE_VERSION: "1.0.0"
122-
GS_VERSION: "0.3"
131+
GS_IMAGE_VERSION: ${{ inputs.gs-image-version }}
132+
GS_VERSION: ${{ inputs.gs-version }}
123133
jobs:
124134
validate-custom-version:
125135
runs-on: ubuntu-latest
@@ -144,7 +154,7 @@ jobs:
144154
steps:
145155
- uses: actions/checkout@v4
146156
- run: |
147-
if grep -q 'splunktafunctionaltests' poetry.lock; then
157+
if grep -q 'splunktafunctionaltests' poetry.lock || grep -q 'splunktafunctionaltests' dev_deps/requirements_dev.txt 2>/dev/null; then
148158
echo "::warning title=\"splunktafunctionaltests\" should NOT be used for modinput tests::For more details, please see https://splunk.slack.com/archives/C081JT7R69Z/p1754662758743839."
149159
exit 1
150160
else
@@ -246,10 +256,6 @@ jobs:
246256
echo "spl2::true"
247257
fi
248258
249-
# GS Scorecard is always available
250-
TESTS_TO_CONSIDER_FOR_EXECUTION+=("execute_gs_scorecard")
251-
echo "gs_scorecard::true"
252-
253259
found_unit_test=false
254260
for test_name in "${TESTS_TO_CONSIDER_FOR_EXECUTION[@]}"; do
255261
if [[ "$test_name" == "execute_unit" ]]; then
@@ -318,6 +324,14 @@ jobs:
318324
echo "No tests were labeled for execution!"
319325
;;
320326
esac
327+
328+
# GS Scorecard: runs when label is present (any PR) or on push to main
329+
# Required (must not be skipped) for merging PRs to main -- enforced in pre-publish
330+
if [[ "${{ github.event_name }}" == "pull_request" ]] && [[ "$labels" =~ execute_gs_scorecard ]]; then
331+
EXECUTION_FLAGS["execute_gs_scorecard"]="true"
332+
elif [[ "${{ github.event_name }}" == "push" ]] && [[ "${{ github.ref_name }}" == "main" ]]; then
333+
EXECUTION_FLAGS["execute_gs_scorecard"]="true"
334+
fi
321335
fi
322336
echo "Tests to be executed:"
323337
for test_type in "${TESTSET[@]}"; do
@@ -373,15 +387,24 @@ jobs:
373387
- id: determine_splunk
374388
env:
375389
wfe_run_on_splunk_latest: ${{ inputs.wfe-run-on-splunk-latest }}
376-
run: |
377-
if [[ "$wfe_run_on_splunk_latest" == "" ]]; then
378-
wfe_run_on_splunk_latest="${{ github.event_name == 'schedule' || !((github.base_ref == 'main' || github.ref_name == 'main') || ((github.base_ref == 'develop' || github.ref_name == 'develop') && github.event_name == 'push')) }}"
390+
run: |
391+
if [[ "${{ github.event_name }}" == "schedule" ]]; then
392+
wfe_run_on_splunk_latest="true"
393+
394+
else
395+
if [[ "${{ github.base_ref }}" == "main" || "${{ github.ref_name }}" == "main" ]] || \
396+
[[ "${{ github.ref_name }}" == "develop" && "${{ github.event_name }}" == "push" ]]; then
397+
wfe_run_on_splunk_latest="false"
398+
else
399+
wfe_run_on_splunk_latest="true"
400+
fi
379401
fi
380402
if [[ "$wfe_run_on_splunk_latest" == "true" ]]; then
381403
echo "matrixSplunk=${{ toJson(steps.matrix.outputs.latestSplunk) }}" >> "$GITHUB_OUTPUT"
382404
else
383-
echo "matrixSplunk=${{toJson(steps.matrix.outputs.supportedSplunk) }}" >> "$GITHUB_OUTPUT"
405+
echo "matrixSplunk=${{ toJson(steps.matrix.outputs.supportedSplunk) }}" >> "$GITHUB_OUTPUT"
384406
fi
407+
385408
- name: job summary
386409
run: |
387410
splunk_version_list=$(echo '${{ steps.determine_splunk.outputs.matrixSplunk }}' | jq -r '.[].version')
@@ -865,13 +888,25 @@ jobs:
865888
-e GS_VERSION="${{ env.GS_VERSION }}" \
866889
-v "$(pwd)":/addon \
867890
956110764581.dkr.ecr.us-west-2.amazonaws.com/ta-automation/gs-scorecard:"${{ env.GS_IMAGE_VERSION }}"
868-
869891
- name: Upload GS Scorecard report
870892
uses: actions/upload-artifact@v4
871-
if: always()
872893
with:
873894
name: gs-scorecard-report
874-
path: ./gs_scorecard.html
895+
path: ./gs_scorecard.json
896+
- name: Print and verify GS Scorecard report
897+
run: |
898+
if [ ! -f ./gs_scorecard.json ]; then
899+
echo "::error::GS Scorecard report not found"
900+
exit 1
901+
fi
902+
echo "::group::GS Scorecard Report"
903+
jq . ./gs_scorecard.json
904+
echo "::endgroup::"
905+
passed=$(jq -r '.result.passed' ./gs_scorecard.json)
906+
if [ "$passed" != "true" ]; then
907+
echo "::error::GS Scorecard failed"
908+
exit 1
909+
fi
875910
876911
setup:
877912
needs:
@@ -1057,7 +1092,7 @@ jobs:
10571092
echo "job-name=$JOB_NAME" >> "$GITHUB_OUTPUT"
10581093
- name: run-btool-check
10591094
id: run-btool-check
1060-
timeout-minutes: 10
1095+
timeout-minutes: 20
10611096
env:
10621097
ARGO_TOKEN: ${{ steps.get-argo-token.outputs.argo-token }}
10631098
uses: splunk/wfe-test-runner-action@v5.2
@@ -2886,6 +2921,7 @@ jobs:
28862921
- run-ucc-modinput-tests
28872922
- run-ui-tests
28882923
- validate-pr-title
2924+
- run-gs-scorecard
28892925
runs-on: ubuntu-latest
28902926
env:
28912927
NEEDS: ${{ toJson(needs) }}
@@ -2894,7 +2930,19 @@ jobs:
28942930
id: check
28952931
shell: bash
28962932
run: |
2897-
RUN_PUBLISH=$(echo "$NEEDS" | jq ".[] | select( ( .result != \"skipped\" ) and .result != \"success\" ) | length == 0")
2933+
# GS Scorecard: must have run for PRs to main (result doesn't matter, but skipped = blocked)
2934+
GS_RESULT=$(echo "$NEEDS" | jq -r '.["run-gs-scorecard"].result')
2935+
if [[ "${{ github.event_name }}" == "pull_request" ]] && [[ "${{ github.base_ref }}" == "main" ]] && [[ "$GS_RESULT" == "skipped" ]]; then
2936+
echo "::error::GS Scorecard is required for PRs to main. Add the 'execute_gs_scorecard' label and re-run the workflow."
2937+
echo "## GS Scorecard Required" >> "$GITHUB_STEP_SUMMARY"
2938+
echo "Add the \`execute_gs_scorecard\` label to this PR and re-run the workflow. GS Scorecard must complete before merging to main (result does not need to pass)." >> "$GITHUB_STEP_SUMMARY"
2939+
echo "run-publish=false" >> "$GITHUB_OUTPUT"
2940+
echo "Publish conditions are not met."
2941+
exit 1
2942+
fi
2943+
2944+
# Exclude run-gs-scorecard from the general check since it has its own handling above
2945+
RUN_PUBLISH=$(echo "$NEEDS" | jq 'del(.["run-gs-scorecard"]) | .[] | select((.result != "skipped") and .result != "success") | length == 0')
28982946
if [[ "$RUN_PUBLISH" != *'false'* ]] && [[ "${{ needs.check-docs-changes.outputs.docs-only }}" == 'false' ]]
28992947
then
29002948
echo "run-publish=true" >> "$GITHUB_OUTPUT"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ appinspect-api-html-report-self-service
532532

533533
- The GS Scorecard tool is containerized and runs in a Docker container, analyzing the repository and generating a comprehensive quality report.
534534

535-
- This job only runs on push events to the `main` branch after a successful build.
535+
- This job runs only after a successful build, either on push events to the main branch or when the execute_gs_scorecard label is added to a pull request.
536536

537537
**Action used:**
538538
- AWS ECR (Elastic Container Registry) for Docker image storage

0 commit comments

Comments
 (0)