|
| 1 | +name: cve-report |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: '0 17 * * *' |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} |
| 10 | + cancel-in-progress: true |
| 11 | + |
| 12 | +jobs: |
| 13 | + report: |
| 14 | + name: Report |
| 15 | + runs-on: ubuntu-24.04 |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Set up Go |
| 20 | + uses: actions/setup-go@v4 |
| 21 | + with: |
| 22 | + go-version: '1.23' |
| 23 | + |
| 24 | + - name: Prepare git |
| 25 | + env: |
| 26 | + GITHUB_USER: 1gtm |
| 27 | + GITHUB_TOKEN: ${{ secrets.LGTM_GITHUB_TOKEN }} |
| 28 | + run: | |
| 29 | + set -x |
| 30 | + git config --global user.name "1gtm" |
| 31 | + git config --global user.email "1gtm@appscode.com" |
| 32 | + git config --global \ |
| 33 | + url."https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com".insteadOf \ |
| 34 | + "https://github.com" |
| 35 | + # git remote set-url origin https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git |
| 36 | +
|
| 37 | + - name: Install trivy |
| 38 | + run: | |
| 39 | + # wget https://github.com/aquasecurity/trivy/releases/download/v0.18.3/trivy_0.18.3_Linux-64bit.deb |
| 40 | + # sudo dpkg -i trivy_0.18.3_Linux-64bit.deb |
| 41 | + sudo apt-get install -y --no-install-recommends wget apt-transport-https gnupg lsb-release |
| 42 | + wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | sudo apt-key add - |
| 43 | + echo deb https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main | sudo tee -a /etc/apt/sources.list.d/trivy.list |
| 44 | + sudo apt-get update |
| 45 | + sudo apt-get install -y --no-install-recommends trivy |
| 46 | +
|
| 47 | + - name: Install image packer |
| 48 | + run: | |
| 49 | + cd /tmp |
| 50 | + curl -fsSL -O https://github.com/kmodules/image-packer/releases/latest/download/image-packer-linux-amd64.tar.gz |
| 51 | + tar -xvf image-packer-linux-amd64.tar.gz |
| 52 | + chmod +x image-packer-linux-amd64 |
| 53 | + sudo mv image-packer-linux-amd64 /usr/local/bin/image-packer |
| 54 | +
|
| 55 | + - name: Generate report |
| 56 | + run: | |
| 57 | + image-packer generate-cve-report \ |
| 58 | + --output-dir=catalog \ |
| 59 | + --src=catalog/imagelist.yaml |
| 60 | + git add catalog/README.md || true |
| 61 | + git commit -s -a -m "Update cve report $(date --rfc-3339=date)" |
| 62 | +
|
| 63 | + - name: Create Pull Request |
| 64 | + uses: peter-evans/create-pull-request@v6 |
| 65 | + with: |
| 66 | + token: ${{ secrets.LGTM_GITHUB_TOKEN }} |
| 67 | + title: Update cve report |
| 68 | + branch: update-cve-report |
| 69 | + delete-branch: true |
| 70 | + add-paths: | |
| 71 | + catalog/README.md |
| 72 | + labels: | |
| 73 | + automerge |
0 commit comments