Skip to content

Commit

Permalink
ci: limit the platforms that are build
Browse files Browse the repository at this point in the history
Document the GitHub Environment variable `BUILD_PLATFORMS` that is now
used in the jobs that test building container-images.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
  • Loading branch information
nixpanic committed Jan 19, 2022
1 parent 11321a0 commit 29f243a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/build-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
name: Push bundle container image to quay.io
if: github.repository == 'csi-addons/kubernetes-csi-addons'
runs-on: ubuntu-latest
environment: ci
steps:
- name: Check out the repo
uses: actions/checkout@v2
Expand Down Expand Up @@ -42,6 +43,7 @@ jobs:
name: Push controller container image to quay.io
if: github.repository == 'csi-addons/kubernetes-csi-addons'
runs-on: ubuntu-latest
environment: ci
steps:
- name: Check out the repo
uses: actions/checkout@v2
Expand All @@ -64,14 +66,15 @@ jobs:
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7
platforms: ${{ secrets.BUILD_PLATFORMS }}
push: true
tags: quay.io/csiaddons/k8s-controller:latest

push_sidecar:
name: Push sidecar container image to quay.io
if: github.repository == 'csi-addons/kubernetes-csi-addons'
runs-on: ubuntu-latest
environment: ci
steps:
- name: Check out the repo
uses: actions/checkout@v2
Expand All @@ -94,6 +97,6 @@ jobs:
with:
context: .
file: build/Containerfile.sidecar
platforms: linux/amd64,linux/arm64,linux/arm/v7
platforms: ${{ secrets.BUILD_PLATFORMS }}
push: true
tags: quay.io/csiaddons/k8s-sidecar:latest
7 changes: 5 additions & 2 deletions .github/workflows/test-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
build_bundle:
name: build_bundle
runs-on: ubuntu-latest
environment: ci
steps:
- name: Check out the repo
uses: actions/checkout@v2
Expand All @@ -36,6 +37,7 @@ jobs:
build_controller:
name: build_controller
runs-on: ubuntu-latest
environment: ci
steps:
- name: Check out the repo
uses: actions/checkout@v2
Expand All @@ -51,13 +53,14 @@ jobs:
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7
platforms: ${{ secrets.BUILD_PLATFORMS }}
push: false
tags: quay.io/csiaddons/k8s-controller:latest

build_sidecar:
name: build_sidecar
runs-on: ubuntu-latest
environment: ci
steps:
- name: Check out the repo
uses: actions/checkout@v2
Expand All @@ -73,6 +76,6 @@ jobs:
with:
context: .
file: build/Containerfile.sidecar
platforms: linux/amd64,linux/arm64,linux/arm/v7
platforms: ${{ secrets.BUILD_PLATFORMS }}
push: false
tags: quay.io/csiaddons/k8s-sidecar:latest
27 changes: 27 additions & 0 deletions docs/ci.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Continuous Integration

## GitHub Workflows

The GitHub Workflows under [`.github/workflows/][workflows] contain jobs that
are started when Pull-Requests are created or updated. Some of the jobs can
build container-images for multiple architectures. Not everyone or all
environmens wants to run the build tests for all platforms. The workflows can
be configured to select platforms that the `docker/setup-buildx-action`
supports.

For this configuration, a new Environment should be created in the GitHub
Settings of the repository. The Environment is expected to be called `ci`, and
a single Secret ('normal' environment variables seem not possible) should be
added:

- `BUILD_PLATFORMS`: `linux/amd64,linux/arm64,linux/arm/v7`

Detailed steps on creating the GitHub Environment and adding a Secret can be
found in [the GitHub Documentation][gh_env_doc].

In case the `BUILD_PLATFORMS` environment variable is not set, the
`docker/setup-buildx-action` action defaults to the single architecture where
the workflow is run (usually `linux/amd64`).

[workflows]: .github/workflows/
[gh_env_doc]: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#environment-secrets

0 comments on commit 29f243a

Please sign in to comment.