diff --git a/doc/source/reference/using.rst b/doc/source/reference/using.rst index 621f413647..38311251c8 100644 --- a/doc/source/reference/using.rst +++ b/doc/source/reference/using.rst @@ -679,13 +679,14 @@ the PTL and all release liaisons. This is designed to be used by the release team at key points in the cycle to ease bulk releases. - .. note:: +.. note:: + + This tool will commit ultimately commit all modified deliverables and + modifies git state. Therefore it is essential that before running it + the working tree contains only the logical changes appropriate for the + stage of the release *and* all changes are saved elsewhere, in case the + script encounters a problem. - This tool will commit ultimately commit all modified deliverables and - modifies git state. Therefore it is essential that befoer running it - the working tree contains only the logical changes appropriate for the - stage of the release *and* all changes are saved elsewhere, in case the - script encounters a problem. tools/make_missing_releases.sh ------------------------------ @@ -695,6 +696,41 @@ to create releases at appropriate times in the release cycle, e.g milestones. Once ``tools/make_missing_releases.sh`` completes the release manager can use ``tools/bulk_review.sh`` to submit the release requests. +toos/process_auto_releases.sh +----------------------------- + +Automates parts of the process to propose releases for a large set of +deliverables. + +There are multiple points during the release cycle where the release team +needs to initiate releases for library releases, tagging RCs, or other cases +where we need to inspect each deliverable in a set to generate release +requests. + +This tool asks for input on a few common settings to use for the releases. A +template commit message is entered on the command line, using the placeholder +of PROJECT that will be replaced by the actual deliverable name. It then +iterates through a set of deliverables and shows any commits to the relevant +repos that have not been included in a release yet. You are then able to +decide whether it needs to be released and select the release type +(major, minor, bugfix, rc, etc.) based on the included commits. + +This can be used in conjunction with the ``list-deliverables`` command to get +the specific deliverables to process. An example use would be:: + + ./tools/process_auto_releases.sh ussuri $(list-deliverables --unreleased --series ussuri) + +As an alternative, it may be useful to be able to edit the list of deliverables +before running the command. That can be done by something similar to:: + + tox -e venv -- list-deliverables --unreleased --series ussuri > deliverables.log + vi deliverables.log # edit contents as needed + ./tools/process_auto_releases.sh ussuri $(cat deliverables.log) + +Unlike make_missing_releases.sh, this script will create fresh temporary clones +of each repo to avoid stale information, and it will submit each new release +request as it goes. + tools/releases_note_links.sh ------------------------------ diff --git a/tools/process_auto_releases.sh b/tools/process_auto_releases.sh new file mode 100755 index 0000000000..8f044a2c05 --- /dev/null +++ b/tools/process_auto_releases.sh @@ -0,0 +1,150 @@ +#!/bin/bash +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# Semi-automates the process of creating release team initiated release +# requests. + +if [[ $# -lt 2 ]]; then + echo "Usage: $(basename $0) [...]" + echo "repo should be e.g. glance" + echo + echo "Example: $(basename $0) ussuri \$(list-deliverables --unreleased --series ussuri)" + echo "Example: $(basename $0) train \$(list-deliverables \\" + echo " --series train --cycle-based-no-trialing | grep -v tempest)" + echo "Example: $(basename $0) train \$(list-deliverables --series stein --cyle-based)" + exit 1 +fi + +series="$1" +shift +repos="$@" + +TOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +BASEDIR=$(dirname $TOOLSDIR) +source $TOOLSDIR/functions + +# Make sure no pager is configured so the output is not blocked +export PAGER= + +if [[ -z "$VIRTUAL_ENV" ]]; then + if [[ ! -d .tox/venv ]]; then + tox -e venv --notest + fi + source ./.tox/venv/bin/activate +fi + +# Set up a clean workspace so we make sure we always have the latest and clean +# files for processing. setup_temp_space defined $MYTMPDIR. +setup_temp_space 'make-auto-releases' +clone_repo "openstack/releases" +cd openstack/releases +git review -s > /dev/null + +# Set the branch name for this series +branch=$(series_to_branch "$series") + +# Prompt for global parameters to use for all releases +read -p "> Enter review topic to use: " topic +echo +echo "> Enter commit message template" +echo " The placeholder PROJECT will be replaced with the current project." +echo " (Press Ctrl-D when done.)" +echo +echo "------------------------------------------------------------------------" +commit=$( Create stable branch? [y/N]: " YN +if [ "${YN,,}" == "y" ]; then + newbranch="--stable-branch" +fi + +echo +echo "======================================" +echo "Confirm details:" +echo "======================================" +echo "Topic: $topic" +echo "Series: $series" +echo "Branch: $branch" +echo "New Branch: $newbranch" +echo "Commit Message Template:" +echo +echo "------------------------------------------------------------------------" +echo "${commit//PROJECT/example-project}" +echo "------------------------------------------------------------------------" +echo +echo "======================================" +read -p "Continue with processing? [y/N]: " YN +if [ "${YN,,}" != "y" ]; then + exit 1 +fi + +function process_repo { + repo=$1 + title "Unreleased changes in $repo ($series)" + cd "$MYTMPDIR" + clone_repo "openstack/$repo" $branch + if [[ $? -ne 0 ]]; then + return 1 + fi + cd "openstack/$repo" + prev_tag=$(get_last_tag) + if [ -z "$prev_tag" ]; then + echo "$repo has not yet been released" + else + echo + end_sha=$(git log -n 1 --pretty=tformat:%h) + echo "Changes between $prev_tag and $end_sha" + echo + git log --no-color --no-merges --format='%h %ci %s' \ + --graph ${prev_tag}..${end_sha} + echo + fi + + read -p "Create new release? [y/N]: " YN + case $YN in + [Yy]* ) RELEASE="y";; + * ) + echo "Skipping $repo release..." + return + ;; + esac + + echo + echo "Releasing $repo" + echo "====================" + cd ../releases + echo "Select appropriate release type:" + select type in bugfix feature major milestone rc + do + new-release $series $repo $type $newbranch + break + done + git add . + message=${commit//PROJECT/$repo} + git commit -s -m "$message" + git log -1 + git review -t $topic + git reset --hard HEAD~1 > /dev/null + + cd ../.. + echo +} + +# Process each repo passed in to see if a release should be proposed +for repo in $repos; do + cd $MYTMPDIR + echo + process_repo "${repo/openstack\//}" +done