Build & Push Core #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & Push Core | |
on: | |
workflow_run: | |
workflows: "Create CORE-Release" | |
branches: main | |
types: completed | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
generate_matrix: | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }} | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v3 | |
- id: set-matrix | |
run: | | |
CONTENT=$(jq -r 'tostring' 05-matrix/github_action_matrix_all.json) | |
echo "matrix=${CONTENT}" >>$GITHUB_OUTPUT | |
build-core: | |
runs-on: ubuntu-latest | |
needs: generate_matrix | |
strategy: | |
fail-fast: false | |
matrix: ${{fromJson(needs.generate_matrix.outputs.matrix)}} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and push Docker images | |
run: | | |
BAKE_JSON=04-bakefiles/${{ matrix.r_version }}.docker-bake.json | |
for itarget in $(jq '.group[].${{ matrix.group }}[].targets[]' -r ${BAKE_JSON}); do | |
docker buildx bake \ | |
--file ${BAKE_JSON} \ | |
--set=*.labels.org.opencontainers.image.revision=${GITHUB_SHA} \ | |
--push ${itarget}; | |
done | |
check-core: | |
runs-on: ubuntu-latest | |
if: ${{ false }} | |
needs: | |
- generate_matrix | |
- build-core | |
strategy: | |
fail-fast: false | |
matrix: | |
image-ref: [r-ver] | |
tags: ${{fromJson(needs.generate_matrix.outputs.matrix)}} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@master | |
with: | |
image-ref: 'docker.io/umr1283/${{ matrix.image-ref }}:${{ matrix.tags.r_version }}' | |
output: '06-trivy/trivy-${{ matrix.image-ref }}-${{ matrix.tags.r_version }}.txt' | |
format: 'table' | |
vuln-type: 'os,library' | |
severity: 'CRITICAL,HIGH' | |
pr-core: | |
runs-on: ubuntu-latest | |
needs: check-core | |
strategy: | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Create Pull Request | |
id: cpr | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
commit-message: Automatic Trivy checks | |
signoff: false | |
branch: auto-detected-updates | |
delete-branch: true | |
title: "Automatic Trivy checks" | |
committer: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
- name: Check outputs | |
run: | | |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" | |
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" |