project-config/jenkins/scripts/release-tools/release_from_yaml.sh
Thierry Carrez 3724b8dfb1 No longer specify announce list in tag message
Announce list used to be passed from the release YAML to
the announcement script using meta information in the tag.
Since we now enforce all announcements to go to the same
list, stop passing that information around.

Change-Id: I37f24fe4a716c9b64f241d7a45da8e8bce8b55c2
Depends-On: I604288d266cbe53ee4d9b8567331f94c3c684088
2016-11-16 17:02:30 +01:00

99 lines
3.0 KiB
Bash
Executable File

#!/bin/bash
#
# Script to release projects based on changes to the deliverables
# files in the openstack/releases repository.
#
# 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.
TOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $TOOLSDIR/functions
function usage {
echo "Usage: release_from_yaml.sh [(-m|--manual)] releases_repository [deliverable_files]"
echo " release_from_yaml.sh (-h|--help)"
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 -m ~/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
echo "ERROR: No releases_repository specified"
echo
usage
exit 1
fi
RELEASES_REPO="$1"
shift
DELIVERABLES="$@"
# Configure git to pull the notes where gerrit stores review history
# like who approved a patch.
cd $RELEASES_REPO
if ! git config --get remote.origin.fetch | grep -q refs/notes/review; then
git config --add remote.origin.fetch refs/notes/review:refs/notes/review
git config --add core.notesRef refs/notes/review
git remote update origin
fi
# Look for metadata about the release instructions to include in the
# tag message.
if git show --no-patch --pretty=format:%P | grep -q ' '; then
# multiple parents, look at the submitted patch instead of the
# merge commit
parent=$(git show --no-patch --pretty=format:%P | cut -f2 -d' ')
else
# single parent, look at the current patch
parent=''
fi
RELEASE_META=$(git show --format=full --show-notes=review $parent | egrep -i '(Author|Commit:|Code-Review|Workflow|Change-Id)' | sed -e 's/^ //g' -e 's/^/meta:release:/g')
$TOOLSDIR/list_deliverable_changes.py -r $RELEASES_REPO $DELIVERABLES \
| while read deliverable series version diff_start repo hash pypi first_full; do
echo "$deliverable $series $version $diff_start $repo $hash $pypi $first_full"
$TOOLSDIR/release.sh $repo $series $version $diff_start $hash $pypi $first_full "$RELEASE_META"
done
exit 0