9797 SPL_COM_PASSWORD :
9898 description : password to splunk.com
9999 required : true
100+ GSSA_AWS_ACCESS_KEY_ID :
101+ description : GSSA AWS access key id
102+ required : true
103+ GSSA_AWS_SECRET_ACCESS_KEY :
104+ description : GSSA AWS secret access key
105+ required : true
100106permissions :
101107 contents : read
102108 packages : read
107113 PYTHON_VERSION : " 3.9"
108114 POETRY_VERSION : " 2.1.4"
109115 POETRY_EXPORT_PLUGIN_VERSION : " 1.9.0"
116+ GS_IMAGE_VERSION : " 1.0.0"
117+ GS_VERSION : " 0.3"
110118jobs :
111119 validate-custom-version :
112120 runs-on : ubuntu-latest
@@ -481,24 +489,30 @@ jobs:
481489 run : |
482490 if [ -f "poetry.lock" ]
483491 then
492+ python${{ env.PYTHON_VERSION }} -m pip install poetry==${{ env.POETRY_VERSION }} poetry-plugin-export==${{ env.POETRY_EXPORT_PLUGIN_VERSION }}
484493 mkdir -p package/lib || true
485- python${{ env.PYTHON_VERSION }} -m pip install poetry==${{ env.POETRY_VERSION }} poetry-plugin-export==${{ env.POETRY_EXPORT_PLUGIN_VERSION }}
486- poetry check
494+ poetry check --lock
487495 poetry export --without-hashes -o package/lib/requirements.txt
488- poetry export --without-hashes --with dev -o requirements_dev.txt
489496 fi
490- if [ ! -f requirements_dev.txt ]; then echo no requirements;exit 0 ;fi
497+ if [ ! -f dev_deps/requirements_dev.txt ]; then
498+ echo "No dev_deps/requirements_dev.txt. Migrate your dependencies to dev_deps/requirements_dev.txt"
499+ exit 1
500+ else
501+ echo "Found dev_deps/requirements_dev.txt. Installing dev dependencies in an isolated environment";
502+ fi
491503 git config --global --add url."https://${{ secrets.GH_TOKEN_ADMIN }}@github.com".insteadOf https://github.com
492504 git config --global --add url."https://${{ secrets.GH_TOKEN_ADMIN }}@github.com".insteadOf ssh://git@github.com
493- poetry install --with dev
505+ python${{ env.PYTHON_VERSION }} -m venv ~/.dev_venv
506+ ~/.dev_venv/bin/python${{ env.PYTHON_VERSION }} -m pip install -r dev_deps/requirements_dev.txt
507+ ~/.dev_venv/bin/python${{ env.PYTHON_VERSION }} -m pip install -r package/lib/requirements.txt
494508 - name : Create directories
495509 run : |
496510 mkdir -p /opt/splunk/var/log/splunk
497511 chmod -R 777 /opt/splunk/var/log/splunk
498512 - name : Copy pytest ini
499513 run : cp tests/unit/pytest-ci.ini pytest.ini
500514 - name : Run Pytest with coverage
501- run : poetry run pytest --cov=./ --cov-report=xml --junitxml=test-results/junit.xml tests/unit
515+ run : ~/.dev_venv/bin/python${{ env.PYTHON_VERSION }} -m pytest --cov=./ --cov-report=xml --junitxml=test-results/junit.xml tests/unit
502516 - name : Job summary
503517 continue-on-error : true
504518 run : |
@@ -568,48 +582,41 @@ jobs:
568582 echo "No prod dependencies were found"
569583 rm requirements.txt
570584 fi
571- poetry export --without-hashes --with dev -o requirements_dev.txt
572- cat requirements_dev.txt
573585 fi
574586 - name : Setup UCC
575587 run : |
576- if [ -f "requirements_ucc.txt" ]; then
577- python${{ env.PYTHON_VERSION }} -m venv .ucc_venv
588+ if [ -f "dev_deps/requirements_ucc.txt" ]; then
578589 echo "Found requirements_ucc.txt. Installing UCC dependencies in an isolated environment"
579- ./.ucc_venv/bin/python -m pip install -r requirements_ucc.txt
580- export UCC_GEN="$PWD/.ucc_venv/bin/ucc-gen"
581-
590+ python${{ env.PYTHON_VERSION }} -m venv ~/.ucc_venv
591+ ~/.ucc_venv/bin/python${{ env.PYTHON_VERSION }} -m pip install -r dev_deps/requirements_ucc.txt
592+ export UCC_GEN="$HOME/.ucc_venv/bin/ucc-gen"
593+
582594 if [ ! -f "$UCC_GEN" ]; then
583- echo "ucc-gen not found after installing requirements from requirements_ucc.txt"
595+ echo "ucc-gen not found after installing requirements from dev_deps/ requirements_ucc.txt"
584596 exit 1
585597 fi
586598
587599 echo "UCC_GEN=$UCC_GEN" >> "$GITHUB_ENV"
588600 else
589601 echo "No UCC requirements file found, skipping UCC setup"
590- echo "Consider adding a requirements_ucc.txt file and place UCC requirement there, to avoid dependency conflicts"
602+ echo "Create a dev_deps/requirements_ucc.txt file and place UCC requirement there, to avoid dependency conflicts"
603+ exit 1
591604 fi
592605 - name : Get pip cache dir
593606 id : pip-cache
594607 run : |
595608 echo "dir=$(pip cache dir)" >> "$GITHUB_OUTPUT"
596609 - name : Run Check there are libraries to scan
597610 id : checklibs
598- run : if [ -f requirements_dev.txt ]; then echo "ENABLED=true" >> "$GITHUB_OUTPUT"; fi
611+ run : if [ -f dev_deps/ requirements_dev.txt ]; then echo "ENABLED=true" >> "$GITHUB_OUTPUT"; fi
599612 - name : pip cache
600613 if : ${{ steps.checklibs.outputs.ENABLED == 'true' }}
601614 uses : actions/cache@v4
602615 with :
603616 path : ${{ steps.pip-cache.outputs.dir }}
604- key : ${{ runner.os }}-pip-${{ hashFiles('requirements_dev.txt') }}
617+ key : ${{ runner.os }}-pip-${{ hashFiles('dev_deps/ requirements_dev.txt') }}
605618 restore-keys : |
606619 ${{ runner.os }}-pip-
607- - name : Install deps
608- if : ${{ steps.checklibs.outputs.ENABLED == 'true' }}
609- run : |
610- git config --global --add url."https://${{ secrets.GH_TOKEN_ADMIN }}@github.com".insteadOf https://github.com
611- git config --global --add url."https://${{ secrets.GH_TOKEN_ADMIN }}@github.com".insteadOf ssh://git@github.com
612- pip install -r requirements_dev.txt
613620 - name : Semantic Release Get Next
614621 id : semantic
615622 if : github.event_name != 'pull_request'
@@ -812,6 +819,50 @@ jobs:
812819 name : appinspect-api-html-report-${{ matrix.tags }}
813820 path : AppInspect_response.html
814821
822+ run-gs-scorecard :
823+ name : quality-gs-scorecard
824+ needs : build
825+ if : ${{ !cancelled() && needs.build.result == 'success' && (github.ref_name == 'main' && github.event_name == 'push') }}
826+ runs-on : ubuntu-latest
827+ steps :
828+ - uses : actions/checkout@v4
829+ - name : Configure AWS credentials
830+ uses : aws-actions/configure-aws-credentials@v4
831+ with :
832+ aws-access-key-id : ${{ secrets.GSSA_AWS_ACCESS_KEY_ID }}
833+ aws-secret-access-key : ${{ secrets.GSSA_AWS_SECRET_ACCESS_KEY }}
834+ aws-region : us-west-2
835+ - name : Login to Amazon ECR
836+ uses : aws-actions/amazon-ecr-login@v2
837+ - name : Pull GS Scorecard image
838+ run :
839+ docker pull 956110764581.dkr.ecr.us-west-2.amazonaws.com/ta-automation/gs-scorecard:${{ env.GS_IMAGE_VERSION }}
840+ - name : Run GS Scorecard
841+ env :
842+ GITHUB_TOKEN : ${{ secrets.GH_TOKEN_ADMIN }}
843+ GITHUB_USERNAME : ${{ secrets.SA_GH_USER_NAME }}
844+ APPINSPECT_USER : ${{ secrets.SPL_COM_USER }}
845+ APPINSPECT_PASS : ${{ secrets.SPL_COM_PASSWORD }}
846+ run : |
847+ docker run --rm \
848+ -e GITHUB_TOKEN \
849+ -e GITHUB_USERNAME \
850+ -e AWS_ACCESS_KEY_ID="${{ secrets.GSSA_AWS_ACCESS_KEY_ID }}" \
851+ -e AWS_SECRET_ACCESS_KEY="${{ secrets.GSSA_AWS_SECRET_ACCESS_KEY }}" \
852+ -e AWS_DEFAULT_REGION="us-west-2" \
853+ -e APPINSPECT_USER \
854+ -e APPINSPECT_PASS \
855+ -e GS_VERSION="${{ env.GS_VERSION }}" \
856+ -v "$(pwd)":/addon \
857+ 956110764581.dkr.ecr.us-west-2.amazonaws.com/ta-automation/gs-scorecard:"${{ env.GS_IMAGE_VERSION }}"
858+
859+ - name : Upload GS Scorecard report
860+ uses : actions/upload-artifact@v4
861+ if : always()
862+ with :
863+ name : gs-scorecard-report
864+ path : ./gs_scorecard.html
865+
815866 setup :
816867 needs :
817868 - setup-workflow
@@ -902,11 +953,12 @@ jobs:
902953 env :
903954 PYTHON_KEYRING_BACKEND : keyring.backends.null.Keyring
904955 run : |
905- poetry install --only modinput
956+ python${{ env.PYTHON_VERSION }} -m venv ~/.dev_venv
957+ ~/.dev_venv/bin/python${{ env.PYTHON_VERSION }} -m pip install -r dev_deps/requirements_dev.txt
906958 if [ -f "tests/ucc_modinput_functional/tmp/openapi.json" ]; then
907- poetry run ucc-test-modinput gen -o tests/ucc_modinput_functional/tmp/openapi.json -t ${{ steps.download-openapi.outputs.download-path }}/tmp/
959+ ~/.dev_venv/bin/ ucc-test-modinput gen -o tests/ucc_modinput_functional/tmp/openapi.json -t ${{ steps.download-openapi.outputs.download-path }}/tmp/
908960 else
909- poetry run ucc-test-modinput gen -o ${{ steps.download-openapi.outputs.download-path }}/openapi.json -t ${{ steps.download-openapi.outputs.download-path }}/tmp/
961+ ~/.dev_venv/bin/ ucc-test-modinput gen -o ${{ steps.download-openapi.outputs.download-path }}/openapi.json -t ${{ steps.download-openapi.outputs.download-path }}/tmp/
910962 fi
911963 - name : upload-libs-to-s3
912964 id : upload-libs-to-s3
@@ -915,9 +967,11 @@ jobs:
915967 AWS_DEFAULT_REGION : ${{ secrets.AWS_DEFAULT_REGION }}
916968 AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
917969 run : |
918- poetry install --with dev
970+ python${{ env.PYTHON_VERSION }} -m venv ~/.dev_venv
971+ echo "Found requirements_dev.txt. Installing dev dependencies in an isolated environment"
972+ ~/.dev_venv/bin/python${{ env.PYTHON_VERSION }} -m pip install -r dev_deps/requirements_dev.txt
919973 libs_archive=libs_$(basename "$BUILD_NAME" .spl).tgz
920- cp -r "$(find "$(poetry env info --path)" -maxdepth 3 -type d -name " site-packages")" libs/
974+ cp -r ~/.dev_venv/lib/python${{ env.PYTHON_VERSION }}/ site-packages/ libs/
921975 tar -czf "$libs_archive" libs
922976 aws s3 cp "$libs_archive" "s3://${{ needs.setup-workflow.outputs.s3_bucket_k8s }}/ta-apps/$libs_archive" --only-show-errors
923977 - name : upload-swagger-artifacts-to-s3
@@ -1265,7 +1319,7 @@ jobs:
12651319 run : |
12661320 start_time=${{ steps.capture-start-time.outputs.start_time }}
12671321 current_time=$(date +%s)
1268- remaining_time_minutes=$(( 350 -((current_time-start_time)/60) ))
1322+ remaining_time_minutes=$(( 300 -((current_time-start_time)/60) ))
12691323 echo "remaining_time_minutes=$remaining_time_minutes" >> "$GITHUB_OUTPUT"
12701324 - name : Check if pod was deleted
12711325 id : is-pod-deleted
@@ -1550,7 +1604,7 @@ jobs:
15501604 run : |
15511605 start_time=${{ steps.capture-start-time.outputs.start_time }}
15521606 current_time=$(date +%s)
1553- remaining_time_minutes=$(( 350 -((current_time-start_time)/60) ))
1607+ remaining_time_minutes=$(( 300 -((current_time-start_time)/60) ))
15541608 echo "remaining_time_minutes=$remaining_time_minutes" >> "$GITHUB_OUTPUT"
15551609 - name : Check if pod was deleted
15561610 id : is-pod-deleted
@@ -1826,7 +1880,7 @@ jobs:
18261880 run : |
18271881 start_time=${{ steps.capture-start-time.outputs.start_time }}
18281882 current_time=$(date +%s)
1829- remaining_time_minutes=$(( 350 -((current_time-start_time)/60) ))
1883+ remaining_time_minutes=$(( 300 -((current_time-start_time)/60) ))
18301884 echo "remaining_time_minutes=$remaining_time_minutes" >> "$GITHUB_OUTPUT"
18311885 - name : Check if pod was deleted
18321886 id : is-pod-deleted
@@ -2101,7 +2155,7 @@ jobs:
21012155 run : |
21022156 start_time=${{ steps.capture-start-time.outputs.start_time }}
21032157 current_time=$(date +%s)
2104- remaining_time_minutes=$(( 350 -((current_time-start_time)/60) ))
2158+ remaining_time_minutes=$(( 300 -((current_time-start_time)/60) ))
21052159 echo "remaining_time_minutes=$remaining_time_minutes" >> "$GITHUB_OUTPUT"
21062160 - name : Check if pod was deleted
21072161 id : is-pod-deleted
@@ -2365,7 +2419,7 @@ jobs:
23652419 run : |
23662420 start_time=${{ steps.capture-start-time.outputs.start_time }}
23672421 current_time=$(date +%s)
2368- remaining_time_minutes=$(( 350 -((current_time-start_time)/60) ))
2422+ remaining_time_minutes=$(( 300 -((current_time-start_time)/60) ))
23692423 echo "remaining_time_minutes=$remaining_time_minutes" >> "$GITHUB_OUTPUT"
23702424 - name : Check if pod was deleted
23712425 id : is-pod-deleted
@@ -2634,7 +2688,7 @@ jobs:
26342688 run : |
26352689 start_time=${{ steps.capture-start-time.outputs.start_time }}
26362690 current_time=$(date +%s)
2637- remaining_time_minutes=$(( 350 -((current_time-start_time)/60) ))
2691+ remaining_time_minutes=$(( 300 -((current_time-start_time)/60) ))
26382692 echo "remaining_time_minutes=$remaining_time_minutes" >> "$GITHUB_OUTPUT"
26392693 - name : Check if pod was deleted
26402694 id : is-pod-deleted
0 commit comments