diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b2847f844..9648f0663 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -17,6 +17,7 @@ jobs: release: name: Release runs-on: + # For a list of pre-installed software, see https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md - ubuntu-22.04 steps: - uses: actions/checkout@v3 @@ -31,29 +32,22 @@ jobs: registry: ${{ env.registry }} username: ${{ env.registry_username }} password: ${{ env.registry_password }} - - name: Generate container image + - name: Build multi-arch container image, and push to container registry # Note: We set make variables using positional arguments (to the right of the make command), not environment # variables (to the left of the make command). While make converts environment variables to make variables, the # conversion is not straightforward. For example, conditional assignments are not overriden by environment # variables. - run: | - make generate-capvcd-image \ - REGISTRY=${{ env.registry }} \ - CAPVCD_IMG=${{ env.repository }} \ - VERSION=${{ env.version }} - - name: Push container image to container registry - # See note on make variables, above. run: | make push-capvcd-image \ + --makefile d2iq.Makefile \ REGISTRY=${{ env.registry }} \ CAPVCD_IMG=${{ env.repository }} \ VERSION=${{ env.version }} - name: Generate GitHub release artifacts # See note on make variables, above. - # - # We use our own Makefile to allow us to change the image in the manifest. run: | - make -f d2iq.Makefile release-manifests \ + make release-manifests \ + --makefile d2iq.Makefile REGISTRY=${{ env.registry }} \ CAPVCD_IMG=${{ env.repository }} \ VERSION=${{ env.version }} diff --git a/d2iq.Makefile b/d2iq.Makefile index 9e82fe6cb..5485db79d 100644 --- a/d2iq.Makefile +++ b/d2iq.Makefile @@ -1,5 +1,25 @@ include Makefile +PLATFORMS := "linux/amd64,linux/arm64" + +# The multi-platform build must push its output to a registry, because the Docker Engine image store does not support +# multi-platform images. This will be addressed when Docker Engine supports the containerd image store. See +# https://docs.docker.com/storage/containerd. +.PHONY: push-capvcd-image +push-capvcd-image: docker-buildx-builder generate fmt vet vendor + docker buildx build \ + --builder capvcd \ + --platform $(PLATFORMS) \ + --output=type=registry \ + --build-arg VERSION=$(VERSION) \ + --tag $(REGISTRY)/$(CAPVCD_IMG):$(VERSION) \ + --file Dockerfile \ + . + +.PHONY: docker-buildx-builder +docker-buildx-builder: + docker buildx inspect --bootstrap capvcd &>/dev/null || docker buildx create --name capvcd + # The upstream 'release-manifests' target does not correctly override the image. # We work around this by using `kustomize edit set image`. release-manifests: kustomize