Skip to content

Commit 4be51ba

Browse files
wilmardomurali-reddy
authored andcommitted
First stab at pushing multiarch releases (#735)
1 parent d6a93d4 commit 4be51ba

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ go:
66
- 1.10.8
77

88
branches:
9-
only:
9+
only:
1010
- master
1111
- /^bzub-.*$/
1212
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
@@ -22,6 +22,7 @@ script:
2222
- build/travis-test.sh
2323
# All successfully built commits get an image placed in the kube-router-git
2424
# image repo and tagged with the commit hash.
25+
- wget https://github.com/estesp/manifest-tool/releases/download/v1.0.0-rc2/manifest-tool-linux-amd64 -O manifest-tool && chmod +x manifest-tool
2526
- build/travis-deploy.sh
2627

2728
# This fixes issues when a contributor uses their own Travis CI account to test

Makefile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ IMG_NAMESPACE?=cloudnativelabs
88
GIT_COMMIT=$(shell git describe --tags --dirty)
99
GIT_BRANCH?=$(shell git rev-parse --abbrev-ref HEAD)
1010
IMG_TAG?=$(if $(IMG_TAG_PREFIX),$(IMG_TAG_PREFIX)-)$(if $(ARCH_TAG_PREFIX),$(ARCH_TAG_PREFIX)-)$(GIT_BRANCH)
11-
RELEASE_TAG?=$(shell build/get-git-tag.sh)
11+
RELEASE_TAG?=$(GOARCH)-$(shell build/get-git-tag.sh)
1212
REGISTRY?=$(if $(IMG_FQDN),$(IMG_FQDN)/$(IMG_NAMESPACE)/$(NAME),$(IMG_NAMESPACE)/$(NAME))
1313
REGISTRY_DEV?=$(REGISTRY)$(DEV_SUFFIX)
1414
IN_DOCKER_GROUP=$(filter docker,$(shell groups))
@@ -31,6 +31,7 @@ ARCH_TAG_PREFIX=$(GOARCH)
3131
FILE_ARCH=IBM S/390
3232
DOCKERFILE_SED_EXPR?=
3333
else
34+
ARCH_TAG_PREFIX=amd64
3435
DOCKERFILE_SED_EXPR?=
3536
FILE_ARCH=x86-64
3637
endif
@@ -120,10 +121,21 @@ push-release: push
120121
@echo Starting kube-router release container image push.
121122
@test -n "$(RELEASE_TAG)"
122123
$(DOCKER) tag "$(REGISTRY_DEV):$(IMG_TAG)" "$(REGISTRY):$(RELEASE_TAG)"
123-
$(DOCKER) tag "$(REGISTRY):$(RELEASE_TAG)" "$(REGISTRY):latest"
124124
$(DOCKER) push "$(REGISTRY)"
125125
@echo Finished kube-router release container image push.
126126

127+
push-manifest:
128+
@echo Starting kube-router manifest push.
129+
./manifest-tool push from-args \
130+
--platforms linux/amd64,linux/arm64,linux/arm,linux/s390x \
131+
--template "$(REGISTRY):ARCH-${RELEASE_TAG}" \
132+
--target "$(REGISTRY):$(RELEASE_TAG)"
133+
134+
./manifest-tool push from-args \
135+
--platforms linux/amd64,linux/arm64,linux/arm,linux/s390x \
136+
--template "$(REGISTRY):ARCH-${RELEASE_TAG}" \
137+
--target "$(REGISTRY):latest"
138+
127139
github-release:
128140
@echo Starting kube-router GitHub release creation.
129141
@[ -n "$(value GITHUB_TOKEN)" ] && \

build/travis-deploy.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,23 @@ if [ "${TRAVIS_EVENT_TYPE}" = "pull_request" ]; then
1010
exit 0
1111
fi
1212
echo "Building/pushing PR$TRAVIS_PULL_REQUEST from $PR_USER"
13-
make push IMG_TAG="PR$TRAVIS_PULL_REQUEST"
13+
make push IMG_TAG="PR$TRAVIS_PULL_REQUEST" GOARCH=amd64
14+
make push IMG_TAG="PR$TRAVIS_PULL_REQUEST" GOARCH=arm64
15+
make push IMG_TAG="PR$TRAVIS_PULL_REQUEST" GOARCH=arm
16+
make push IMG_TAG="PR$TRAVIS_PULL_REQUEST" GOARCH=s390x
1417
exit 0
1518
fi
1619

1720
# Release image tag format: v0.0.0 and latest
1821
if [ -n "$TRAVIS_TAG" ]; then
1922
echo "Running Release build on Travis"
20-
make push-release RELEASE_TAG="$TRAVIS_TAG"
23+
make push-release RELEASE_TAG="amd64-$TRAVIS_TAG" GOARCH=amd64
24+
make push-release RELEASE_TAG="arm64-$TRAVIS_TAG" GOARCH=arm64
25+
make push-release RELEASE_TAG="arm-$TRAVIS_TAG" GOARCH=arm
26+
make push-release RELEASE_TAG="s390x-$TRAVIS_TAG" GOARCH=s390x
27+
28+
echo "Pushing manifest on Travis"
29+
make push-manifest RELEASE_TAG="$TRAVIS_TAG"
2130
exit 0
2231
fi
2332

0 commit comments

Comments
 (0)