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

ci: use GHA matrix to build two images #15

Merged
merged 1 commit into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
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
33 changes: 10 additions & 23 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ on:
jobs:
build-main:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- dockerfile: ./Dockerfile
image: starbops/kubebmc-controller
- dockerfile: ./Dockerfile.kbmc
image: starbops/kbmc
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
Expand All @@ -28,30 +31,14 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: |
starbops/kubebmc-controller
starbops/kbmc
- name: Test
run: make test
- name: Build
run: make build
- name: Docker build and push (controller)
uses: docker/build-push-action@v6
with:
provenance: false
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Docker build and push (kbmc)
images: ${{ matrix.image }}
- name: Docker build and push
uses: docker/build-push-action@v6
with:
provenance: false
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile.kbmc
file: ${{ matrix.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
29 changes: 12 additions & 17 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ on:
jobs:
build-pr:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- dockerfile: ./Dockerfile
image: starbops/kubebmc-controller
- dockerfile: ./Dockerfile.kbmc
image: starbops/kbmc
steps:
- name: Check out repository code
uses: actions/checkout@v4
Expand All @@ -24,30 +31,18 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: |
starbops/kubebmc-controller
starbops/kbmc
- name: Test
images: ${{ matrix.image }}
- name: Run tests
run: make test
- name: Build
- name: Build binaries
run: make build
- name: Docker build (controller)
- name: Docker build
uses: docker/build-push-action@v6
with:
provenance: false
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Docker build (kbmc)
uses: docker/build-push-action@v6
with:
provenance: false
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile.kbmc
file: ${{ matrix.dockerfile }}
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
33 changes: 10 additions & 23 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ on:
jobs:
build-tag:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- dockerfile: ./Dockerfile
image: starbops/kubebmc-controller
- dockerfile: ./Dockerfile.kbmc
image: starbops/kbmc
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
Expand All @@ -28,30 +31,14 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: |
starbops/kubebmc-controller
starbops/kbmc
- name: Test
run: make test
- name: Build
run: make build
- name: Docker build and push (controller)
uses: docker/build-push-action@v6
with:
provenance: false
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Docker build and push (kbmc)
images: ${{ matrix.image }}
- name: Docker build and push
uses: docker/build-push-action@v6
with:
provenance: false
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile.kbmc
file: ${{ matrix.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}