77e537f868
This patch adds blank newline for each [yaml|sh] files if they don't end with one. This will allows us getting linters happy and avoid us having git adding "\ No newline at end of file" in diffs when pushing a new patch. In other way, you can configure Git to properly handle line endings in typing: $ git config --global core.autocrlf input Change-Id: I8a113541b3eae6a36ed32995822dedbbd2d9666e Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
184 lines
4.9 KiB
Bash
Executable File
184 lines
4.9 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
: ${GATE:=1}
|
|
: ${WORKSPACE:=$HOME/.quickstart}
|
|
: ${RELEASE:=master-tripleo-ci}
|
|
: ${CONFIG:=minimal}
|
|
: ${BUILD_SYS:=delorean}
|
|
|
|
interactive=0
|
|
reproducer_type=gerrit
|
|
|
|
|
|
usage () {
|
|
echo "Usage: $0 [options] virthost"
|
|
echo ""
|
|
echo "Options:"
|
|
echo " -c, --config <type>"
|
|
echo " specify the node configuration (default=$CONFIG)"
|
|
echo " -n, --no-gate do not ask for gating a commit when gating"
|
|
echo " variables are missing (default is gating)"
|
|
echo " -w, --working-dir <dir>"
|
|
echo " directory where the virtualenv, inventory files, etc."
|
|
echo " are created (default=$WORKSPACE)"
|
|
echo " -h, --help print this help and exit"
|
|
echo " virthost target machine used for deployment, required argument"
|
|
}
|
|
|
|
|
|
zuul-gate () {
|
|
if [[ -z "$ZUUL_HOST" ]]; then
|
|
interactive=1
|
|
echo "Which Zuul host to use? (default=review.openstack.org)"
|
|
read -p "ZUUL_HOST=" ZUUL_HOST
|
|
ZUUL_HOST=${ZUUL_HOST:-"review.openstack.org"}
|
|
echo ""
|
|
fi
|
|
ZUUL_HOST=${ZUUL_HOST:-"review.openstack.org"}
|
|
if [[ -z "$ZUUL_CHANGES" ]]; then
|
|
interactive=1
|
|
echo "Specify ZUUL_CHANGES variable from logs/reproduce.sh"
|
|
read -p "ZUUL_CHANGES=" ZUUL_CHANGES
|
|
echo ""
|
|
fi
|
|
export ZUUL_{HOST,CHANGES}
|
|
}
|
|
|
|
gerrit-gate () {
|
|
if [[ -z "$GERRIT_HOST" ]]; then
|
|
interactive=1
|
|
echo "Which Gerrit host to use? (default=review.openstack.org)"
|
|
read -p "GERRIT_HOST=" GERRIT_HOST
|
|
GERRIT_HOST=${GERRIT_HOST:-"review.openstack.org"}
|
|
echo ""
|
|
fi
|
|
if [[ -z "$GERRIT_BRANCH" ]]; then
|
|
interactive=1
|
|
echo "Which branch is the patch on? (default=master)"
|
|
read -p "GERRIT_BRANCH=" GERRIT_BRANCH
|
|
GERRIT_BRANCH=${GERRIT_BRANCH:-master}
|
|
echo ""
|
|
fi
|
|
if [[ -z "$GERRIT_CHANGE_ID" ]]; then
|
|
interactive=1
|
|
echo "What is the Change-Id? Can be found in the commit message."
|
|
echo "Note: all \"Depends-On:\" changes are going to be built as well."
|
|
read -p "GERRIT_CHANGE_ID=" GERRIT_CHANGE_ID
|
|
echo ""
|
|
fi
|
|
if [[ -z "$GERRIT_PATCHSET_REVISION" ]]; then
|
|
interactive=1
|
|
echo "What is the git commit hash of the patchset?"
|
|
echo "It can be found in the Commit field on Gerrit"
|
|
read -p "GERRIT_PATCHSET_REVISION=" GERRIT_PATCHSET_REVISION
|
|
echo ""
|
|
fi
|
|
export GERRIT_{HOST,BRANCH,CHANGE_ID,PATCHSET_REVISION}
|
|
}
|
|
|
|
interactive-gate () {
|
|
if [[ -n "$ZUUL_HOST" ]]; then
|
|
reproducer_type=zuul
|
|
fi
|
|
if [[ -z "$ZUUL_HOST" && -z "$GERRIT_HOST" ]]; then
|
|
interactive=1
|
|
echo "Do you want to reproduce an environment from an upstream CI Zuul job"
|
|
echo "or use a Gerrit change? (default=gerrit)"
|
|
read -p "[zuul/GERRIT] " reproducer_type
|
|
echo ""
|
|
fi
|
|
if [[ $reproducer_type = 'zuul' ]]; then
|
|
zuul-gate
|
|
else
|
|
gerrit-gate
|
|
fi
|
|
if [[ "$interactive" = "1" ]]; then
|
|
echo "Check if these values are correct:"
|
|
else
|
|
echo "Running with the following variables:"
|
|
fi
|
|
echo ""
|
|
if [[ $reproducer_type = 'zuul' ]]; then
|
|
echo "ZUUL_HOST=$ZUUL_HOST"
|
|
echo "ZUUL_CHANGES=$ZUUL_CHANGES"
|
|
echo "export ZUUL_{HOST,CHANGES}"
|
|
else
|
|
echo "GERRIT_HOST=$GERRIT_HOST"
|
|
echo "GERRIT_BRANCH=$GERRIT_BRANCH"
|
|
echo "GERRIT_CHANGE_ID=$GERRIT_CHANGE_ID"
|
|
echo "GERRIT_PATCHSET_REVISION=$GERRIT_PATCHSET_REVISION"
|
|
echo "export GERRIT_{HOST,BRANCH,CHANGE_ID,PATCHSET_REVISION}"
|
|
fi
|
|
echo ""
|
|
if [[ "$interactive" = "1" ]]; then
|
|
echo "Note: You can re-run this script non-interactively by pasting"
|
|
echo "the lines above to the console before rerunning the script."
|
|
echo "Hit ENTER to continue, or CTRL-C to exit"
|
|
read
|
|
fi
|
|
}
|
|
|
|
while [ "x$1" != "x" ]; do
|
|
|
|
case "$1" in
|
|
--working-dir|-w)
|
|
WORKSPACE=$(realpath $2)
|
|
shift
|
|
;;
|
|
|
|
--config|-c)
|
|
CONFIG=$2
|
|
shift
|
|
;;
|
|
|
|
--no-gate|-n)
|
|
GATE=0
|
|
;;
|
|
|
|
--help|-h)
|
|
usage
|
|
exit
|
|
;;
|
|
|
|
--) shift
|
|
break
|
|
;;
|
|
|
|
-*) echo "ERROR: unknown option: $1" >&2
|
|
usage >&2
|
|
exit 2
|
|
;;
|
|
|
|
*) break
|
|
;;
|
|
esac
|
|
|
|
shift
|
|
done
|
|
|
|
pushd $(dirname ${BASH_SOURCE[0]:-$0})
|
|
|
|
# variables needed for the CI script
|
|
export VIRTHOST=$1
|
|
export WORKSPACE
|
|
|
|
if [[ -z $VIRTHOST ]]; then
|
|
usage
|
|
echo ""
|
|
echo "Specify the virthost to use. You need to be able to ssh as root without"
|
|
echo "password with your current user (i.e. ssh root@\$VIRTHOST must succeed)"
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$GATE" = "1" ]; then
|
|
interactive-gate
|
|
JOB_TYPE=dlrn-gate
|
|
else
|
|
JOB_TYPE=periodic
|
|
fi
|
|
|
|
bash ci-scripts/full-deploy.sh $RELEASE $BUILD_SYS $CONFIG $JOB_TYPE
|
|
|
|
popd
|
|
|