Skip to content

Commit

Permalink
Fix release process
Browse files Browse the repository at this point in the history
  • Loading branch information
vsliouniaev committed Oct 6, 2019
1 parent 02be1df commit 49e2477
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .cicd/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion .cicd/checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
3 changes: 2 additions & 1 deletion .cicd/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .cicd/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 10 additions & 5 deletions .cicd/push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion .cicd/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit 49e2477

Please sign in to comment.