provide a manual override mode

Add a command line flag to turn on "manual" mode and disable "bot" mode
for when we need to run the script by hand.

Change-Id: I63d576dc77aecb6cc26d3f8eacf4f3b90527eadf
This commit is contained in:
Doug Hellmann 2016-07-26 10:08:13 -04:00
parent 881f3cc666
commit 65634a78af

View File

@ -17,19 +17,46 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
set -ex
TOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" TOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $TOOLSDIR/functions source $TOOLSDIR/functions
function usage { function usage {
echo "Usage: release_from_yaml.sh releases_repository [deliverable_files]" echo "Usage: release_from_yaml.sh [(-m|--manual)] releases_repository [deliverable_files]"
echo " release_from_yaml.sh (-h|--help)"
echo echo
echo "Example: release_from_yaml.sh -m ~/repos/openstack/releases"
echo "Example: release_from_yaml.sh ~/repos/openstack/releases" echo "Example: release_from_yaml.sh ~/repos/openstack/releases"
echo "Example: release_from_yaml.sh ~/repos/openstack/releases" echo "Example: release_from_yaml.sh -m ~/repos/openstack/releases deliverables/mitaka/oslo.config.yaml"
echo "Example: release_from_yaml.sh ~/repos/openstack/releases deliverables/mitaka/oslo.config.yaml"
} }
OPTS=$(getopt -o hm --long manual,help -n $0 -- "$@")
if [ $? != 0 ] ; then
echo "Failed parsing options." >&2
usage
exit 1
fi
eval set -- "$OPTS"
set -ex
BOT_RUNNING=true
while true; do
case "$1" in
-h|--help)
usage
exit 0
;;
-m|--manual)
BOT_RUNNING=false
shift
;;
--)
shift
break
;;
esac
done
if [ $# -lt 1 ]; then if [ $# -lt 1 ]; then
echo "ERROR: No releases_repository specified" echo "ERROR: No releases_repository specified"
echo echo
@ -70,9 +97,11 @@ $TOOLSDIR/list_deliverable_changes.py -r $RELEASES_REPO $DELIVERABLES \
# repository. When we're confident that it is working correctly, # repository. When we're confident that it is working correctly,
# we can remove this block and apply it to all repositories. # we can remove this block and apply it to all repositories.
if [ "$repo" != "openstack/release-test" ]; then if [ "$repo" != "openstack/release-test" ]; then
if $BOT_RUNNING; then
echo "SKIPPING during testing phase" echo "SKIPPING during testing phase"
continue continue
fi fi
fi
$TOOLSDIR/release.sh $repo $series $version $hash $announce_to $pypi $first_full "$RELEASE_META" $TOOLSDIR/release.sh $repo $series $version $hash $announce_to $pypi $first_full "$RELEASE_META"
done done