diff --git a/releasing/cloudbuild.sh b/api/cloudbuild.sh similarity index 90% rename from releasing/cloudbuild.sh rename to api/cloudbuild.sh index ba7d97e76..6235e47f3 100755 --- a/releasing/cloudbuild.sh +++ b/api/cloudbuild.sh @@ -7,13 +7,9 @@ set -x module=$1 shift -executable=$module - -cd $module - configFile=$(mktemp) cat <$configFile -project_name: $executable +project_name: $module env: - CGO_ENABLED=0 - GO111MODULE=on @@ -32,7 +28,7 @@ release: owner: kubernetes-sigs name: kustomize builds: -- binary: $executable +- binary: $module ldflags: > -s -X sigs.k8s.io/kustomize/api/provenance.version={{.Version}} @@ -50,5 +46,3 @@ EOF cat $configFile /bin/goreleaser release --config=$configFile --rm-dist --skip-validate $@ - - diff --git a/releasing/cloudbuild_api.yaml b/api/cloudbuild.yaml similarity index 91% rename from releasing/cloudbuild_api.yaml rename to api/cloudbuild.yaml index 3f706890f..94122c616 100644 --- a/releasing/cloudbuild_api.yaml +++ b/api/cloudbuild.yaml @@ -3,7 +3,7 @@ steps: args: [fetch, --tags, --depth=100] - name: goreleaser/goreleaser entrypoint: /bin/sh - args: ["releasing/cloudbuild.sh", "api"] + args: ["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.sh b/kustomize/cloudbuild.sh new file mode 100755 index 000000000..6235e47f3 --- /dev/null +++ b/kustomize/cloudbuild.sh @@ -0,0 +1,48 @@ +#!/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/releasing/cloudbuild_kustomize.yaml b/kustomize/cloudbuild.yaml similarity index 90% rename from releasing/cloudbuild_kustomize.yaml rename to kustomize/cloudbuild.yaml index d7d83beca..467743786 100644 --- a/releasing/cloudbuild_kustomize.yaml +++ b/kustomize/cloudbuild.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.sh b/pluginator/cloudbuild.sh new file mode 100755 index 000000000..6235e47f3 --- /dev/null +++ b/pluginator/cloudbuild.sh @@ -0,0 +1,48 @@ +#!/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/releasing/cloudbuild_pluginator.yaml b/pluginator/cloudbuild.yaml similarity index 89% rename from releasing/cloudbuild_pluginator.yaml rename to pluginator/cloudbuild.yaml index 365c85a3c..a367448de 100644 --- a/releasing/cloudbuild_pluginator.yaml +++ b/pluginator/cloudbuild.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/README.md b/releasing/README.md index 341311796..cefe1a7ae 100644 --- a/releasing/README.md +++ b/releasing/README.md @@ -14,16 +14,16 @@ These modules release independently. ## Module summaries [`sigs.k8s.io/kustomize/kustomize`]: #sigsk8siokustomizekustomize -[`sigs.k8s.io/kustomize`]: #sigsk8siokustomize +[`sigs.k8s.io/kustomize/api`]: #sigsk8siokustomizeapi [`sigs.k8s.io/kustomize/pluginator`]: #sigsk8siokustomizepluginator [kustomize/v3.2.1]: https://github.com/kubernetes-sigs/kustomize/releases/tag/kustomize%2Fv3.2.1 [pluginator/v1.0.0]: https://github.com/kubernetes-sigs/kustomize/releases/tag/pluginator%2Fv1.0.0 -| Module Description | Module Prefix | Tag | Branch Name | +| Module Description | Module Prefix | Ex. Tag | Ex. Branch Name | | --- | ------ | --- | --- | -| kustomize executable | [`sigs.k8s.io/kustomize/kustomize`] | _kustomize/v{major}.{minor}.{patch}_ | _release-kustomize-v{major}.{minor}_ | -| kustomize Go API | [`sigs.k8s.io/kustomize/api`] | _api/v{major}.{minor}.{patch}_ | _release-api-v{major}.{minor}_ | -| pluginator executable | [`sigs.k8s.io/kustomize/pluginator`] | _pluginator/v{major}.{minor}.{patch}_ | _release-pluginator-v{major}.{minor}_ | +| kustomize executable | [`sigs.k8s.io/kustomize/kustomize`] | _kustomize/v3.2.2_ | _release-kustomize-v3.2.2_ | +| kustomize Go API | [`sigs.k8s.io/kustomize/api`] | _api/v0.1.0_ | _release-api-v0.1_ | +| pluginator executable | [`sigs.k8s.io/kustomize/pluginator`] | _pluginator/v1.0.0_ | _release-pluginator-v1.0_ | ### sigs.k8s.io/kustomize/kustomize @@ -143,9 +143,7 @@ Go's [semver]-compatible version tags take the form `v{major}.{minor}.{patch}`: with respect to CLI arguments and flags), increment `major`. ``` -major=1 -minor=2 -patch=3 +major=0; minor=1; patch=0 ``` ### create the release branch @@ -158,9 +156,15 @@ since the branch accumulates patch releases. > TODO: define procedure for doing a cherrypick (committing a patch) to a > release branch that already exists. +Name the branch: + ``` branch="release-${module}-v${major}.${minor}" echo "branch=$branch" +``` + +Create it: +``` git checkout -b $branch ``` diff --git a/releasing/localbuild.sh b/releasing/localbuild.sh index 1f4032241..6ec6a437f 100755 --- a/releasing/localbuild.sh +++ b/releasing/localbuild.sh @@ -1,8 +1,10 @@ #!/bin/bash -# Usage - from the repository root, enter +# Usage - from the module (kustomize|pluginator|api) of +# your choice, enterthe repository root, enter # -# ./releasing/localbuild.sh (kustomize|pluginator|api) +# cd module +# ../releasing/localbuild.sh # # The script attempts to use cloudbuild configuration # to create a release "locally". @@ -17,7 +19,9 @@ # applied to the kustomize repo, the cloud builder # reads the repository-relative file # -# releasing/cloudbuild_(kustomize|pluginator|api).yaml +# ${module}/cloudbuild.yaml +# +# where module is one of kustomize, pluginator or api. # # Inside this yaml file is a reference to the script # @@ -46,7 +50,7 @@ case "$module" in esac config=$(mktemp) -cp releasing/cloudbuild_${module}.yaml $config +cp cloudbuild.yaml $config # Delete the cloud-builders/git step, which isn't needed # for a local run. @@ -72,5 +76,5 @@ cloud-build-local \ echo " " echo "Result of local build:" echo "##########################################" -tree ./$module/dist +tree ./dist echo "##########################################"