mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
Introduce dummy program to help with API releases.
This commit is contained in:
@@ -70,19 +70,15 @@ require sigs.k8s.io/kustomize/v4 v4.0.1
|
||||
|
||||
#### Release artifacts
|
||||
|
||||
This is a Go library only release, so the only
|
||||
artifact per se is the repo tag, in the form `v4.3.2`,
|
||||
that API clients can `require` from their `go.mod` file.
|
||||
|
||||
Release notes should appear on the [release page].
|
||||
|
||||
[release notes generator]: https://github.com/kubernetes-sigs/controller-runtime/blob/master/hack/release/release-notes.sh
|
||||
|
||||
> TODO: install a decent library [release notes generator].
|
||||
> Until then, just run something like
|
||||
> ```
|
||||
> git log --pretty="%h - %s (%aN)" v3.1.0..v3.2.0
|
||||
> ```
|
||||
> and summarize the results via the [release page] UX.
|
||||
|
||||
There's no binary, just a repo tag in the form `v4.3.2`
|
||||
that others can `require` from their `go.mod` files.
|
||||
There's an executable called `kustapiversion`, which, if
|
||||
run, prints the API release provenance data, but it's of
|
||||
no practical use to an API client.
|
||||
|
||||
### sigs.k8s.io/kustomize/pluginator
|
||||
|
||||
@@ -201,7 +197,7 @@ fi
|
||||
Install [`cloud-build-local`], then run
|
||||
|
||||
```
|
||||
./releasing/localbuild.sh (kustomize|pluginator)
|
||||
./releasing/localbuild.sh (kustomize|pluginator|api)
|
||||
```
|
||||
|
||||
This should create release artifacts in a local directory.
|
||||
|
||||
@@ -7,16 +7,21 @@ set -x
|
||||
module=$1
|
||||
shift
|
||||
|
||||
executable=$module
|
||||
if [ "$module" == "api" ]; then
|
||||
echo "goreleaser only releases 'main' packages (executables)"
|
||||
echo "See https://github.com/goreleaser/goreleaser/issues/981"
|
||||
exit 1
|
||||
# For this module, there's no correspondingly named
|
||||
# sub-directory, since the module is at the repo root.
|
||||
# There is, however, a dummy executable in a sub-directory.
|
||||
# Build that executable, primarily to give goreleaser
|
||||
# something to coordinate it release process around.
|
||||
executable=kustapiversion
|
||||
fi
|
||||
|
||||
config=$(mktemp)
|
||||
cd $executable
|
||||
|
||||
cat <<EOF >$config
|
||||
project_name: $module
|
||||
configFile=$(mktemp)
|
||||
cat <<EOF >$configFile
|
||||
project_name: $executable
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
- GO111MODULE=on
|
||||
@@ -34,29 +39,14 @@ release:
|
||||
github:
|
||||
owner: kubernetes-sigs
|
||||
name: kustomize
|
||||
EOF
|
||||
builds:
|
||||
- binary: $executable
|
||||
ldflags: >
|
||||
-s
|
||||
-X sigs.k8s.io/kustomize/v3/provenance.version={{.Version}}
|
||||
-X sigs.k8s.io/kustomize/v3/provenance.gitCommit={{.Commit}}
|
||||
-X sigs.k8s.io/kustomize/v3/provenance.buildDate={{.Date}}
|
||||
|
||||
case "$module" in
|
||||
kustomize)
|
||||
cat <<EOF >>$config
|
||||
builds:
|
||||
- main: ./main.go
|
||||
binary: kustomize
|
||||
ldflags: -s -X sigs.k8s.io/kustomize/kustomize/v3/provenance.version={{.Version}} -X sigs.k8s.io/kustomize/kustomize/v3/provenance.gitCommit={{.Commit}} -X sigs.k8s.io/kustomize/kustomize/v3/provenance.buildDate={{.Date}}
|
||||
goos:
|
||||
- linux
|
||||
- darwin
|
||||
- windows
|
||||
goarch:
|
||||
- amd64
|
||||
archive:
|
||||
format: binary
|
||||
EOF
|
||||
;;
|
||||
pluginator)
|
||||
cat <<EOF >>$config
|
||||
builds:
|
||||
- binary: pluginator
|
||||
goos:
|
||||
- linux
|
||||
- darwin
|
||||
@@ -64,20 +54,9 @@ builds:
|
||||
goarch:
|
||||
- amd64
|
||||
EOF
|
||||
;;
|
||||
*)
|
||||
echo "Don't recognize module $module"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
cat $config
|
||||
cat $configFile
|
||||
|
||||
if [ "$module" != "api" ]; then
|
||||
# goreleaser must be run from the _module_ being released.
|
||||
cd $module
|
||||
fi
|
||||
|
||||
/bin/goreleaser release --config=$config --rm-dist --skip-validate $@
|
||||
/bin/goreleaser release --config=$configFile --rm-dist --skip-validate $@
|
||||
|
||||
|
||||
|
||||
11
releasing/cloudbuild_api.yaml
Normal file
11
releasing/cloudbuild_api.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
steps:
|
||||
- name: "gcr.io/cloud-builders/git"
|
||||
args: [fetch, --tags, --depth=100]
|
||||
- name: goreleaser/goreleaser
|
||||
entrypoint: /bin/sh
|
||||
args: ["releasing/cloudbuild.sh", "api"]
|
||||
secretEnv: ['GITHUB_TOKEN']
|
||||
secrets:
|
||||
- kmsKeyName: projects/kustomize-199618/locations/global/keyRings/github-tokens/cryptoKeys/gh-release-token
|
||||
secretEnv:
|
||||
GITHUB_TOKEN: CiQAyrREbPgXJOeT7M3t+WlxkhXwlMPudixBeiyWTjmLOMLqdK4SUQA0W+xUmDJKAhyfHCcwqSEzUn9OwKC7XAYcmwe0CCKTCbPbDgmioDK24q3LVapndXNvnnHvCjhOJNEr1o+P1DCF+LlzYV2YL8lP09rrKrslPg==
|
||||
@@ -17,8 +17,8 @@
|
||||
# applied to the kustomize repo, the cloud builder
|
||||
# reads the repository-relative file
|
||||
#
|
||||
# releasing/cloudbuild_(kustomize|pluginator).yaml
|
||||
#
|
||||
# releasing/cloudbuild_(kustomize|pluginator|api).yaml
|
||||
#
|
||||
# Inside this yaml file is a reference to the script
|
||||
#
|
||||
# releasing/cloudbuild.sh
|
||||
@@ -34,9 +34,6 @@ set -e
|
||||
module=$1
|
||||
case "$module" in
|
||||
api)
|
||||
echo "goreleaser only releases 'main' packages (executables)"
|
||||
echo "See https://github.com/goreleaser/goreleaser/issues/981"
|
||||
exit 1
|
||||
;;
|
||||
kustomize)
|
||||
;;
|
||||
@@ -51,7 +48,8 @@ esac
|
||||
config=$(mktemp)
|
||||
cp releasing/cloudbuild_${module}.yaml $config
|
||||
|
||||
# Delete the cloud-builders/git step.
|
||||
# Delete the cloud-builders/git step, which isn't needed
|
||||
# for a local run.
|
||||
sed -i '2,3d' $config
|
||||
|
||||
# Add the --snapshot flag to suppress the
|
||||
@@ -74,5 +72,9 @@ cloud-build-local \
|
||||
echo " "
|
||||
echo "Result of local build:"
|
||||
echo "##########################################"
|
||||
tree ./$module/dist
|
||||
if [ "$module" == "api" ]; then
|
||||
tree ./kustapiversion/dist
|
||||
else
|
||||
tree ./$module/dist
|
||||
fi
|
||||
echo "##########################################"
|
||||
|
||||
Reference in New Issue
Block a user