Remove zuul-cloner usage

Depends-On: https://review.opendev.org/#/c/667439/
Change-Id: I6e11c12ad73c89466aefbb926c111ed1d00784b8
This commit is contained in:
Tobias Urdin 2019-06-26 12:52:35 +02:00
parent 0ee105807e
commit fff72afe75
5 changed files with 51 additions and 81 deletions

View File

@ -12,7 +12,7 @@ install_external() {
PUPPETFILE=${SCRIPT_DIR}/Puppetfile1 r10k -v DEBUG puppetfile install
}
# Install Puppet OpenStack modules with zuul-cloner
# Install Puppet OpenStack modules from zuul checkouts
# Uses the following variables:
#
# - ``PUPPETFILE_DIR`` must be set to Puppet modules directory
@ -31,20 +31,20 @@ install_openstack() {
fi
fi
cat > clonemap.yaml <<EOF
clonemap:
- name: '(.*?)/puppet-(.*)'
dest: '$PUPPETFILE_DIR/\2'
EOF
local project_names=$(awk '{ if ($1 == ":git") print $3 }' \
${SCRIPT_DIR}/Puppetfile0 | tr -d "'," | cut -d '/' -f 4- | xargs
)
project_names="${project_names} openstack/puppet-openstack-integration"
/usr/zuul-env/bin/zuul-cloner -m clonemap.yaml \
--cache-dir /opt/git \
--zuul-branch $ZUUL_BRANCH \
https://opendev.org $project_names
for project in $project_names openstack/puppet-openstack-integration
do
local module_name=$(echo $project | cut -d "-" -f2-)
if [ -d /home/zuul/src/opendev.org/$project ]; then
cp -R /home/zuul/src/opendev.org/$project $PUPPETFILE_DIR/$module_name
else
git clone -b $ZUUL_BRANCH https://opendev.org/$project $PUPPETFILE_DIR/$module_name
fi
done
# Because openstack-integration can't be a class name.
# https://projects.puppetlabs.com/issues/5268
@ -63,15 +63,14 @@ install_all() {
}
# Install Puppet OpenStack modules and dependencies by using
# zuul-cloner or r10k.
# zuul checkouts or r10k.
# Uses the following variables:
#
# - ``PUPPETFILE_DIR`` must be set to Puppet modules directory
# - ``SCRIPT_DIR`` must be set to script path
# - ``ZUUL_BRANCH`` must be set to Zuul branch
install_modules() {
# If zuul-cloner is there, have it install modules using zuul refs
if [ -e /usr/zuul-env/bin/zuul-cloner ] ; then
if [ -d /home/zuul/src/opendev.org ] ; then
csplit ${SCRIPT_DIR}/Puppetfile /'External modules'/ \
--prefix ${SCRIPT_DIR}/Puppetfile \
--suffix '%d'
@ -90,8 +89,7 @@ install_modules() {
# - ``SCRIPT_DIR`` must be set to script path
# - ``ZUUL_BRANCH`` must be set to Zuul branch
install_modules_unit() {
# If zuul-cloner is there, have it install modules using zuul refs
if [ -e /usr/zuul-env/bin/zuul-cloner ] ; then
if [ -d /home/zuul/src/opendev.org ] ; then
csplit ${SCRIPT_DIR}/Puppetfile /'External modules'/ \
--prefix ${SCRIPT_DIR}/Puppetfile \
--suffix '%d'

View File

@ -4,29 +4,18 @@
cmd: |
set -e
set -x
CLONEMAP=`mktemp`
function cleanup {
# In cases where zuul-cloner is aborted during a git
# clone operation, git will remove the git work tree in
# its cleanup. The work tree in these jobs is the
# workspace directory, which means that subsequent
# jenkins post-build actions can not run because the
# workspace has been removed.
# To reduce the likelihood of this having an impact,
# recreate the workspace directory if needed
mkdir -p $WORKSPACE
rm -f $CLONEMAP
}
trap cleanup EXIT
cat > $CLONEMAP << EOF
clonemap:
- name: $ZUUL_PROJECT
dest: .
- name: openstack/puppet-openstack-integration
dest: openstack/puppet-openstack-integration
EOF
/usr/zuul-env/bin/zuul-cloner -m $CLONEMAP --cache-dir /opt/git \
https://opendev.org $ZUUL_PROJECT openstack/puppet-openstack-integration
if [ -d /home/zuul/src/opendev.org/$ZUUL_PROJECT ]; then
cp -dR /home/zuul/src/opendev.org/$ZUUL_PROJECT/. .
else
git clone https://opendev.org/$ZUUL_PROJECT .
fi
if [ -d /home/zuul/src/opendev.org/openstack/puppet-openstack-integration ]; then
[ ! -d puppet-openstack-integration ] && mkdir puppet-openstack-integration
cp -dR /home/zuul/src/opendev.org/openstack/puppet-openstack-integration/. puppet-openstack-integration
else
git clone https://opendev.org/openstack/puppet-openstack-integration puppet-openstack-integration
fi
executable: /bin/bash
chdir: '{{ ansible_user_dir }}/workspace'
environment: '{{ zuul | zuul_legacy_vars }}'

View File

@ -12,20 +12,12 @@
if [[ "$ZUUL_BRANCH" == "stable/jewel" ]]; then
ZUUL_BRANCH_REAL='stable/pike'
fi
CLONEMAP=`mktemp`
function cleanup {
rm -f $CLONEMAP
}
trap cleanup EXIT
cat > $CLONEMAP << EOF
clonemap:
- name: openstack/puppet-openstack-integration
dest: puppet-openstack-integration
EOF
/usr/zuul-env/bin/zuul-cloner -m $CLONEMAP \
--cache-dir /opt/git \
--zuul-branch $ZUUL_BRANCH_REAL \
https://opendev.org openstack/puppet-openstack-integration
if [ -d /home/zuul/src/opendev.org/openstack/puppet-openstack-integration ]; then
[ ! -d puppet-openstack-integration ] && mkdir puppet-openstack-integration
cp -dR /home/zuul/src/opendev.org/openstack/puppet-openstack-integration/. puppet-openstack-integration
else
git clone -b $ZUUL_BRANCH_REAL https://opendev.org/openstack/puppet-openstack-integration puppet-openstack-integration
fi
executable: /bin/bash
chdir: '{{ ansible_user_dir }}/workspace'
environment: '{{ zuul | zuul_legacy_vars }}'

View File

@ -4,27 +4,11 @@
cmd: |
set -e
set -x
CLONEMAP=`mktemp`
function cleanup {
# In cases where zuul-cloner is aborted during a git
# clone operation, git will remove the git work tree in
# its cleanup. The work tree in these jobs is the
# workspace directory, which means that subsequent
# jenkins post-build actions can not run because the
# workspace has been removed.
# To reduce the likelihood of this having an impact,
# recreate the workspace directory if needed
mkdir -p $WORKSPACE
rm -f $CLONEMAP
}
trap cleanup EXIT
cat > $CLONEMAP << EOF
clonemap:
- name: $ZUUL_PROJECT
dest: .
EOF
/usr/zuul-env/bin/zuul-cloner -m $CLONEMAP --cache-dir /opt/git \
https://opendev.org $ZUUL_PROJECT
if [ -d /home/zuul/src/opendev.org/$ZUUL_PROJECT ]; then
cp -dR /home/zuul/src/opendev.org/$ZUUL_PROJECT/. .
else
git clone https://opendev.org/$ZUUL_PROJECT .
fi
executable: /bin/bash
chdir: '{{ ansible_user_dir }}/workspace'
environment: '{{ zuul | zuul_legacy_vars }}'

View File

@ -102,16 +102,23 @@ if [[ "${ZUUL_PROJECT}" = "openstack/tempest" ]]; then
TEMPEST_FROM_SOURCE=true
fi
if [ -e /usr/zuul-env/bin/zuul-cloner ] ; then
if [ -d /home/zuul/src/opendev.org ]; then
# For ubuntu we always need to deploy tempest-horizon from source
if uses_debs; then
/usr/zuul-env/bin/zuul-cloner --workspace /tmp --cache-dir /opt/git \
https://opendev.org openstack/tempest-horizon
if [ -d /home/zuul/src/opendev.org/openstack/tempest-horizon ]; then
[ ! -d /tmp/openstack ] && mkdir -p /tmp/openstack
cp -R /home/zuul/src/opendev.org/openstack/tempest-horizon /tmp/openstack/tempest-horizon
else
git clone https://opendev.org/openstack/tempest-horizon /tmp/openstack/tempest-horizon
fi
fi
if [ "${TEMPEST_FROM_SOURCE}" = true ]; then
/usr/zuul-env/bin/zuul-cloner --workspace /tmp --cache-dir /opt/git \
https://opendev.org openstack/tempest
if [ -d /home/zuul/src/opendev.org/openstack/tempest ]; then
[ ! -d /tmp/openstack ] && mkdir -p /tmp/openstack
cp -R /home/zuul/src/opendev.org/openstack/tempest /tmp/openstack/tempest
else
git clone https://opendev.org/openstack/tempest /tmp/openstack/tempest
fi
# Pin Tempest to TEMPEST_VERSION unless we're running inside the
# openstack/tempest gate.
if [[ "${ZUUL_PROJECT}" != "openstack/tempest" ]]; then