diff --git a/.github/actions/artifacts_build/action.yml b/.github/actions/artifacts_build/action.yml index 60acfffc2..7543b04e3 100644 --- a/.github/actions/artifacts_build/action.yml +++ b/.github/actions/artifacts_build/action.yml @@ -104,4 +104,5 @@ runs: uses: ./.github/actions/image_scan with: image-ref: ${{ inputs.image_uri_with_tag }} - severity: 'CRITICAL,HIGH,MEDIUM,LOW,UNKNOWN' \ No newline at end of file + severity: 'CRITICAL,HIGH,MEDIUM,LOW,UNKNOWN' + logout: 'true' \ No newline at end of file diff --git a/.github/actions/image_scan/action.yml b/.github/actions/image_scan/action.yml index 196f90be8..31d5a78fe 100644 --- a/.github/actions/image_scan/action.yml +++ b/.github/actions/image_scan/action.yml @@ -11,6 +11,11 @@ inputs: severity: required: true description: "List of severities that will cause a failure" + logout: + required: true + description: | + Whether to logout of public AWS ECR. Set to 'true' for PR workflows to avoid potential call failures, + 'false' for daily scans which has a higher bar for passing regularly and specifically wants to sign in. runs: using: "composite" @@ -22,6 +27,7 @@ runs: # ensure we can make unauthenticated call. This is important for making the pr_build workflow run on # PRs created from forked repos. - name: Logout of public AWS ECR + if: inputs.logout == 'true' shell: bash run: docker logout public.ecr.aws @@ -30,4 +36,4 @@ runs: with: image-ref: ${{ inputs.image-ref }} severity: ${{ inputs.severity }} - exit-code: '1' \ No newline at end of file + exit-code: '1' diff --git a/.github/workflows/daily_scan.yml b/.github/workflows/daily_scan.yml index 30b9476fe..e3a8a0128 100644 --- a/.github/workflows/daily_scan.yml +++ b/.github/workflows/daily_scan.yml @@ -77,6 +77,17 @@ jobs: if: ${{ steps.dep_scan.outcome != 'success' }} run: less dependency-check-report.html + - name: Configure AWS credentials for image scan + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN }} + aws-region: ${{ env.AWS_DEFAULT_REGION }} + + - name: Login to Public ECR + uses: docker/login-action@v3 + with: + registry: public.ecr.aws + - name: Perform high image scan if: always() id: high_scan @@ -84,6 +95,7 @@ jobs: with: image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-python:v0.10.1" severity: 'CRITICAL,HIGH' + logout: 'false' - name: Perform low image scan if: always() @@ -92,6 +104,7 @@ jobs: with: image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-python:v0.10.1" severity: 'MEDIUM,LOW,UNKNOWN' + logout: 'false' - name: Configure AWS Credentials for emitting metrics if: always()