mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +00:00
Merge pull request #2623 from Shell32-Natsu/releasing-doc
Releasing doc
This commit is contained in:
@@ -110,10 +110,53 @@ infrequently).
|
||||
Executables appear on the [release page].
|
||||
The tag appears in the URL, e.g. [pluginator/v1.0.0].
|
||||
|
||||
## Releasing Program
|
||||
|
||||
The Go program used to release modules is in `releasing/releasing` directory.
|
||||
|
||||
### List current module versions
|
||||
|
||||
```bash
|
||||
(cd releasing/releasing; go run . list)
|
||||
```
|
||||
|
||||
This command will print the latest versions of supported modules.
|
||||
Example output:
|
||||
|
||||
```
|
||||
kyaml/v0.3.0
|
||||
api/v0.4.1
|
||||
kstatus/v0.0.2
|
||||
cmd/config/v0.3.0
|
||||
cmd/resource/v0.0.2
|
||||
cmd/kubectl/v0.1.0
|
||||
pluginator/v2.1.0
|
||||
kustomize/v3.6.1
|
||||
```
|
||||
|
||||
### Releasing a module
|
||||
|
||||
To release a module, you need to make sure that:
|
||||
|
||||
- The codes in the module are ready to release, i.e. pass all tests and
|
||||
release check. This program will not do any code verification.
|
||||
|
||||
Command:
|
||||
|
||||
```bash
|
||||
(cd releasing/releasing; go run . release {moduleName} {versionField})
|
||||
```
|
||||
|
||||
The command only accepts 3 version types: major, minor or patch.
|
||||
The specified version will be increased by 1 and inferior version(s) will be reset to 0.
|
||||
|
||||
By default the `release` command will not create release in the remote
|
||||
unless you add a `--no-dry-run` flag. You can check the output of the dry-run command to ensure the behavior is expected.
|
||||
|
||||
## Release procedure
|
||||
|
||||
The script used to release modules is in progress. Check it in
|
||||
`releasing/releasing` directory.
|
||||
The previous release program does most of the following steps create a
|
||||
release.
|
||||
|
||||
At any given moment, the repository's master branch is
|
||||
passing all its tests and contains code one could release.
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# VERSIONS contains the release versions of each kustomize go module
|
||||
# update this file and run releasemodule.sh to cut a new release
|
||||
|
||||
# kyaml version
|
||||
export kyaml_major=0
|
||||
export kyaml_minor=3
|
||||
export kyaml_patch=0
|
||||
|
||||
# kstatus version
|
||||
export kstatus_major=0
|
||||
export kstatus_minor=0
|
||||
export kstatus_patch=1
|
||||
|
||||
# kustomize api version
|
||||
export api_major=0
|
||||
export api_minor=4
|
||||
export api_patch=0
|
||||
|
||||
# cmd/config version
|
||||
export cmd_config_major=0
|
||||
export cmd_config_minor=3
|
||||
export cmd_config_patch=0
|
||||
|
||||
# kustomize version
|
||||
export kustomize_major=3
|
||||
export kustomize_minor=5
|
||||
export kustomize_patch=4
|
||||
|
||||
export pluginator_major=2
|
||||
export pluginator_minor=1
|
||||
export pluginator_patch=0
|
||||
@@ -1,109 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2019 The Kubernetes Authors.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# run this script with releasing/releasemodule.sh MODULE
|
||||
# -- e.g. releasing/releasemodule.sh cmd/config
|
||||
# to skip fetch from upstream, run with FETCH=false
|
||||
# -- e.g. FETCH=false releasing/releasemodule.sh kyaml
|
||||
set -e
|
||||
|
||||
# perform release for a module
|
||||
function releaseModule {
|
||||
# calculate the branch and tag names
|
||||
module=$1
|
||||
slash="/"
|
||||
module_name=${module/$slash/_}
|
||||
name="${module_name}_major"
|
||||
major="${!name}"
|
||||
name="${module_name}_minor"
|
||||
minor="${!name}"
|
||||
name="${module_name}_patch"
|
||||
patch="${!name}"
|
||||
branch="release-${module}-v${major}.${minor}"
|
||||
tag="${module}/v${major}.${minor}.${patch}"
|
||||
|
||||
# create a temporary workspace for our work
|
||||
wktree=$(mktemp -d /tmp/kustomize-releases-XXXXXX)
|
||||
git branch $branch upstream/$branch
|
||||
git worktree add $wktree $branch # create a separate worktree for the branch
|
||||
pushd .
|
||||
cd $wktree/$module # cd into the worktree/module
|
||||
|
||||
# merge master changes into the release branch
|
||||
git merge upstream/master
|
||||
|
||||
echo "dir: $wktree"
|
||||
echo "module: $module v$major.$minor.$patch"
|
||||
echo "branch: $branch"
|
||||
echo "tag: $tag"
|
||||
|
||||
# clean up replaces in go.mod as needed
|
||||
FILE=fixgomod.sh
|
||||
if test -f "$FILE"; then
|
||||
./fixgomod.sh
|
||||
|
||||
go mod tidy
|
||||
go test ./...
|
||||
go mod tidy
|
||||
git add .
|
||||
git commit -m "update go.mod for release" || echo "no changes made to go.mod"
|
||||
fi
|
||||
|
||||
go test ./...
|
||||
if [ "$NO_DRY_RUN" == "true" ]; then
|
||||
git push upstream $branch
|
||||
git tag -a $tag -m "Release $tag on branch $branch"
|
||||
git push upstream $tag
|
||||
else
|
||||
printf "\nSkipping push module $module -- run with NO_DRY_RUN=true to push the release.\n\n"
|
||||
fi
|
||||
|
||||
# cleanup release artifacts
|
||||
popd
|
||||
rm -rf $wktree
|
||||
git worktree prune
|
||||
git branch -D $branch
|
||||
|
||||
echo "$module complete"
|
||||
}
|
||||
|
||||
modules="kyaml api kstatus cmd/config cmd/resource cmd/kubectl pluginator kustomize"
|
||||
|
||||
# configure the branch and tag names
|
||||
module="${1?must provide the module to release as an argument: supported modules [$modules]}"
|
||||
|
||||
# verify the module
|
||||
found=false
|
||||
for m in $modules; do
|
||||
if [ "$m" == "$module" ]; then
|
||||
found=true
|
||||
fi
|
||||
done
|
||||
if [ "$found" != "true" ]; then
|
||||
echo "unknown module \"$module\", must be one of: [$modules]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# get the release versions
|
||||
source releasing/VERSIONS
|
||||
|
||||
FETCH=${FETCH:-"true"}
|
||||
NO_DRY_RUN=${NO_DRY_RUN:-"false"}
|
||||
|
||||
# get the most recent changes
|
||||
if [ "$FETCH" == "true" ]; then
|
||||
git fetch upstream
|
||||
fi
|
||||
|
||||
# release the module
|
||||
releaseModule $module
|
||||
|
||||
if [ "$module" == "kustomize" ]; then
|
||||
# TODO: Do this for all modules
|
||||
pushd .
|
||||
getter=$(mktemp -d /tmp/kustomize-releases-XXXXXX)
|
||||
cd $getter
|
||||
go get sigs.k8s.io/kustomize/$module/v3
|
||||
popd
|
||||
fi
|
||||
Reference in New Issue
Block a user