Skip to content

Commit 1cf2ce6

Browse files
feat: integrate GS Scorecard workflow (#444)
### Description This PR adds the GS scorecard job into reusable release. Do not merge until 1.0.0 GS scorecard image is pushed to ecr ### Checklist - [x] `README.md` has been updated or is not required - [ ] push trigger tests - [ ] manual release test - [x] automated releases test - [ ] pull request trigger tests - [ ] schedule trigger tests - [ ] workflow errors/warnings reviewed and addressed ### Testing done https://github.com/splunk/splunk-add-on-for-microsoft-cloud-services/actions/runs/18752030521/job/53494778020
1 parent 8235a57 commit 1cf2ce6

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed

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

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ on:
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
100106
permissions:
101107
contents: read
102108
packages: read
@@ -107,6 +113,8 @@ env:
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"
110118
jobs:
111119
validate-custom-version:
112120
runs-on: ubuntu-latest
@@ -811,6 +819,50 @@ jobs:
811819
name: appinspect-api-html-report-${{ matrix.tags }}
812820
path: AppInspect_response.html
813821

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+
814866
setup:
815867
needs:
816868
- setup-workflow

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* [[Job] build](#job-build)
2121
* [[Job] AppInspect](#job-appinspect)
2222
* [[Job] AppInspect API](#job-appinspect-api)
23+
* [[Job] run-gs-scorecard](#job-run-gs-scorecard)
2324
* [[Job] setup](#job-setup)
2425
* [[Job] test-unit-python3](#job-test-unit-python3)
2526
* [[Job] run-btool-check](#job-run-btool-check)
@@ -523,6 +524,46 @@ appinspect-api-html-report-self-service
523524
```
524525

525526

527+
## [Job] run-gs-scorecard
528+
529+
**Description**
530+
531+
- This job runs the Gold Standard Scorecard quality assessment tool to evaluate the add-on against security and quality standards.
532+
533+
- The GS Scorecard tool is containerized and runs in a Docker container, analyzing the repository and generating a comprehensive quality report.
534+
535+
- This job only runs on push events to the `main` branch after a successful build.
536+
537+
**Action used:**
538+
- AWS ECR (Elastic Container Registry) for Docker image storage
539+
- Custom Docker image: `ta-automation/gs-scorecard` pushed from GitLab GS Scorecard repository
540+
541+
**Pass/fail behaviour:**
542+
543+
- The job executes the GS Scorecard analysis and generates a quality report.
544+
545+
- The job requires proper AWS credentials for accessing the ECR registry and GitHub credentials for repository analysis.
546+
547+
**Troubleshooting steps for failures if any:**
548+
549+
- Verify that the required secrets are properly configured in GitHub Actions:
550+
- `GSSA_AWS_ACCESS_KEY_ID` and `GSSA_AWS_SECRET_ACCESS_KEY` for AWS ECR access
551+
- `GH_TOKEN_ADMIN` and `SA_GH_USER_NAME` for GitHub access
552+
- `SPL_COM_USER` and `SPL_COM_PASSWORD` for AppInspect integration
553+
554+
- Check that the Docker image version specified in `GS_SCORECARD_VERSION` environment variable exists in the ECR registry.
555+
556+
- Review the job logs for specific error messages from the GS Scorecard tool.
557+
558+
- Ensure the build job completed successfully before this job runs, as it depends on the build artifacts.
559+
560+
**Artifacts:**
561+
562+
```
563+
gs-scorecard-report (gs_scorecard.html)
564+
```
565+
566+
526567
## [Job] setup
527568

528569
**Description:**

0 commit comments

Comments
 (0)