-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (54 loc) · 1.89 KB
/
push-trivy-db-mirrors.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
name: Push Trivy Database Mirrors
on:
push:
branches: [trunk]
paths: ['.github/workflows/push-trivy-db-mirrors.yml']
pull_request:
branches: [trunk]
paths: ['.github/workflows/push-trivy-db-mirrors.yml']
schedule:
# Run every 6 hours, which is when Trivy updates their database
- cron: '45 */6 * * *'
jobs:
push-trivy-db-mirror:
name: Push Trivy Database Mirror
runs-on: elvia-runner
permissions:
contents: read
packages: write
steps:
- name: Login to GHCR
run: |
echo "$GITHUB_TOKEN" | oras login ghcr.io -u "$GITHUB_USERNAME" --password-stdin
env:
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ github.token }}
- name: Pull Trivy Database
run: oras pull ghcr.io/aquasecurity/trivy-db:2
- name: Push Trivy Database Mirror
run: |
oras push \
--artifact-type application/vnd.aquasec.trivy.config.v1+json \
'ghcr.io/${{ github.repository_owner }}/trivy-db:2' \
db.tar.gz:application/vnd.aquasec.trivy.db.layer.v1.tar+gzip
push-trivy-java-db-mirror:
name: Push Trivy Java Database Mirror
runs-on: elvia-runner
permissions:
contents: read
packages: write
steps:
- name: Login to GHCR
run: |
echo "$GITHUB_TOKEN" | oras login ghcr.io -u "$GITHUB_USERNAME" --password-stdin
env:
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ github.token }}
- name: Pull Trivy Java Database
run: oras pull ghcr.io/aquasecurity/trivy-java-db:1
- name: Push Trivy Database Mirror
run: |
oras push \
--artifact-type application/vnd.aquasec.trivy.config.v1+json \
'ghcr.io/${{ github.repository_owner }}/trivy-java-db:1' \
javadb.tar.gz:application/vnd.aquasec.trivy.javadb.layer.v1.tar+gzip