From 62e523742fb74314a14c3192ad03a0a5e52c6ec6 Mon Sep 17 00:00:00 2001 From: Melissa Lee Date: Fri, 18 Feb 2022 16:13:29 -0500 Subject: [PATCH 1/4] Build and push p and z-linux images to Docker Hub --- .travis.yml | 36 +++++++++++++++++++++++------------ Dockerfile | 4 +++- scripts/build-manifest.sh | 17 +++++++++++++++-- scripts/build-release.sh | 2 +- scripts/build-releases.sh | 1 + scripts/release-blocklist.txt | 5 ++++- 6 files changed, 48 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index f059b6b44..51a6ddf7f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: @@ -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 diff --git a/Dockerfile b/Dockerfile index 705bdd54f..aa3f32084 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -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 diff --git a/scripts/build-manifest.sh b/scripts/build-manifest.sh index 23bd87b95..4f95f3dde 100755 --- a/scripts/build-manifest.sh +++ b/scripts/build-manifest.sh @@ -60,13 +60,25 @@ 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" @@ -74,6 +86,7 @@ build_manifest() { # Build manifest for previous releases build_manifests() { + git fetch --tags tags="$(git tag -l)" while read -r tag; do if [[ -z "${tag}" ]]; then diff --git a/scripts/build-release.sh b/scripts/build-release.sh index 83bdcbf17..7b68f7da0 100755 --- a/scripts/build-release.sh +++ b/scripts/build-release.sh @@ -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 $? } diff --git a/scripts/build-releases.sh b/scripts/build-releases.sh index 2756d9208..5c7ebcd2a 100755 --- a/scripts/build-releases.sh +++ b/scripts/build-releases.sh @@ -55,6 +55,7 @@ main() { } build_releases() { + git fetch --tags tags="$(git tag -l)" while read -r tag; do if [[ -z "${tag}" ]]; then diff --git a/scripts/release-blocklist.txt b/scripts/release-blocklist.txt index f278bb0da..d3141057a 100644 --- a/scripts/release-blocklist.txt +++ b/scripts/release-blocklist.txt @@ -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 \ No newline at end of file From 701927fc6282f36c87f8ded38aaf0a1408284e70 Mon Sep 17 00:00:00 2001 From: Melissa Lee Date: Tue, 22 Feb 2022 10:48:23 -0500 Subject: [PATCH 2/4] Manifest build task edit --- .travis.yml | 12 ------------ scripts/build-manifest.sh | 17 ++--------------- 2 files changed, 2 insertions(+), 27 deletions(-) diff --git a/.travis.yml b/.travis.yml index 51a6ddf7f..9564f2509 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,8 +28,6 @@ stages: if: branch = main AND fork = false AND type = cron - name: rebuild-releases 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 OR tag =~ ^v) AND fork = false AND type != cron @@ -93,16 +91,6 @@ jobs: 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 diff --git a/scripts/build-manifest.sh b/scripts/build-manifest.sh index 4f95f3dde..7134f2807 100755 --- a/scripts/build-manifest.sh +++ b/scripts/build-manifest.sh @@ -60,25 +60,12 @@ 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}" - # --platforms "linux/amd64,linux/s390x,linux/ppc64le" \ + manifest-tool push from-args \ - --platforms "linux/${arch}" \ + --platforms "linux/amd64,linux/s390x,linux/ppc64le" \ --template "${target}-ARCH" \ --target "${target}" \ || echo "*** WARN: Target architectures not available" From f4617cb39ed838e77f2e86d216edf6cfdbde719a Mon Sep 17 00:00:00 2001 From: Melissa Lee Date: Tue, 22 Feb 2022 16:40:23 -0500 Subject: [PATCH 3/4] Dockerfile revert --- Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index aa3f32084..705bdd54f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,6 @@ # 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 @@ -21,7 +19,7 @@ COPY common/ common/ COPY utils/ utils/ # Build -RUN CGO_ENABLED=0 GOOS=linux GOARCH=$GO_ARCH GO111MODULE=on go build -mod vendor -a -o manager main.go +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -mod vendor -a -o manager main.go #Build final image From d74db90fbb7c5d50418bb4e0a23745f407305383 Mon Sep 17 00:00:00 2001 From: Melissa Lee Date: Wed, 23 Feb 2022 15:20:25 -0500 Subject: [PATCH 4/4] Rebuild stages reverted to type cron --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9564f2509..a3b054fee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,9 +27,9 @@ stages: - name: rebuild-e2e-test if: branch = main AND fork = false AND type = cron - name: rebuild-releases - if: (branch = main OR tag =~ ^v) AND fork = false AND type != cron + if: branch = main AND fork = false AND type = cron - name: rebuild-bundles - if: (branch = main OR tag =~ ^v) AND fork = false AND type != cron + if: branch = main AND fork = false AND type = cron jobs: include: