Skip to content

Commit 0b727a0

Browse files
committed
add loging to image scan workflow
1 parent 0a87c6c commit 0b727a0

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

.github/actions/image_scan/action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ inputs:
1111
severity:
1212
required: true
1313
description: "List of severities that will cause a failure"
14+
logout:
15+
required: true
16+
description: "Whether to logout of public AWS ECR"
1417

1518
runs:
1619
using: "composite"
@@ -22,6 +25,7 @@ runs:
2225
# ensure we can make unauthenticated call. This is important for making the pr_build workflow run on
2326
# PRs created from forked repos.
2427
- name: Logout of public AWS ECR
28+
if: inputs.logout == 'true'
2529
shell: bash
2630
run: docker logout public.ecr.aws
2731

.github/workflows/owasp.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,25 @@ jobs:
7676
if: ${{ steps.dep_scan.outcome != 'success' }}
7777
run: less dependency-check-report.html
7878

79+
- name: Configure AWS credentials for image scan
80+
uses: aws-actions/configure-aws-credentials@v4
81+
with:
82+
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN }}
83+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
84+
85+
- name: Login to Public ECR
86+
uses: docker/login-action@v3
87+
with:
88+
registry: public.ecr.aws
89+
7990
- name: Perform high image scan on v1
8091
if: always()
8192
id: high_scan_v1
8293
uses: ./.github/actions/image_scan
8394
with:
8495
image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-java:v1.33.0"
8596
severity: 'CRITICAL,HIGH'
97+
logout: 'false'
8698

8799
- name: Perform low image scan on v1
88100
if: always()
@@ -91,6 +103,7 @@ jobs:
91103
with:
92104
image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-java:v1.33.0"
93105
severity: 'MEDIUM,LOW,UNKNOWN'
106+
logout: 'false'
94107

95108
- name: Perform high image scan on v2
96109
if: always()
@@ -99,6 +112,7 @@ jobs:
99112
with:
100113
image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-java:v2.11.1"
101114
severity: 'CRITICAL,HIGH'
115+
logout: 'false'
102116

103117
- name: Perform low image scan on v2
104118
if: always()
@@ -107,6 +121,7 @@ jobs:
107121
with:
108122
image-ref: "public.ecr.aws/aws-observability/adot-autoinstrumentation-java:v2.11.1"
109123
severity: 'MEDIUM,LOW,UNKNOWN'
124+
logout: 'false'
110125

111126
- name: Configure AWS Credentials for emitting metrics
112127
if: always()

.github/workflows/pr-build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ jobs:
147147
with:
148148
image-ref: ${{ env.TEST_TAG }}
149149
severity: 'CRITICAL,HIGH,MEDIUM,LOW,UNKNOWN'
150+
logout: 'true'
150151

151152
- name: Test docker image
152153
if: ${{ matrix.os == 'ubuntu-latest' }}

0 commit comments

Comments
 (0)