BC-6013 - update workflows for dev cluster by tenant #221
Workflow file for this run
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 and push Docker Image | ||
on: | ||
push: | ||
branches-ignore: | ||
- dependabot/** | ||
pull_request: | ||
types: [labeled] | ||
permissions: | ||
contents: read | ||
jobs: | ||
build_and_push: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Docker meta Service Name | ||
id: docker_meta_img | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ghcr.io/${{ github.repository }} | ||
tags: | | ||
type=ref,event=branch,enable=false,priority=600 | ||
type=sha,enable=true,priority=600,prefix= | ||
- name: Log into registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: test image exists | ||
run: | | ||
mkdir -p ~/.docker | ||
echo '{"experimental": "enabled"}' >> ~/.docker/config.json | ||
echo "IMAGE_EXISTS=$(docker manifest inspect ghcr.io/${{ github.repository }}:${{ github.sha }} > /dev/null && echo 1 || echo 0)" >> $GITHUB_ENV | ||
- name: Build and push ${{ github.repository }} | ||
if: ${{ env.IMAGE_EXISTS == 0 }} | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
platforms: linux/amd64 | ||
push: true | ||
tags: ghcr.io/${{ github.repository }}:${{ github.sha }} | ||
labels: ${{ steps.docker_meta_img.outputs.labels }} | ||
branch_meta: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
branch: ${{ steps.extract_branch_meta.outputs.branch }} | ||
sha: ${{ steps.extract_branch_meta.outputs.sha }} | ||
steps: | ||
- name: Extract branch meta | ||
shell: bash | ||
id: extract_branch_meta | ||
run: | | ||
if [ "${{ github.event_name }}" == 'pull_request' ]; then | ||
echo "branch=${{ github.event.pull_request.head.ref }}" >> $GITHUB_OUTPUT | ||
echo "sha=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT | ||
else | ||
echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT | ||
echo "sha=${{ github.sha }}" >> $GITHUB_OUTPUT | ||
fi | ||
deploy: | ||
needs: | ||
- build_and_push | ||
- branch_meta | ||
uses: hpi-schul-cloud/dof_app_deploy/.github/workflows/deploy.yml@main | ||
Check failure on line 76 in .github/workflows/push.yml GitHub Actions / Build and push Docker ImageInvalid workflow file
|
||
with: | ||
branch: ${{ needs.branch_meta.outputs.branch }} | ||
secrets: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
DEV_VAULT_BRB: ${{ secrets.DEV_VAULT_BRB }} | ||
DEV_VAULT_NBC: ${{ secrets.DEV_VAULT_NBC }} | ||
DEV_VAULT_THR: ${{ secrets.DEV_VAULT_THR }} | ||
DEV_VAULT_DBC: ${{ secrets.DEV_VAULT_DBC }} | ||
DEV_KUBE_CONFIG_BRB: ${{ secrets.DEV_KUBE_CONFIG_BRB }} | ||
DEV_KUBE_CONFIG_NBC: ${{ secrets.DEV_KUBE_CONFIG_NBC }} | ||
DEV_KUBE_CONFIG_THR: ${{ secrets.DEV_KUBE_CONFIG_THR }} | ||
DEV_KUBE_CONFIG_DBC: ${{ secrets.DEV_KUBE_CONFIG_DBC }} | ||
BINGO_REPO_TOKEN: ${{ secrets.BINGO_REPO_TOKEN }} | ||
deploy-successful: | ||
needs: | ||
- deploy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: echo "deploy was successful" | ||
trivy-vulnerability-scanning: | ||
needs: | ||
- build_and_push | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: run trivy vulnerability scanner | ||
uses: aquasecurity/trivy-action@7b7aa264d83dc58691451798b4d117d53d21edfe | ||
with: | ||
image-ref: 'ghcr.io/${{ github.repository }}:${{ github.sha }}' | ||
format: 'sarif' | ||
output: 'trivy-results.sarif' | ||
severity: 'CRITICAL,HIGH' | ||
exit-code: 1 | ||
ignore-unfixed: true | ||
- name: upload trivy results | ||
if: ${{ always() }} | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
sarif_file: 'trivy-results.sarif' |