Skip to content

Commit

Permalink
cleam things up with a array of arches
Browse files Browse the repository at this point in the history
  • Loading branch information
rmb938 committed Apr 28, 2020
1 parent 514f3fe commit 76d6b31
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 33 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ IMG_NAMESPACE?=cloudnativelabs
GIT_COMMIT=$(shell git describe --tags --dirty)
GIT_BRANCH?=$(shell git rev-parse --abbrev-ref HEAD)
IMG_TAG?=$(if $(IMG_TAG_PREFIX),$(IMG_TAG_PREFIX)-)$(if $(ARCH_TAG_PREFIX),$(ARCH_TAG_PREFIX)-)$(GIT_BRANCH)
MANIFEST_TAG=$(if $(IMG_TAG_PREFIX),$(IMG_TAG_PREFIX)-)$(GIT_BRANCH)
MANIFEST_TAG?=$(if $(IMG_TAG_PREFIX),$(IMG_TAG_PREFIX)-)$(GIT_BRANCH)
RELEASE_TAG?=$(GOARCH)-$(shell build/get-git-tag.sh)
REGISTRY?=$(if $(IMG_FQDN),$(IMG_FQDN)/$(IMG_NAMESPACE)/$(NAME),$(IMG_NAMESPACE)/$(NAME))
REGISTRY_DEV?=$(REGISTRY)$(DEV_SUFFIX)
Expand Down Expand Up @@ -131,7 +131,7 @@ push-manifest:
@echo Starting kube-router manifest push.
./manifest-tool push from-args \
--platforms linux/amd64,linux/arm64,linux/arm,linux/s390x,linux/ppc64le \
--template "$(REGISTRY_DEV):ARCH-$(IMG_TAG)" \
--template "$(REGISTRY_DEV):ARCH-$(MANIFEST_TAG)" \
--target "$(REGISTRY_DEV):$(MANIFEST_TAG)"

push-release: push
Expand Down
49 changes: 18 additions & 31 deletions build/travis-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
set -o errexit
set -o pipefail

GOARCHES=(amd64 arm64 arm s390x ppc64le)

# Pull Request image tag format: PR00
if [ "${TRAVIS_EVENT_TYPE}" = "pull_request" ]; then
PR_USER=$(echo "$TRAVIS_PULL_REQUEST_SLUG" | sed -e 's/\/.*//')
Expand All @@ -10,48 +12,33 @@ if [ "${TRAVIS_EVENT_TYPE}" = "pull_request" ]; then
exit 0
fi
echo "Building/pushing PR$TRAVIS_PULL_REQUEST from $PR_USER"
make push IMG_TAG="PR$TRAVIS_PULL_REQUEST" GOARCH=amd64
make clean IMG_TAG="PR$TRAVIS_PULL_REQUEST" GOARCH=amd64
make push IMG_TAG="PR$TRAVIS_PULL_REQUEST" GOARCH=arm64
make clean IMG_TAG="PR$TRAVIS_PULL_REQUEST" GOARCH=arm64
make push IMG_TAG="PR$TRAVIS_PULL_REQUEST" GOARCH=arm
make clean IMG_TAG="PR$TRAVIS_PULL_REQUEST" GOARCH=arm
make push IMG_TAG="PR$TRAVIS_PULL_REQUEST" GOARCH=s390x
make clean IMG_TAG="PR$TRAVIS_PULL_REQUEST" GOARCH=s390x
make push IMG_TAG="PR$TRAVIS_PULL_REQUEST" GOARCH=ppc64le
make clean IMG_TAG="PR$TRAVIS_PULL_REQUEST" GOARCH=ppc64le
for GOARCH in ${GOARCHES[@]}; do
make push IMG_TAG="$GOARCH-PR$TRAVIS_PULL_REQUEST" GOARCH=amd64
make clean IMG_TAG="$GOARCH-PR$TRAVIS_PULL_REQUEST" GOARCH=amd64
done
echo "Pushing PR manifest on Travis"
make push-manifest MANIFEST_TAG="$PR$TRAVIS_PULL_REQUEST"
exit 0
fi

# Release image tag format: v0.0.0 and latest
if [ -n "$TRAVIS_TAG" ]; then
echo "Running Release build on Travis"
make push-release RELEASE_TAG="amd64-$TRAVIS_TAG" GOARCH=amd64
make clean RELEASE_TAG="amd64-$TRAVIS_TAG" GOARCH=amd64
make push-release RELEASE_TAG="arm64-$TRAVIS_TAG" GOARCH=arm64
make clean RELEASE_TAG="arm64-$TRAVIS_TAG" GOARCH=arm64
make push-release RELEASE_TAG="arm-$TRAVIS_TAG" GOARCH=arm
make clean RELEASE_TAG="arm-$TRAVIS_TAG" GOARCH=arm
make push-release RELEASE_TAG="s390x-$TRAVIS_TAG" GOARCH=s390x
make clean RELEASE_TAG="s390x-$TRAVIS_TAG" GOARCH=s390x
make push-release RELEASE_TAG="ppc64le-$TRAVIS_TAG" GOARCH=ppc64le
make clean RELEASE_TAG="ppc64le-$TRAVIS_TAG" GOARCH=ppc64le
echo "Pushing manifest on Travis"
for GOARCH in ${GOARCHES[@]}; do
make push-release RELEASE_TAG="$GOARCH-$TRAVIS_TAG" GOARCH=$GOARCH
make clean RELEASE_TAG="$GOARCH-$TRAVIS_TAG" GOARCH=$GOARCH
done
echo "Pushing release manifest on Travis"
make push-manifest-release RELEASE_TAG="$TRAVIS_TAG"
exit 0
fi

# Push image tag format: COMMIT
echo "Running push build on Travis"
make push GOARCH=amd64
make clean GOARCH=amd64
make push GOARCH=arm64
make clean GOARCH=arm64
make push GOARCH=arm
make clean GOARCH=arm
make push GOARCH=s390x
make clean GOARCH=s390x
make push GOARCH=ppc64le
make clean GOARCH=ppc64le
for GOARCH in ${GOARCHES[@]}; do
make push GOARCH=$GOARCH
make clean GOARCH=$GOARCH
done
echo "Pushing manifest on Travis"
make push-manifest

0 comments on commit 76d6b31

Please sign in to comment.