-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
start a release-inventory.sh and install-cr.sh script
also clean up some other scripts and add docs
- Loading branch information
1 parent
5733350
commit 973ac31
Showing
4 changed files
with
136 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Deprecated | ||
|
||
Per [this issue](https://github.com/apache/couchdb-helm/issues/62), we plan to move things in `./docs` here | ||
to GitHub releases and follow the helm community's guidance on | ||
release practices for helm charts. | ||
|
||
# Migration Path | ||
|
||
In order to migrate the old .tgz files, we: | ||
|
||
- Will find the latest commit that modified a .tgz | ||
- Sanity check that `Chart.yaml` represents the same version | ||
- Forego any further file consistency checks (this is best effort) | ||
- Presume that the git state matches what is in the .tgz at that time | ||
- Tag and release the given commit to GitHub Releases using [`chart-releaser`](https://github.com/helm/chart-releaser) | ||
|
||
## How To | ||
|
||
1. `cd docs` to move into this directory | ||
2. Install the `chart-releaser` binary (only one architecture defined) | ||
```bash | ||
cd docs | ||
./install-cr.sh | ||
``` | ||
3. Build an inventory of what .tgz files exist in the directory | ||
```bash | ||
./get-inventory.sh | ||
``` | ||
4. Sanity check that things look appropriate | ||
```bash | ||
./check-inventory.sh | ||
``` | ||
5. Run the release dry-run | ||
```bash | ||
# ./release-inventory.sh {{ owner }} | ||
# i.e. | ||
./release-inventory.sh colearendt | ||
``` | ||
6. Check that things look good, then run the actual release process | ||
```bash | ||
# ./release-inventory.sh {{ owner }} execute | ||
# (see docs for more info / other args) | ||
# i.e. | ||
./release-inventory.sh colearendt execute | ||
``` | ||
|
||
NOTE: we have not done anything to sign chart packages here, though `chart-releaser` supports doing so. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
os=$(uname -p) | ||
arch=$(uname -s) | ||
if [[ "${os}" == "arm" ]] && [[ "${arch}" == "Darwin" ]]; then | ||
mkdir -p ./bin/cr-1.4.0/ | ||
curl -L https://github.com/helm/chart-releaser/releases/download/v1.4.0/chart-releaser_1.4.0_darwin_arm64.tar.gz | tar -xzvf - -C ./bin/cr-1.4.0/ | ||
ln -f -s $PWD/bin/cr-1.4.0/cr $PWD/bin/cr | ||
echo "Installed successfully!" | ||
else | ||
echo "ERROR: OS '${os}' and Architecture '${arch}' not defined" | ||
echo "Visit https://github.com/helm/chart-releaser/releases to see releases" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euxo pipefail | ||
|
||
# Example usage | ||
# | ||
# | ||
# $1 == owner - no default | ||
# $2 == "execute" makes the release fire! | ||
# $3 == GitHub auth token. Defaults to the value of $GITHUB_PAT | ||
# $4 == GitHub repository - defaults to "couchdb-helm" | ||
|
||
owner=${1:-} | ||
execute=${2:-} | ||
token=${3:-${GITHUB_PAT:-}} | ||
repo=${4:-couchdb-helm} | ||
chart_name=${5:-couchdb} | ||
|
||
if [[ -z "$owner" ]]; then | ||
echo "Error: must provide 'owner' in first argument" | ||
exit 1 | ||
fi | ||
|
||
echo "Owner: $owner" | ||
echo "Execute?: $execute" | ||
|
||
IFS_OLD=$IFS | ||
trap 'IFS=$IFS_OLD' EXIT SIGINT | ||
IFS=$'\n' | ||
|
||
current_sha=$(git branch --show-current) | ||
res=$? | ||
if [[ $res -gt 0 ]]; then | ||
current_sha=$(git rev-parse --short HEAD) | ||
fi; | ||
# clean up handler. This warns, but does help escape the loop on interrupt | ||
trap "git checkout $current_sha; exit 1" EXIT SIGINT | ||
|
||
inventory=$(cat inventory.txt) | ||
for line in ${inventory}; do | ||
echo $line; | ||
tarball=$(echo $line | cut -d: -f 1); | ||
gitsha=$(echo $line | cut -d' ' -f 2); | ||
cversion=${tarball/couchdb-/}; | ||
cversion=${cversion/.tgz/}; | ||
echo "--> Checking out '$gitsha' for chart version '$cversion'"; | ||
|
||
git checkout $gitsha; | ||
|
||
long_sha=$(git rev-parse $gitsha) | ||
|
||
read -n 1 -p "Pausing to check if this is ok. Press any key to continue: "; | ||
echo ; | ||
echo "--> Continuing..."; | ||
echo; echo; | ||
|
||
if [[ "$execute" == "execute" ]] && [[ -n "$token" ]]; then | ||
echo "--> Setting tag for release ${cversion} and sha ${gitsha}!" | ||
git tag -f ${chart_name}-${cversion} | ||
echo "--> Executing release!" | ||
./bin/cr package ../couchdb | ||
./bin/cr upload -c "$long_sha" --skip-existing -t "$token" -o $owner -r $repo | ||
git push --tags --force | ||
# clean the directory | ||
rm .cr-release-packages/* | ||
else | ||
echo "--> 'execute' was not provided to the .sh invocation. Skipping..." | ||
fi | ||
|
||
done | ||
|
||
git checkout $current_sha | ||
exit 0 |