Skip to content

Commit

Permalink
refactor release cloudbuild job (#1476)
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Panato <ctadeu@gmail.com>
  • Loading branch information
cpanato committed Feb 18, 2022
1 parent c93a665 commit ec01fe4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 27 deletions.
1 change: 1 addition & 0 deletions .github/workflows/validate-release.yml
Expand Up @@ -58,6 +58,7 @@ jobs:
run: |
docker run --rm --privileged \
-e PROJECT_ID=honk-fake-project \
-e CI=$CI \
-e RUNTIME_IMAGE=gcr.io/distroless/static:debug-nonroot \
-v ${PWD}:/go/src/sigstore/cosign \
-v /var/run/docker.sock:/var/run/docker.sock \
Expand Down
5 changes: 5 additions & 0 deletions .goreleaser.yml
Expand Up @@ -11,6 +11,10 @@ before:
hooks:
- go mod tidy
- /bin/bash -c 'if [ -n "$(git --no-pager diff --exit-code go.mod go.sum)" ]; then exit 1; fi'
# if running a release we will generate the images in this step
# if running in the CI the CI env va is set and we dont run the ko steps
# this is needed because we are generating files that goreleaser was not aware to push to GH project release
- /bin/bash -c 'if [ -z "$CI" ]; then make sign-container-release && make sign-keyless-release; fi'

gomod:
proxy: true
Expand Down Expand Up @@ -250,6 +254,7 @@ release:
extra_files:
- glob: "./release/release-cosign.pub"
- glob: "./cosign*.yaml"

rigs:
- rig:
Expand Down
30 changes: 4 additions & 26 deletions release/cloudbuild.yaml
Expand Up @@ -56,36 +56,14 @@ steps:
- GIT_TAG=${_GIT_TAG}
- GOOGLE_SERVICE_ACCOUNT_NAME=keyless@${PROJECT_ID}.iam.gserviceaccount.com
- COSIGN_EXPERIMENTAL=true
- KO_PREFIX=gcr.io/${PROJECT_ID}
secretEnv:
- GITHUB_TOKEN
args:
- '-c'
- |
make release
- name: ghcr.io/gythialy/golang-cross:v1.17.7-0@sha256:949325ffc52c16867d78412ce70f5ce531812c20e7528ae70dc9e718d72223e8
entrypoint: 'bash'
dir: "go/src/sigstore/cosign"
env:
- "GOPATH=/workspace/go"
- "GOBIN=/workspace/bin"
- PROJECT_ID=${PROJECT_ID}
- KEY_LOCATION=${_KEY_LOCATION}
- KEY_RING=${_KEY_RING}
- KEY_NAME=${_KEY_NAME}
- KEY_VERSION=${_KEY_VERSION}
- GIT_TAG=${_GIT_TAG}
- KO_PREFIX=gcr.io/${PROJECT_ID}
- COSIGN_EXPERIMENTAL=true
- GOOGLE_SERVICE_ACCOUNT_NAME=keyless@${PROJECT_ID}.iam.gserviceaccount.com
secretEnv:
- GITHUB_TOKEN
args:
- '-c'
- |
gcloud auth configure-docker \
&& make sign-container-release \
&& make sign-keyless-release
gcloud auth configure-docker \
&& make release
availableSecrets:
secretManager:
Expand All @@ -98,7 +76,7 @@ artifacts:
paths:
- "go/src/sigstore/cosign/dist/*"
- "go/src/sigstore/cosign/release/release-cosign.pub"
- "go/src/sigstore/cosign/cosign*.yaml
- "go/src/sigstore/cosign/cosign*.yaml"

options:
machineType: E2_HIGHCPU_8
Expand Down
2 changes: 1 addition & 1 deletion release/release.mk
Expand Up @@ -5,7 +5,7 @@
# used when releasing together with GCP CloudBuild
.PHONY: release
release:
LDFLAGS="$(LDFLAGS)" goreleaser release --timeout 60m
LDFLAGS="$(LDFLAGS)" goreleaser release --timeout 120m

###########################
# sign with GCP KMS section
Expand Down

0 comments on commit ec01fe4

Please sign in to comment.