From 7781eac2bdc00eb924718a49003eb73290527787 Mon Sep 17 00:00:00 2001 From: Jacob Weinstock Date: Fri, 24 Feb 2023 15:24:06 -0700 Subject: [PATCH 1/2] Add release doc and script: This doc and helper script is used across other Tinkerbell repos. Signed-off-by: Jacob Weinstock --- RELEASING.md | 19 +++++++++++++++++++ contrib/tag-release.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 RELEASING.md create mode 100755 contrib/tag-release.sh diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 00000000..0c04f113 --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,19 @@ +# Releasing + +## Process + +For version v0.x.y: + +1. Create the annotated tag + > NOTE: To use your GPG signature when pushing the tag, use `SIGN_TAG=1 ./contrib/tag-release.sh v0.x.y` instead) + - `./contrib/tag-release.sh v0.x.y` +1. Push the tag to the GitHub repository. This will automatically trigger a [Github Action](https://github.com/tinkerbell/hook/actions) to create a release. + > NOTE: `origin` should be the name of the remote pointing to `github.com/tinkerbell/boots` + - `git push origin v0.x.y` +1. Review the release on GitHub. + +### Permissions + +Releasing requires a particular set of permissions. + +- Tag push access to the GitHub repository diff --git a/contrib/tag-release.sh b/contrib/tag-release.sh new file mode 100755 index 00000000..3d493118 --- /dev/null +++ b/contrib/tag-release.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +set -o errexit -o nounset -o pipefail + +if [ -z "${1-}" ]; then + echo "Must specify new tag" + exit 1 +fi + +new_tag=${1-} +[[ $new_tag =~ ^v[0-9]*\.[0-9]*\.[0-9]*$ ]] || ( + echo "Tag must be in the form of vX.Y.Z" + exit 1 +) + +if [[ $(git symbolic-ref HEAD) != refs/heads/main ]] && [[ -z ${ALLOW_NON_MAIN:-} ]]; then + echo "Must be on main branch" >&2 + exit 1 +fi +if [[ $(git describe --dirty) != $(git describe) ]]; then + echo "Repo must be in a clean state" >&2 + exit 1 +fi + +git fetch --all + +last_tag=$(git describe --abbrev=0) +last_tag_commit=$(git rev-list -n1 "$last_tag") +last_specific_tag=$(git tag --contains="$last_tag_commit" | grep -E "^v[0-9]*\.[0-9]*\.[0-9]*$" | tail -n 1) +last_specific_tag_commit=$(git rev-list -n1 "$last_specific_tag") +if [[ $last_specific_tag_commit == $(git rev-list -n1 HEAD) ]]; then + echo "No commits since last tag" >&2 + exit 1 +fi + +if [[ -n ${SIGN_TAG-} ]]; then + git tag -s -m "${new_tag}" "${new_tag}" &>/dev/null && echo "created signed tag ${new_tag}" >&2 && exit +else + git tag -a -m "${new_tag}" "${new_tag}" &>/dev/null && echo "created annotated tag ${new_tag}" >&2 && exit +fi \ No newline at end of file From b4649bac606057ed4931b1e85d2de98836194a23 Mon Sep 17 00:00:00 2001 From: Jacob Weinstock Date: Fri, 24 Feb 2023 15:30:45 -0700 Subject: [PATCH 2/2] Fix linting issue Signed-off-by: Jacob Weinstock --- contrib/tag-release.sh | 2 +- hook-bootkit/main.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/tag-release.sh b/contrib/tag-release.sh index 3d493118..34a51902 100755 --- a/contrib/tag-release.sh +++ b/contrib/tag-release.sh @@ -37,4 +37,4 @@ if [[ -n ${SIGN_TAG-} ]]; then git tag -s -m "${new_tag}" "${new_tag}" &>/dev/null && echo "created signed tag ${new_tag}" >&2 && exit else git tag -a -m "${new_tag}" "${new_tag}" &>/dev/null && echo "created annotated tag ${new_tag}" >&2 && exit -fi \ No newline at end of file +fi diff --git a/hook-bootkit/main.go b/hook-bootkit/main.go index f0e4651d..d043394b 100644 --- a/hook-bootkit/main.go +++ b/hook-bootkit/main.go @@ -40,9 +40,9 @@ type tinkConfig struct { // tinkServerTLS is whether or not to use TLS for tink-server communication. tinkServerTLS string - httpProxy string - httpsProxy string - noProxy string + httpProxy string + httpsProxy string + noProxy string } const maxRetryAttempts = 20