github.com/noironetworks/cilium-net@v1.6.12/contrib/release/start-release.sh (about) 1 #!/bin/bash 2 # SPDX-License-Identifier: Apache-2.0 3 # Copyright 2020 Authors of Cilium 4 5 DIR=$(dirname $(readlink -ne $BASH_SOURCE)) 6 source $DIR/lib/common.sh 7 source $DIR/../backporting/common.sh 8 9 PROJECTS_REGEX='s/.*projects\/\([0-9]\+\).*/\1/' 10 ACTS_YAML=".github/cilium-actions.yml" 11 12 usage() { 13 logecho "usage: $0 <VERSION> <GH-PROJECT>" 14 logecho "VERSION Target release version" 15 logecho "GH-PROJECT Project ID for next release" 16 logecho 17 logecho "--help Print this help message" 18 } 19 20 handle_args() { 21 if ! common::argc_validate 2; then 22 usage 2>&1 23 common::exit 1 24 fi 25 26 if [[ "$1" = "--help" ]] || [[ "$1" = "-h" ]]; then 27 usage 28 common::exit 0 29 fi 30 31 if ! echo "$1" | grep -q "[0-9]\+\.[0-9]\+\.[0-9]\+"; then 32 usage 2>&1 33 common::exit 1 "Invalid VERSION ARG \"$1\"; Expected X.Y.Z" 34 fi 35 36 if ! echo "$2" | grep -q "^[0-9]\+"; then 37 usage 2>&1 38 common::exit 1 "Invalid GH-PROJECT ID argument. Expected [0-9]+" 39 fi 40 41 if [[ ! -e VERSION ]]; then 42 common::exit 1 "VERSION file not found. Is this directory a Cilium repository?" 43 fi 44 45 if [[ "$(git status -s | grep -v "^??" | wc -l)" -gt 0 ]]; then 46 git status -s | grep -v "^??" 47 common::exit 1 "Unmerged changes in tree prevent preparing release PR." 48 fi 49 } 50 51 main() { 52 handle_args "$@" 53 54 local old_version="$(cat VERSION)" 55 local ersion="$(echo $1 | sed 's/^v//')" 56 local version="v$ersion" 57 local branch="v$(echo $ersion | sed 's/[^0-9]*\([0-9]\+\.[0-9]\+\).*/\1/')" 58 local remote="origin" 59 local new_proj="$2" 60 61 git fetch $remote 62 git checkout -b pr/prepare-$version $remote/v$branch 63 64 logecho "Updating VERSION, AUTHORS.md, $ACTS_YAML, helm templates" 65 echo $ersion > VERSION 66 logrun make -C install/kubernetes all 67 logrun make update-authors 68 old_proj=$(grep "projects" $ACTS_YAML | sed "$PROJECTS_REGEX") 69 sed -i 's/\(projects\/\)[0-9]\+/\1'$new_proj'/g' $ACTS_YAML 70 71 $DIR/prep-changelog.sh "$old_version" "$version" 72 73 logecho "Next steps:" 74 logecho "* Check all changes and add to a new commit" 75 logecho "* Push the PR to Github for review" 76 logecho "* Close https://github.com/cilium/cilium/projects/$old_proj" 77 logecho "* (After PR merge) Use 'tag-release.sh' to prepare tags/release" 78 79 # Leave $version-changes.txt around for prep-release.sh usage later 80 } 81 82 main "$@"