fix more security issues #1
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 | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
push: | |
branches: | |
- main | |
jobs: | |
image: | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
contents: read | |
id-token: write | |
security-events: write | |
strategy: | |
matrix: | |
exclude: | |
- from: focal | |
release: zed | |
- from: focal | |
release: "2023.1" | |
- from: jammy | |
release: wallaby | |
- from: jammy | |
release: xena | |
from: | |
- focal | |
- jammy | |
release: | |
- wallaby | |
- xena | |
- yoga | |
- zed | |
- "2023.1" | |
steps: | |
- name: Install QEMU static binaries | |
uses: docker/setup-qemu-action@v2 | |
- name: Configure Buildkit | |
uses: docker/setup-buildx-action@v2 | |
- name: Checkout project | |
uses: actions/checkout@v3 | |
- name: Setup environment variables | |
run: |- | |
echo PROJECT_REF=$(cat manifest.yml | yq '."${{ matrix.release }}".sha') >> $GITHUB_ENV | |
echo BUILDER_IMAGE=quay.io/vexxhost/openstack-builder-${{ matrix.from }}:656cf9c3011618bebf822f996dfa54461b4088e9 >> $GITHUB_ENV | |
echo RUNTIME_IMAGE=quay.io/vexxhost/openstack-runtime-${{ matrix.from }}:501efbc97d293436af82a18076b4369380856532 >> $GITHUB_ENV | |
- name: Authenticate with Quay.io | |
uses: docker/login-action@v2 | |
if: ${{ github.event_name == 'push' }} | |
with: | |
password: ${{ secrets.QUAY_ROBOT_TOKEN }} | |
registry: quay.io | |
username: ${{ secrets.QUAY_USERNAME }} | |
- name: Install cosign | |
uses: sigstore/cosign-installer@main | |
- name: Verify images | |
run: |- | |
cosign verify --certificate-oidc-issuer=https://token.actions.githubusercontent.com --certificate-identity=https://github.com/vexxhost/docker-openstack-builder/.github/workflows/build.yml@refs/heads/main ${BUILDER_IMAGE} | |
cosign verify --certificate-oidc-issuer=https://token.actions.githubusercontent.com --certificate-identity=https://github.com/vexxhost/docker-openstack-runtime/.github/workflows/build.yml@refs/heads/main ${RUNTIME_IMAGE} | |
- name: Build image | |
uses: docker/build-push-action@v3 | |
id: push-step | |
with: | |
build-args: |- | |
BUILDER_IMAGE=${{ env.BUILDER_IMAGE }} | |
RUNTIME_IMAGE=${{ env.RUNTIME_IMAGE }} | |
RELEASE=${{ matrix.release }} | |
PROJECT=horizon | |
PROJECT_REPO=https://github.com/vexxhost/horizon | |
PROJECT_REF=${{ env.PROJECT_REF }} | |
EXTRAS= | |
PROFILES=apache | |
DIST_PACKAGES= | |
PIP_PACKAGES=cryptography python-binary-memcached git+https://github.com/openstack/designate-dashboard.git@stable/${{ matrix.release }} git+https://github.com/openstack/heat-dashboard.git@stable/${{ matrix.release }} git+https://github.com/openstack/ironic-ui.git@stable/${{ matrix.release }} git+https://github.com/vexxhost/magnum-ui.git@stable/${{ matrix.release }} git+https://github.com/openstack/neutron-vpnaas-dashboard.git@stable/${{ matrix.release }} git+https://github.com/openstack/octavia-dashboard.git@stable/${{ matrix.release }} git+https://github.com/openstack/senlin-dashboard.git@stable/${{ matrix.release }} git+https://github.com/openstack/monasca-ui.git@stable/${{ matrix.release }} git+https://github.com/openstack/manila-ui.git@stable/${{ matrix.release }} | |
cache-from: type=gha,scope=${{ matrix.from }}-${{ matrix.release }} | |
cache-to: type=gha,mode=max,scope=${{ matrix.from }}-${{ matrix.release }} | |
sbom: true | |
context: . | |
platforms: linux/amd64 | |
push: ${{ github.event_name == 'push' }} | |
tags: quay.io/vexxhost/horizon:${{ env.PROJECT_REF }}-${{ matrix.from }}-${{ github.sha }} | |
- name: Promote image | |
uses: akhilerm/[email protected] | |
if: github.event_name == 'push' && ((matrix.from == 'focal') || (matrix.from == 'jammy' && matrix.release != 'yoga')) | |
with: | |
dst: quay.io/vexxhost/horizon:${{ matrix.release }} | |
src: quay.io/vexxhost/horizon:${{ env.PROJECT_REF }}-${{ matrix.from }}-${{ github.sha }} | |
- name: Sign the container image | |
if: ${{ github.event_name == 'push' }} | |
run: cosign sign --yes quay.io/vexxhost/horizon@${{ steps.push-step.outputs.digest }} | |
- uses: aquasecurity/trivy-action@master | |
with: | |
image-ref: quay.io/vexxhost/horizon:${{ env.PROJECT_REF }}-${{ matrix.from }}-${{ github.sha }} | |
format: 'sarif' | |
output: 'trivy-results.sarif' | |
ignore-unfixed: true | |
- uses: github/codeql-action/upload-sarif@v2 | |
with: | |
category: ${{ env.PROJECT_REF }}-${{ matrix.from }} | |
sarif_file: 'trivy-results.sarif' |