Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github: Run Docker build on all PRs #1417

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions .github/workflows/build-images-release.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,43 @@
name: Image Release Build

# Any change in triggers needs to be reflected in the concurrency group.
on:
push:
branches:
- main
tags:
- v[0-9]+.[0-9]+.[0-9]+
- v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+
pull_request:
branches:
- main
- v*

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.after }}
cancel-in-progress: true

permissions: read-all

jobs:
determine-deployment:
if: ${{ github.repository == 'cilium/hubble' }}
name: Determine Deployment
runs-on: ubuntu-22.04
steps:
- name: Determine deployment environment
id: environment
# use 'release' deployment if the workflow was triggered on a pushed tag starting with "v"
run: |
echo "deployment=${{ (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) && 'release' || '' }}" >> $GITHUB_OUTPUT
outputs:
name: ${{ steps.environment.outputs.deployment }}

build-and-push:
if: ${{ github.repository == 'cilium/hubble' }}
environment: release
environment: ${{ needs.determine-deployment.outputs.name }}
runs-on: ubuntu-22.04
needs: determine-deployment
strategy:
# matrix for easier code-sharing with workflows from cilium/cilium
matrix:
Expand All @@ -25,6 +50,7 @@ jobs:
uses: docker/setup-buildx-action@0d103c3126aa41d772a8362f6aa67afac040f80c # v3.1.0

- name: Login to quay.io
if: ${{ needs.determine-deployment.outputs.name == 'release' }}
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: quay.io
Expand All @@ -47,7 +73,7 @@ jobs:
with:
context: .
file: ${{ matrix.dockerfile }}
push: true
push: ${{ needs.determine-deployment.outputs.name == 'release' }}
platforms: linux/amd64,linux/arm64
tags: |
quay.io/${{ github.repository_owner }}/${{ matrix.name }}:${{ steps.tag.outputs.tag }}
Expand Down
Loading