Merge "Add wrapper script that can be used to update deliverables"

This commit is contained in:
Zuul 2020-01-09 18:41:47 +00:00 committed by Gerrit Code Review
commit 2e99e0f951
1 changed files with 97 additions and 0 deletions

97
tools/make_missing_releases.sh Executable file
View File

@ -0,0 +1,97 @@
#!/usr/bin/env bash
#
# Wrapper script to locate run pre-defined queries and if needed create new releases
#
# All Rights Reserved.
#
# 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.
set -e
function usage {
echo "Usage: make_missing_releases.sh <series> <stage>"
echo
echo "Valid valules for stage are:"
echo " cwi-m) Used at the m{1,2,3} to run 'interactive release on"
echo " cycle-with-intermediary libraries"
echo
echo "Wrapper script to locate run pre-defined queries and if "\
"needed create new releases"
}
# Run a command but echo it first, kind of a light-weight set -x but avoids opencoding things
# and there for glogic errors
function v_run {
echo "$*"
"$@"
}
if [ $# -lt 2 ]; then
usage
exit 2
fi
# FIXME(tonyb): We *almost* have this in 'functions' update enable_tox_venv()
# and use that everywhere
if [[ -z "$VIRTUAL_ENV" ]]; then
if [[ ! -d .tox/venv ]]; then
tox -e venv --notest
fi
source ./.tox/venv/bin/activate
fi
stable_branch=''
interactive=''
series=$1
case "$2" in
# Used at the m{1,2,3} to run 'interactive release on
# cycle-with-intermediary libraries
cwi-m)
interactive='--interactive'
release_type='feature'
sieve='--model=cycle-with-intermediary --type=library'
;;
# m3)
# stable_branch='' # TODO: Should we create stable branches from these releases?
# release_type='feature' # TODO: Do we always want this to be a feature?
# sieve='--type=client-library'
# ;;
# rc)
# stable_branch='--stable-branch'
# release_type='rc'
# sieve='--model=cycle-with-rc'
# ;;
# final_check)
# stable_branch='--stable-branch'
# release_type='feature'
# sieve='--model=cycle-with-intermediary'
# ;;
*)
usage
exit 2
;;
esac
echo "Collecting deliverables for ${series}: ${sieve}"
declare -a deliverables=($(list-deliverables ${sieve} --unreleased --series ${series}))
processed=1
for deliverable in ${deliverables[@]} ; do
if [ -n "$interactive" ] ; then
clear
echo $(( ${#deliverables[@]} - $processed )) deliverables to go after this one
processed=$(( $processed + 1 ))
fi
v_run new-release $interactive $stable_branch $series $deliverable $release_type
done