From 335077eade53191f328f63fc6773382dcfa4c4f5 Mon Sep 17 00:00:00 2001 From: jregan Date: Mon, 21 Oct 2019 19:00:52 -0700 Subject: [PATCH] Cloud build adjustments. --- kustomize/cloudbuild.sh | 48 ------------------- pluginator/cloudbuild.sh | 48 ------------------- {api => releasing}/cloudbuild.sh | 2 + .../cloudbuild_api.yaml | 2 +- .../cloudbuild_kustomize.yaml | 2 +- .../cloudbuild_pluginator.yaml | 2 +- releasing/localbuild.sh | 13 +++-- 7 files changed, 11 insertions(+), 106 deletions(-) delete mode 100755 kustomize/cloudbuild.sh delete mode 100755 pluginator/cloudbuild.sh rename {api => releasing}/cloudbuild.sh (98%) rename api/cloudbuild.yaml => releasing/cloudbuild_api.yaml (91%) rename kustomize/cloudbuild.yaml => releasing/cloudbuild_kustomize.yaml (90%) rename pluginator/cloudbuild.yaml => releasing/cloudbuild_pluginator.yaml (89%) diff --git a/kustomize/cloudbuild.sh b/kustomize/cloudbuild.sh deleted file mode 100755 index 6235e47f3..000000000 --- a/kustomize/cloudbuild.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -set -e -set -x - -# Script to run http://goreleaser.com - -module=$1 -shift - -configFile=$(mktemp) -cat <$configFile -project_name: $module -env: -- CGO_ENABLED=0 -- GO111MODULE=on -checksum: - name_template: 'checksums.txt' -changelog: - sort: asc - filters: - exclude: - - '^docs:' - - '^test:' - - Merge pull request - - Merge branch -release: - github: - owner: kubernetes-sigs - name: kustomize -builds: -- binary: $module - ldflags: > - -s - -X sigs.k8s.io/kustomize/api/provenance.version={{.Version}} - -X sigs.k8s.io/kustomize/api/provenance.gitCommit={{.Commit}} - -X sigs.k8s.io/kustomize/api/provenance.buildDate={{.Date}} - - goos: - - linux - - darwin - - windows - goarch: - - amd64 -EOF - -cat $configFile - -/bin/goreleaser release --config=$configFile --rm-dist --skip-validate $@ diff --git a/pluginator/cloudbuild.sh b/pluginator/cloudbuild.sh deleted file mode 100755 index 6235e47f3..000000000 --- a/pluginator/cloudbuild.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -set -e -set -x - -# Script to run http://goreleaser.com - -module=$1 -shift - -configFile=$(mktemp) -cat <$configFile -project_name: $module -env: -- CGO_ENABLED=0 -- GO111MODULE=on -checksum: - name_template: 'checksums.txt' -changelog: - sort: asc - filters: - exclude: - - '^docs:' - - '^test:' - - Merge pull request - - Merge branch -release: - github: - owner: kubernetes-sigs - name: kustomize -builds: -- binary: $module - ldflags: > - -s - -X sigs.k8s.io/kustomize/api/provenance.version={{.Version}} - -X sigs.k8s.io/kustomize/api/provenance.gitCommit={{.Commit}} - -X sigs.k8s.io/kustomize/api/provenance.buildDate={{.Date}} - - goos: - - linux - - darwin - - windows - goarch: - - amd64 -EOF - -cat $configFile - -/bin/goreleaser release --config=$configFile --rm-dist --skip-validate $@ diff --git a/api/cloudbuild.sh b/releasing/cloudbuild.sh similarity index 98% rename from api/cloudbuild.sh rename to releasing/cloudbuild.sh index 6235e47f3..1a895148b 100755 --- a/api/cloudbuild.sh +++ b/releasing/cloudbuild.sh @@ -7,6 +7,8 @@ set -x module=$1 shift +cd $module + configFile=$(mktemp) cat <$configFile project_name: $module diff --git a/api/cloudbuild.yaml b/releasing/cloudbuild_api.yaml similarity index 91% rename from api/cloudbuild.yaml rename to releasing/cloudbuild_api.yaml index 94122c616..3f706890f 100644 --- a/api/cloudbuild.yaml +++ b/releasing/cloudbuild_api.yaml @@ -3,7 +3,7 @@ steps: args: [fetch, --tags, --depth=100] - name: goreleaser/goreleaser entrypoint: /bin/sh - args: ["cloudbuild.sh", "api"] + args: ["releasing/cloudbuild.sh", "api"] secretEnv: ['GITHUB_TOKEN'] secrets: - kmsKeyName: projects/kustomize-199618/locations/global/keyRings/github-tokens/cryptoKeys/gh-release-token diff --git a/kustomize/cloudbuild.yaml b/releasing/cloudbuild_kustomize.yaml similarity index 90% rename from kustomize/cloudbuild.yaml rename to releasing/cloudbuild_kustomize.yaml index 467743786..d7d83beca 100644 --- a/kustomize/cloudbuild.yaml +++ b/releasing/cloudbuild_kustomize.yaml @@ -3,7 +3,7 @@ steps: args: [fetch, --tags, --depth=100] - name: goreleaser/goreleaser entrypoint: /bin/sh - args: ["../releasing/cloudbuild.sh", "kustomize"] + args: ["releasing/cloudbuild.sh", "kustomize"] secretEnv: ['GITHUB_TOKEN'] secrets: - kmsKeyName: projects/kustomize-199618/locations/global/keyRings/github-tokens/cryptoKeys/gh-release-token diff --git a/pluginator/cloudbuild.yaml b/releasing/cloudbuild_pluginator.yaml similarity index 89% rename from pluginator/cloudbuild.yaml rename to releasing/cloudbuild_pluginator.yaml index a367448de..365c85a3c 100644 --- a/pluginator/cloudbuild.yaml +++ b/releasing/cloudbuild_pluginator.yaml @@ -3,7 +3,7 @@ steps: args: [fetch, --tags, --depth=100] - name: goreleaser/goreleaser entrypoint: /bin/sh - args: ["../releasing/cloudbuild.sh", "pluginator"] + args: ["releasing/cloudbuild.sh", "pluginator"] secretEnv: ['GITHUB_TOKEN'] secrets: - kmsKeyName: projects/kustomize-199618/locations/global/keyRings/github-tokens/cryptoKeys/gh-release-token diff --git a/releasing/localbuild.sh b/releasing/localbuild.sh index 6ec6a437f..fb5e95833 100755 --- a/releasing/localbuild.sh +++ b/releasing/localbuild.sh @@ -1,10 +1,9 @@ #!/bin/bash -# Usage - from the module (kustomize|pluginator|api) of -# your choice, enterthe repository root, enter +# Usage - from repo root, enter: # -# cd module -# ../releasing/localbuild.sh +# module=(kustomize|pluginator|api) +# ./releasing/localbuild.sh $module # # The script attempts to use cloudbuild configuration # to create a release "locally". @@ -19,7 +18,7 @@ # applied to the kustomize repo, the cloud builder # reads the repository-relative file # -# ${module}/cloudbuild.yaml +# releasing/cloudbuild_${module}.yaml # # where module is one of kustomize, pluginator or api. # @@ -50,7 +49,7 @@ case "$module" in esac config=$(mktemp) -cp cloudbuild.yaml $config +cp releasing/cloudbuild_${module}.yaml $config # Delete the cloud-builders/git step, which isn't needed # for a local run. @@ -76,5 +75,5 @@ cloud-build-local \ echo " " echo "Result of local build:" echo "##########################################" -tree ./dist +tree ./$module/dist echo "##########################################"