From 49e2477a2e82bf0d99b62fc3ced32d154b605ffa Mon Sep 17 00:00:00 2001 From: vas Date: Sun, 6 Oct 2019 15:09:51 +0100 Subject: [PATCH] Fix release process --- .cicd/build.sh | 4 ++-- .cicd/checks.sh | 1 - .cicd/docker.sh | 3 ++- .cicd/env.sh | 2 +- .cicd/push.sh | 15 ++++++++++----- .cicd/test.sh | 1 - 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.cicd/build.sh b/.cicd/build.sh index ef14ee4e..f653f136 100755 --- a/.cicd/build.sh +++ b/.cicd/build.sh @@ -4,15 +4,15 @@ set -eox pipefail . .cicd/env.sh build() { + ldflags="-X $mod/core.Version=$vers -X $mod/core.BuildTime=$buildTime" docker run --rm \ -v "$(pwd):/go/src/$mod" \ -w "/go/src/$mod" \ - -e GO111MODULE=on \ -e CGO_ENABLED=0 \ -e GOOS=linux \ -e GOARCH=$1 \ golang:1.13-stretch \ - go build -mod=vendor -o kube-webhook-certgen-$1 -ldflags "-X $mod/core.Version=$vers -X $mod/core.BuildTime=$buildTime" + go build -mod=vendor -o kube-webhook-certgen-$1 -ldflags "$ldflags" } build amd64 diff --git a/.cicd/checks.sh b/.cicd/checks.sh index 71c9c239..f43a4194 100755 --- a/.cicd/checks.sh +++ b/.cicd/checks.sh @@ -8,7 +8,6 @@ command="go fmt ./... && git diff --exit-code;" docker run --rm \ -v "$(pwd):/go/src/$mod" \ -w "/go/src/$mod" \ - -e GO111MODULE=on \ -e CGO_ENABLED=0 \ -e GOOS=linux \ -e GOARCH=amd64 \ diff --git a/.cicd/docker.sh b/.cicd/docker.sh index 4e0e0500..14204a7f 100755 --- a/.cicd/docker.sh +++ b/.cicd/docker.sh @@ -9,10 +9,11 @@ cp Dockerfile dockerbuild dbuild() { cp kube-webhook-certgen-$1 dockerbuild/kube-webhook-certgen - docker build -f dockerbuild/Dockerfile dockerbuild -t $dockerRepo:$vers-$1 + docker build -f dockerbuild/Dockerfile dockerbuild -t docker.io/$dockerRepo:$1-$vers } dbuild amd64 dbuild arm dbuild arm64 +docker run $dockerRepo:amd64-$vers version \ No newline at end of file diff --git a/.cicd/env.sh b/.cicd/env.sh index 2c4d1eea..ac07d7fb 100755 --- a/.cicd/env.sh +++ b/.cicd/env.sh @@ -2,7 +2,7 @@ set -eox pipefail export dockerRepo="jettech/kube-webhook-certgen" -export mod="$(head -n 1 go.mod | cut -f 2 -d ' ')" +export mod="github.com/jet/kube-webhook-certgen" #"$(head -n 1 go.mod | cut -f 2 -d ' ')" export rev=$(git rev-parse HEAD) export tag=$(git tag --points-at HEAD) export buildTime=$(date -u +%FT%TZ) diff --git a/.cicd/push.sh b/.cicd/push.sh index 636fa59c..3a7af198 100755 --- a/.cicd/push.sh +++ b/.cicd/push.sh @@ -8,22 +8,27 @@ function exists() { } dmtag() { - docker manifest annotate $dockerRepo:$vers $dockerRepo:$vers-$1 --os linux --arch $1 + docker manifest annotate $dockerRepo:$vers $dockerRepo:$1-$vers --os linux --arch $1 } +dpush() { + docker push $dockerRepo:$1-$vers +} if exists $dockerRepo $vers; then echo $dockerRepo:$vers already exists, will not overwrite exit 1 else docker login -u jettech -p $jettechPassword + dpush amd64 + dpush arm + dpush arm64 docker manifest create $dockerRepo:$vers \ - $dockerRepo:$vers-amd64 \ - $dockerRepo:$vers-arm \ - $dockerRepo:$vers-arm64 --amend + $dockerRepo:amd64-$vers \ + $dockerRepo:arm-$vers \ + $dockerRepo:arm64-$vers dmtag amd64 dmtag arm dmtag arm64 - docker manifest push $dockerRepo:$vers fi \ No newline at end of file diff --git a/.cicd/test.sh b/.cicd/test.sh index 441efe6d..7da047c8 100755 --- a/.cicd/test.sh +++ b/.cicd/test.sh @@ -9,7 +9,6 @@ go test -mod=vendor -v ./... 2>&1 | go-junit-report > TEST-ALL.xml" docker run --rm \ -v "$(pwd):/go/src/$mod" \ -w "/go/src/$mod" \ - -e GO111MODULE=on \ -e CGO_ENABLED=0 \ -e GOOS=linux \ -e GOARCH=amd64 \