Skip to content

Commit

Permalink
Build and push p and z-linux images to Docker Hub
Browse files Browse the repository at this point in the history
  • Loading branch information
halim-lee committed Feb 18, 2022
1 parent 001fa0f commit 62e5237
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 17 deletions.
36 changes: 24 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ stages:
- name: rebuild-e2e-test
if: branch = main AND fork = false AND type = cron
- name: rebuild-releases
if: branch = main AND fork = false AND type = cron
if: (branch = main OR tag =~ ^v) AND fork = false AND type != cron
- name: rebuild-manifest
if: (branch = main OR tag =~ ^v) AND fork = false AND type != cron
- name: rebuild-bundles
if: branch = main AND fork = false AND type = cron
if: (branch = main OR tag =~ ^v) AND fork = false AND type != cron

jobs:
include:
Expand Down Expand Up @@ -76,21 +78,31 @@ jobs:
os: linux
arch: amd64
script: travis_wait 45 make setup test-e2e RELEASE_TARGET="releases" || travis_terminate 1
# - name: Build releases on ppc64le
# stage: rebuild-releases
# os: linux
# arch: ppc64le
# script: make build-releases RELEASE_TARGET="releases"
# - name: Build releases on s390x
# stage: rebuild-releases
# os: linux
# arch: s390x
# script: make build-releases RELEASE_TARGET="releases"
- name: Build releases on ppc64le
stage: rebuild-releases
os: linux
arch: ppc64le
script: make build-releases RELEASE_TARGET="releases"
- name: Build releases on s390x
stage: rebuild-releases
os: linux
arch: s390x
script: make build-releases RELEASE_TARGET="releases"
- name: Build releases on amd64
stage: rebuild-releases
os: linux
arch: amd64
script: make build-releases RELEASE_TARGET="releases"
- name: Build manifest on ppc64le
stage: rebuild-manifest
os: linux
arch: ppc64le
script: make build-manifest RELEASE_TARGET="releases"
- name: Build manifest on s390x
stage: rebuild-manifest
os: linux
arch: s390x
script: make build-manifest RELEASE_TARGET="releases"
# Bundle all non-ignored releases
- name: Bundle releases
stage: rebuild-bundles
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Build the manager binary
FROM golang:1.16 as builder

ARG GO_ARCH=amd64

WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
Expand All @@ -19,7 +21,7 @@ COPY common/ common/
COPY utils/ utils/

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -mod vendor -a -o manager main.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=$GO_ARCH GO111MODULE=on go build -mod vendor -a -o manager main.go


#Build final image
Expand Down
17 changes: 15 additions & 2 deletions scripts/build-manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,33 @@ build_manifest() {
local tag="$1"
echo "****** Building manifest for: ${tag}"

## Define current arch variable
case "$(uname -p)" in
"ppc64le")
readonly arch="ppc64le"
;;
"s390x")
readonly arch="s390x"
;;
*)
readonly arch="amd64"
;;
esac

## try to build manifest but allow failure
## this allows new release builds
local target="${IMAGE}:${tag}"
# TODO: Add back in linux/s390x and linux/ppc64le once build platforms are back up
# --platforms "linux/amd64,linux/s390x,linux/ppc64le" \
manifest-tool push from-args \
--platforms "linux/amd64" \
--platforms "linux/${arch}" \
--template "${target}-ARCH" \
--target "${target}" \
|| echo "*** WARN: Target architectures not available"
}

# Build manifest for previous releases
build_manifests() {
git fetch --tags
tags="$(git tag -l)"
while read -r tag; do
if [[ -z "${tag}" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ build_release() {
git checkout -q "${RELEASE}"
fi

docker build -t "${full_image}" .
docker build -t "${full_image}" --build-arg GO_ARCH=${arch} .
return $?
}

Expand Down
1 change: 1 addition & 0 deletions scripts/build-releases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ main() {
}

build_releases() {
git fetch --tags
tags="$(git tag -l)"
while read -r tag; do
if [[ -z "${tag}" ]]; then
Expand Down
5 changes: 4 additions & 1 deletion scripts/release-blocklist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ v0.5.1
v0.6.0
v0.7.0
v0.7.1

v0.8.0
v0.8.0-20211124-0830
v0.8.0-20211124-1750
v0.8.0-rc.1

0 comments on commit 62e5237

Please sign in to comment.