-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (86 loc) · 2.6 KB
/
commit-stage.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
79
80
81
82
83
84
85
86
87
88
89
name: Commit Stage
on: push
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: gradle
- name: Code vulnerability scanning
uses: anchore/scan-action@v3
id: scan
with:
path: "${{ github.worspace }}"
fail-build: false
severity-cutoff: high
acs-report-enable: true
- name: Upload vulnerability report
uses: github/codeql-action/upload-sarif@v3
if: success() || failure()
with:
sarif_file: "${{ steps.scan.outputs.sarif }}"
- name: Build, unit tests and integration tests
run: |
chmod +x gradlew
./gradlew build
- name: Validate Kubernetes manifests
uses: stefanprodan/kube-tools@v1
with:
kubectl: 1.28.3
kubeval: 0.16.1
command: |
kubeval --strict -d mall-catalog/k8s
package:
name: Package and Publish
if: ${{ github.ref == 'refs/heads/main' }}
needs: [ build ]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
security-events: write
steps:
- name: checkout source code
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: gradle
- name: Build container image
run: |
chmod +x gradlew
./gradlew :mall-catalog:bootBuildImage \
--imageName ghcr.io/${{ github.actor }}/catalog-service:latest
- name: OCI image vulnerability scanning
uses: anchore/scan-action@v3
id: scan
with:
image: ghcr.io/${{ github.actor }}/catalog-service:latest
fail-build: false
severity-cutoff: high
acs-report-enable: true
- name: Upload vulnerability report
uses: github/codeql-action/upload-sarif@v3
if: success() || failure()
with:
sarif_file: "${{ steps.scan.outputs.sarif }}"
# - name: Log into container registry
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Publish container image
# run: docker push ghcr.io/${{ github.actor }}/catalog-service:latest