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: limit the platforms that are build #89

Merged
merged 2 commits into from
Jan 19, 2022
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
4 changes: 2 additions & 2 deletions .github/workflows/build-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ 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

Expand Down Expand Up @@ -94,6 +94,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
5 changes: 2 additions & 3 deletions .github/workflows/test-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:
jobs:
build_bundle:
name: build_bundle
if: github.repository == 'csi-addons/kubernetes-csi-addons'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we remove this won't these builds run on the fork repos?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other build_* tests do not have this line. Without any configuration, forks get a single-platform build test.

runs-on: ubuntu-latest
steps:
- name: Check out the repo
Expand Down Expand Up @@ -52,7 +51,7 @@ 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

Expand All @@ -74,6 +73,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
28 changes: 28 additions & 0 deletions docs/ci.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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 Secret should be created in the GitHub
Settings of the repository. 'Normal' environment variables seem not possible.

An example of the GitHub Secret that will build the container-images on AMD64,
and both 32-bit and 64-bit Arm platforms:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arm to ARM ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://www.arm.com/ uses Arm (I think that the new capitalization was introduced with some rebranding a while ago)


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

Detailed steps on creating the GitHub Secret can be found in [the GitHub
Documentation][gh_doc_secret].

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_doc_secret]: https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository