Add CI for multi-arch builds (#36)
This commit is contained in:
Родитель
f7f987e0a4
Коммит
33e2999b2b
|
@ -63,7 +63,7 @@ jobs:
|
||||||
- name: 'Run Azure CLI commands'
|
- name: 'Run Azure CLI commands'
|
||||||
run: |
|
run: |
|
||||||
az acr login -n ${{ secrets.AZURE_REGISTRY_SERVER }}
|
az acr login -n ${{ secrets.AZURE_REGISTRY_SERVER }}
|
||||||
REGISTRY=${{ secrets.AZURE_REGISTRY_SERVER }}/public/aks VERSION=v${{ steps.changelog_reader.outputs.version }} make push
|
REGISTRY=${{ secrets.AZURE_REGISTRY_SERVER }}/public/aks VERSION=v${{ steps.changelog_reader.outputs.version }} make all-manifest
|
||||||
echo "ACR push done"
|
echo "ACR push done"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
## [0.1.2]
|
## [0.1.2]
|
||||||
|
|
||||||
* Update usage examples, README, and CHANGELOG formatting
|
* Update usage examples, README, and CHANGELOG formatting
|
||||||
|
* Add CI for multi-arch builds
|
||||||
|
|
||||||
## [0.1.1]
|
## [0.1.1]
|
||||||
|
|
||||||
|
|
23
Makefile
23
Makefile
|
@ -63,8 +63,11 @@ endif
|
||||||
ifeq ($(ARCH),ppc64le)
|
ifeq ($(ARCH),ppc64le)
|
||||||
BASEIMAGE?=k8s.gcr.io/build-image/debian-iptables-ppc64le:buster-v1.7.0
|
BASEIMAGE?=k8s.gcr.io/build-image/debian-iptables-ppc64le:buster-v1.7.0
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(ARCH),s390x)
|
||||||
|
BASEIMAGE?=k8s.gcr.io/build-image/debian-iptables-s390x:buster-v1.7.0
|
||||||
|
endif
|
||||||
|
|
||||||
TAG := $(VERSION)
|
TAG := $(VERSION)__$(OS)_$(ARCH)
|
||||||
|
|
||||||
BUILD_IMAGE ?= golang:1.17-alpine
|
BUILD_IMAGE ?= golang:1.17-alpine
|
||||||
|
|
||||||
|
@ -103,6 +106,12 @@ push-%:
|
||||||
GOOS=$(firstword $(subst _, ,$*)) \
|
GOOS=$(firstword $(subst _, ,$*)) \
|
||||||
GOARCH=$(lastword $(subst _, ,$*))
|
GOARCH=$(lastword $(subst _, ,$*))
|
||||||
|
|
||||||
|
manifest-%:
|
||||||
|
@$(MAKE) manifest \
|
||||||
|
--no-print-directory \
|
||||||
|
GOOS=$(firstword $(subst _, ,$*)) \
|
||||||
|
GOARCH=$(lastword $(subst _, ,$*))
|
||||||
|
|
||||||
all-build: # @HELP builds binaries for all platforms
|
all-build: # @HELP builds binaries for all platforms
|
||||||
all-build: $(addprefix build-, $(subst /,_, $(ALL_PLATFORMS)))
|
all-build: $(addprefix build-, $(subst /,_, $(ALL_PLATFORMS)))
|
||||||
|
|
||||||
|
@ -112,6 +121,9 @@ all-container: $(addprefix container-, $(subst /,_, $(ALL_PLATFORMS)))
|
||||||
all-push: # @HELP pushes containers for all platforms to the defined registry
|
all-push: # @HELP pushes containers for all platforms to the defined registry
|
||||||
all-push: $(addprefix push-, $(subst /,_, $(ALL_PLATFORMS)))
|
all-push: $(addprefix push-, $(subst /,_, $(ALL_PLATFORMS)))
|
||||||
|
|
||||||
|
all-manifest: # @HELP creates a docker manifest for all platforms (for multi-arch)
|
||||||
|
all-manifest: $(addprefix manifest-, $(subst /,_, $(ALL_PLATFORMS)))
|
||||||
|
|
||||||
# The following structure defeats Go's (intentional) behavior to always touch
|
# The following structure defeats Go's (intentional) behavior to always touch
|
||||||
# result files, even if they have not changed. This will still run `go` but
|
# result files, even if they have not changed. This will still run `go` but
|
||||||
# will not trigger further work if nothing has actually changed.
|
# will not trigger further work if nothing has actually changed.
|
||||||
|
@ -242,6 +254,15 @@ push: container
|
||||||
done
|
done
|
||||||
@echo
|
@echo
|
||||||
|
|
||||||
|
manifest: # @HELP updates and pushes a manifest tag, which can contain multiple ($OS/$ARCH)
|
||||||
|
manifest: push
|
||||||
|
@for bin in $(BINS); do \
|
||||||
|
docker manifest create $(REGISTRY)/$$bin:$(VERSION) \
|
||||||
|
--amend "$(REGISTRY)/$$bin:$(TAG)"; \
|
||||||
|
docker manifest push $(REGISTRY)/$$bin:$(VERSION); \
|
||||||
|
done
|
||||||
|
@echo
|
||||||
|
|
||||||
version: # @HELP outputs the version string
|
version: # @HELP outputs the version string
|
||||||
version:
|
version:
|
||||||
@echo $(VERSION)
|
@echo $(VERSION)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче