-
Notifications
You must be signed in to change notification settings - Fork 2
78 lines (65 loc) · 1.94 KB
/
golang-terratest.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
name: golang-terratest
run-name: Build golang-terratest
on:
pull_request:
paths:
- 'pipelines/dockerfiles/golang-terratest/**'
- .github/workflows/golang-terratest.yml
branches: [ master ]
push:
paths:
- 'pipelines/dockerfiles/golang-terratest/**'
- .github/workflows/golang-terratest.yml
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-22.04
permissions:
security-events: write
defaults:
run:
working-directory: pipelines/dockerfiles/golang-terratest
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Docker login
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
run: make login
- name: Docker build
run: make build
- name: Run trivy scan
uses: aquasecurity/[email protected]
with:
image-ref: 'constantin07/golang-terratest:1.0.0'
format: 'sarif'
output: 'trivy-results.sarif'
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
if: always()
with:
sarif_file: 'trivy-results.sarif'
- name: Docker publish
run: make publish
checkov:
runs-on: ubuntu-22.04
permissions:
security-events: write
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Run Checkov action
uses: bridgecrewio/checkov-action@master
with:
directory: pipelines/dockerfiles/golang-terratest
framework: dockerfile
skip_check: CKV_DOCKER_2
output_format: sarif
output_file_path: checkov-results.sarif
soft_fail: true
- name: Upload Checkov results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'checkov-results.sarif'