Skip to content

Commit 014b374

Browse files
committed
Enable multiarch builds
1 parent faeed1a commit 014b374

File tree

3 files changed

+79
-3
lines changed

3 files changed

+79
-3
lines changed

.travis.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
os: linux
2+
services: docker
3+
dist: focal
4+
language: go
5+
go: stable
6+
7+
env:
8+
global:
9+
- IMAGE1: quay.io/konveyor/velero
10+
- IMAGE2: quay.io/konveyor/velero-restic-restore-helper
11+
- DEFAULT_BRANCH: konveyor-dev
12+
- DOCKERFILE1: Dockerfile.ubi
13+
- DOCKERFILE2: Dockerfile-velero-restic-restore-helper.ubi
14+
- DOCKER_CLI_EXPERIMENTAL: enabled
15+
- GOPROXY: https://goproxy.io,direct
16+
17+
before_install:
18+
- |
19+
if [ "${TRAVIS_BRANCH}" == "${DEFAULT_BRANCH}" ]; then
20+
export TAG=latest
21+
else
22+
export TAG="${TRAVIS_BRANCH}"
23+
fi
24+
25+
# Builds routinely fail due to download failures inside alternate arch docker containers
26+
# Here we are downloading outside the docker container and copying the deps in
27+
# Also use -v for downloads/builds to stop no output failures from lxd env buffering.
28+
before_script:
29+
- go mod vendor -v
30+
- git clone https://github.com/konveyor/restic -b konveyor-dev
31+
- pushd restic; go mod vendor -v; popd
32+
- sed -i 's|-mod=mod|-mod=vendor|g' ${DOCKERFILE1}
33+
- sed -i 's|-mod=mod|-mod=vendor|g' ${DOCKERFILE2}
34+
- sed -i 's|go build|go build -v|g' ${DOCKERFILE1}
35+
- sed -i 's|go build|go build -v|g' ${DOCKERFILE2}
36+
- sed -i 's|^RUN mkdir -p \$APP_ROOT/src/github.com/restic \\$|COPY --chown=1001 restic/ $APP_ROOT/src/github.com/restic/restic|g' ${DOCKERFILE1}
37+
- sed -i 's|&& cd \$APP_ROOT/src/github.com/restic \\$||g' ${DOCKERFILE1}
38+
- sed -i 's|&& git clone https://github.com/konveyor/restic -b konveyor-dev$||g' ${DOCKERFILE1}
39+
40+
script:
41+
- docker build -t ${IMAGE1}:${TAG}-${TRAVIS_ARCH} -f ${DOCKERFILE1} .
42+
- docker build -t ${IMAGE2}:${TAG}-${TRAVIS_ARCH} -f ${DOCKERFILE2} .
43+
- if [ -n "${QUAY_ROBOT}" ]; then docker login quay.io -u "${QUAY_ROBOT}" -p ${QUAY_TOKEN}; fi
44+
- if [ -n "${QUAY_ROBOT}" ]; then docker push ${IMAGE1}:${TAG}-${TRAVIS_ARCH}; fi
45+
- if [ -n "${QUAY_ROBOT}" ]; then docker push ${IMAGE2}:${TAG}-${TRAVIS_ARCH}; fi
46+
47+
jobs:
48+
include:
49+
- stage: build images
50+
arch: ppc64le
51+
- arch: s390x
52+
- arch: arm64
53+
- arch: amd64
54+
- stage: push manifest
55+
language: shell
56+
arch: amd64
57+
before_script: []
58+
script:
59+
- |
60+
if [ -n "${QUAY_ROBOT}" ]; then
61+
docker login quay.io -u "${QUAY_ROBOT}" -p ${QUAY_TOKEN}
62+
docker manifest create \
63+
${IMAGE1}:${TAG} \
64+
${IMAGE1}:${TAG}-x86_64 \
65+
${IMAGE1}:${TAG}-ppc64le \
66+
${IMAGE1}:${TAG}-s390x \
67+
${IMAGE1}:${TAG}-aarch64
68+
docker manifest create \
69+
${IMAGE2}:${TAG} \
70+
${IMAGE2}:${TAG}-amd64 \
71+
${IMAGE2}:${TAG}-ppc64le \
72+
${IMAGE2}:${TAG}-s390x \
73+
${IMAGE2}:${TAG}-aarch64
74+
docker manifest push ${IMAGE1}:${TAG}
75+
docker manifest push ${IMAGE2}:${TAG}
76+
fi

Dockerfile-velero-restic-restore-helper.ubi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM registry.access.redhat.com/ubi8/go-toolset:1.14.7 AS builder
1+
FROM quay.io/konveyor/builder:latest AS builder
22
ENV GOPATH=$APP_ROOT
33
COPY . $APP_ROOT/src/github.com/vmware-tanzu/velero
44
WORKDIR $APP_ROOT/src/github.com/vmware-tanzu/velero

Dockerfile.ubi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# TODO! Find a real ubi8 image for golang 1.16
2-
FROM quay.io/app-sre/boilerplate:image-v2.1.0 AS builder
2+
FROM quay.io/konveyor/builder:latest AS builder
33
ENV GOPATH=$APP_ROOT
44
COPY . /go/src/github.com/vmware-tanzu/velero
55
WORKDIR /go/src/github.com/vmware-tanzu/velero
66
RUN CGO_ENABLED=0 GOOS=linux go build -a -mod=mod -ldflags '-extldflags "-static" -X github.com/vmware-tanzu/velero/pkg/buildinfo.Version=konveyor-dev' -o /go/src/velero github.com/vmware-tanzu/velero/cmd/velero
77

8-
FROM registry.access.redhat.com/ubi8/go-toolset:1.14.7 AS restic-builder
8+
FROM quay.io/konveyor/builder:latest AS restic-builder
99
ENV GOPATH=$APP_ROOT
1010
RUN mkdir -p $APP_ROOT/src/github.com/restic \
1111
&& cd $APP_ROOT/src/github.com/restic \

0 commit comments

Comments
 (0)