Skip to content

Commit 23bcfe1

Browse files
feeblefakieymorimo
andauthored
Backport to branch(3.10) : Use reusable vulnerability check workflow (#2298)
Co-authored-by: Yusuke <[email protected]>
1 parent f05cfcc commit 23bcfe1

File tree

2 files changed

+11
-103
lines changed

2 files changed

+11
-103
lines changed

.github/workflows/manual-vuln-check.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,3 @@ jobs:
1212
target-ref: ${{ github.ref_name }}
1313
secrets:
1414
CR_PAT: ${{ secrets.CR_PAT }}
15-
SLACK_SECURITY_WEBHOOK_URL: ${{ secrets.SLACK_SECURITY_WEBHOOK_URL }}
16-

.github/workflows/vuln-check.yaml

+11-101
Original file line numberDiff line numberDiff line change
@@ -12,106 +12,16 @@ on:
1212
CR_PAT:
1313
required: true
1414
SLACK_SECURITY_WEBHOOK_URL:
15-
required: true
15+
required: false
1616

17-
env:
18-
TERM: dumb
1917
jobs:
20-
docker:
21-
runs-on: ubuntu-latest
22-
23-
steps:
24-
- uses: actions/checkout@v4
25-
with:
26-
ref: ${{ inputs.target-ref }}
27-
28-
- name: Set up JDK 8
29-
uses: actions/setup-java@v4
30-
with:
31-
java-version: '8'
32-
distribution: 'temurin'
33-
34-
- name: Login to GitHub Container Registry
35-
if: always()
36-
uses: docker/login-action@v3
37-
with:
38-
registry: ghcr.io
39-
username: ${{ github.repository_owner }}
40-
password: ${{ secrets.CR_PAT }}
41-
42-
- name: Setup Gradle
43-
uses: gradle/actions/setup-gradle@v4
44-
45-
- name: Docker build
46-
if: always()
47-
run: ./gradlew docker
48-
49-
- name: Set version
50-
if: always()
51-
id: version
52-
run: |
53-
VERSION=$(./gradlew :core:properties -q | grep "version:" | awk '{print $2}')
54-
echo "version=${VERSION}" >> $GITHUB_OUTPUT
55-
56-
- name: Run Trivy vulnerability scanner for ScalarDB Server
57-
if: always()
58-
uses: aquasecurity/trivy-action@master
59-
with:
60-
image-ref: ghcr.io/scalar-labs/scalardb-server:${{ steps.version.outputs.version }}
61-
format: 'table'
62-
exit-code: '1'
63-
ignore-unfixed: true
64-
severity: 'CRITICAL,HIGH'
65-
timeout: '60m'
66-
67-
- name: Post Trivy vulnerability check failure for ScalarDB Server to Slack
68-
if: failure()
69-
uses: slackapi/[email protected]
70-
with:
71-
payload: |
72-
{
73-
"blocks": [
74-
{
75-
"type": "section",
76-
"text": {
77-
"type": "mrkdwn",
78-
"text": ":octagonal_sign: The vulnerability check for ScalarDB Server on `${{ github.repository }}` <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|failed> with `${{ inputs.target-ref }}`"
79-
}
80-
}
81-
]
82-
}
83-
env:
84-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_SECURITY_WEBHOOK_URL }}
85-
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
86-
87-
- name: Run Trivy vulnerability scanner for ScalarDB Schema Loader
88-
if: always()
89-
uses: aquasecurity/trivy-action@master
90-
with:
91-
image-ref: ghcr.io/scalar-labs/scalardb-schema-loader:${{ steps.version.outputs.version }}
92-
format: 'table'
93-
exit-code: '1'
94-
ignore-unfixed: true
95-
severity: 'CRITICAL,HIGH'
96-
timeout: '60m'
97-
98-
- name: Post Trivy vulnerability check failure for ScalarDB Schema Loader to Slack
99-
if: failure()
100-
uses: slackapi/[email protected]
101-
with:
102-
payload: |
103-
{
104-
"blocks": [
105-
{
106-
"type": "section",
107-
"text": {
108-
"type": "mrkdwn",
109-
"text": ":octagonal_sign: The vulnerability check for ScalarDB Schema Loader on `${{ github.repository }}` <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|failed> with `${{ inputs.target-ref }}`"
110-
}
111-
}
112-
]
113-
}
114-
env:
115-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_SECURITY_WEBHOOK_URL }}
116-
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
117-
18+
call-vuln-check:
19+
uses: scalar-labs/actions/.github/workflows/vuln-check-reusable.yaml@main
20+
with:
21+
target-ref: ${{ inputs.target-ref }}
22+
find-latest-release: ${{ inputs.find-latest-release }}
23+
images: '[["ScalarDB Schema Loader", "scalardb-schema-loader"]]'
24+
version-command: "./gradlew :core:properties -q | grep version: | awk '{print $2}'"
25+
secrets:
26+
CR_PAT: ${{ secrets.CR_PAT }}
27+
SLACK_SECURITY_WEBHOOK_URL: ${{ secrets.SLACK_SECURITY_WEBHOOK_URL }}

0 commit comments

Comments
 (0)