@@ -20,7 +20,7 @@ permissions:
20
20
security-events : write
21
21
22
22
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
23
- jobs :
23
+ jobs :
24
24
iac-scan :
25
25
# The type of runner that the job will run on
26
26
runs-on : ubuntu-latest
58
58
if : steps.changed-files.outputs.any_changed == 'true'
59
59
uses : docker/setup-buildx-action@v3
60
60
61
+ - name : Log in to Docker Hub
62
+ if : steps.changed-files.outputs.any_changed == 'true'
63
+ uses : docker/login-action@v3.3.0
64
+ with :
65
+ username : ${{ secrets.DOCKERHUB_USERNAME }}
66
+ password : ${{ secrets.DOCKERHUB_TOKEN }}
67
+
68
+ - name : Extract metadata (tags, labels) for Docker
69
+ if : steps.changed-files.outputs.any_changed == 'true'
70
+ id : meta
71
+ uses : docker/metadata-action@v5.5.1
72
+ with :
73
+ images : georgedavisibexlabs/publish-sarif-to-jira
74
+
61
75
- name : Build Docker image
62
76
if : steps.changed-files.outputs.any_changed == 'true'
63
77
uses : docker/build-push-action@v6.6.1
@@ -66,16 +80,17 @@ jobs:
66
80
file : Dockerfile
67
81
push : false
68
82
# sbom: true
69
- tags : georgedavisibexlabs/publish-sarif-to-jira:build
83
+ tags : ${{ steps.meta.outputs.tags }}
84
+ labels : ${{ steps.meta.outputs.labels }}
70
85
71
86
- name : Run Trivy in GitHub SBOM mode and submit results to Dependency Graph
72
87
if : steps.changed-files.outputs.any_changed == 'true'
73
88
uses : aquasecurity/trivy-action@0.24.0
74
89
with :
75
- scan-type : ' fs '
76
- format : ' github'
77
- output : ' dependency-results.sbom.json'
78
- image-ref : ' . '
90
+ scan-type : " fs "
91
+ format : " github"
92
+ output : " dependency-results.sbom.json"
93
+ image-ref : " georgedavisibexlabs/publish-sarif-to-jira:main "
79
94
github-pat : ${{ secrets.GITHUB_TOKEN }}
80
95
81
96
- name : Upload trivy SBOM as a Github artifact
@@ -86,30 +101,22 @@ jobs:
86
101
path : trivy-dependency-results.sbom.json
87
102
retention-days : 30
88
103
89
- - name : List Docker Containers
90
- if : steps.changed-files.outputs.any_changed == 'true'
91
- run : ' docker ps -a'
104
+ - name : Run Trivy Image scanner
105
+ uses : aquasecurity/trivy-action@0.24.0
106
+ with :
107
+ scan-type : " image"
108
+ image-ref : " georgedavisibexlabs/publish-sarif-to-jira:main"
109
+ limit-severities-for-sarif : true
110
+ trivy-config : .github/config/trivy-sarif.yaml
92
111
93
- - name : List Docker Images
94
- if : steps.changed-files.outputs.any_changed == 'true'
95
- run : ' docker images'
96
-
97
- # - name: Run Trivy Image scanner
98
- # uses: aquasecurity/trivy-action@0.24.0
99
- # with:
100
- # scan-type: 'image'
101
- # image-ref: 'georgedavisibexlabs/publish-sarif-to-jira'
102
- # limit-severities-for-sarif: true
103
- # trivy-config: .github/config/trivy-sarif.yaml
104
-
105
- # - name: Upload Trivy Image scan results
106
- # uses: actions/upload-artifact@v4.3.6
107
- # with:
108
- # name: trivy-image-scan-results
109
- # path: trivy-image-scan-results.sarif
110
- # retention-days: 30
111
-
112
- # - name: Upload Trivy scan results to GitHub Security tab
113
- # uses: github/codeql-action/upload-sarif@v3
114
- # with:
115
- # sarif_file: 'trivy-image-scan-results.sarif'
112
+ - name : Upload Trivy Image scan results
113
+ uses : actions/upload-artifact@v4.3.6
114
+ with :
115
+ name : trivy-image-scan-results
116
+ path : trivy-image-scan-results.sarif
117
+ retention-days : 30
118
+
119
+ - name : Upload Trivy scan results to GitHub Security tab
120
+ uses : github/codeql-action/upload-sarif@v3
121
+ with :
122
+ sarif_file : " trivy-image-scan-results.sarif"
0 commit comments