Use AFS mirrors in upgrades jobs

Configure repositories before upgrade with AFS mirrors if available

Change-Id: I12aed329bc85d50a6c632ef09ab3d34ae9bf8297
This commit is contained in:
Sagi Shnaidman 2017-09-07 20:17:44 +03:00
parent 61a1b46f68
commit 5d3c2b82ff
2 changed files with 187 additions and 36 deletions

View File

@ -4,28 +4,104 @@ parameter_defaults:
pushd /etc/yum.repos.d/
rm -rf delorean*
{% if target_upgrade_version == 'master' %}
REPO_PREFIX=/etc/yum.repos.d
DELOREAN_REPO_URL=https://trunk.rdoproject.org/centos7/current-tripleo
DELOREAN_REPO_FILE=delorean.repo
sudo yum clean all;
sudo yum-config-manager --disable "*"
sudo rm -rf /etc/yum.repos.d/delorean*;
sudo rm -rf /etc/yum.repos.d/*.rpmsave;
if [ -e /etc/ci/mirror_info.sh ]; then
source /etc/ci/mirror_info.sh
else
# Otherwise, fallback to official mirrors provided by CentOS.
export NODEPOOL_CENTOS_MIRROR=http://mirror.centos.org/centos
export NODEPOOL_BUILDLOGS_CENTOS_PROXY=https://buildlogs.centos.org
export NODEPOOL_RDO_PROXY=https://trunk.rdoproject.org
fi
rdo_dlrn=`curl --silent ${NODEPOOL_RDO_PROXY}/centos7/current/delorean.repo | grep baseurl | cut -d= -f2`
tripleo_dlrn=`curl --silent ${NODEPOOL_RDO_PROXY}/centos7/current-tripleo/delorean.repo | grep baseurl | cut -d= -f2`
if [[ -z "$rdo_dlrn" || -z "$tripleo_dlrn" ]]; then
echo "Failed to parse dlrn hash"
exit 1
fi
export RDO_DLRN_REPO=${rdo_dlrn/https:\/\/trunk.rdoproject.org/$NODEPOOL_RDO_PROXY}
export TRIPLEO_DLRN_REPO=${tripleo_dlrn/https:\/\/trunk.rdoproject.org/$NODEPOOL_RDO_PROXY}
sudo curl -Lvo $REPO_PREFIX/delorean-deps.repo https://trunk.rdoproject.org/centos7/delorean-deps.repo
sudo sed -i -e 's%priority=.*%priority=30%' $REPO_PREFIX/delorean-deps.repo
cat $REPO_PREFIX/delorean-deps.repo
cat<<EOF >delorean.repo
[delorean]
name=delorean
baseurl=$TRIPLEO_DLRN_REPO
priority=20
gpgcheck=0
enabled=1
EOF
# Enable last known good RDO Trunk Delorean repository
sudo curl -Lvo $REPO_PREFIX/delorean.repo $DELOREAN_REPO_URL/$DELOREAN_REPO_FILE
sudo sed -i -e 's%priority=.*%priority=20%' $REPO_PREFIX/delorean.repo
cat $REPO_PREFIX/delorean.repo
cat<<EOF >delorean-current.repo
[delorean-current]
name=delorean-current
baseurl=$RDO_DLRN_REPO
gpgcheck=0
enabled=1
priority=10
includepkgs=diskimage-builder,instack,instack-undercloud,os-apply-config,os-collect-config,os-net-config,os-refresh-config,python-tripleoclient,openstack-puppet-modules,openstack-tripleo-*,puppet-*
EOF
# Enable latest RDO Trunk Delorean repository
sudo curl -Lvo $REPO_PREFIX/delorean-current.repo https://trunk.rdoproject.org/centos7/current/delorean.repo
sudo sed -i -e 's%priority=.*%priority=10%' $REPO_PREFIX/delorean-current.repo
sudo sed -i 's/\[delorean\]/\[delorean-current\]/' $REPO_PREFIX/delorean-current.repo
sudo /bin/bash -c "cat <<-EOF>>$REPO_PREFIX/delorean-current.repo
cat<<EOF >delorean-pike-testing.repo
[delorean-pike-testing]
name=delorean-pike-testing
baseurl=${NODEPOOL_BUILDLOGS_CENTOS_PROXY}/centos/7/cloud/x86_64/openstack-pike/
gpgcheck=0
enabled=1
priority=30
EOF
includepkgs=diskimage-builder,instack,instack-undercloud,os-apply-config,os-collect-config,os-net-config,os-refresh-config,python-tripleoclient,openstack-tripleo-common*,openstack-tripleo-heat-templates,openstack-tripleo-image-elements,openstack-tripleo,openstack-tripleo-puppet-elements,openstack-puppet-modules,openstack-tripleo-ui,puppet-*
EOF"
cat $REPO_PREFIX/delorean-current.repo
cat<<EOF >quickstart-centos-updates.repo
[quickstart-centos-updates]
name=quickstart-centos-updates
baseurl=${NODEPOOL_CENTOS_MIRROR}/7/updates/x86_64/
gpgcheck=0
enabled=1
EOF
cat<<EOF >quickstart-centos-extras.repo
[quickstart-centos-extras]
name=quickstart-centos-extras
baseurl=${NODEPOOL_CENTOS_MIRROR}/7/extras/x86_64/
gpgcheck=0
enabled=1
EOF
cat<<EOF >quickstart-centos-qemu.repo
[quickstart-centos-qemu]
name=quickstart-centos-qemu
baseurl=${NODEPOOL_CENTOS_MIRROR}/7/virt/x86_64/kvm-common/
gpgcheck=0
enabled=1
EOF
cat<<EOF >quickstart-centos-ceph-jewel.repo
[quickstart-centos-ceph-jewel]
name=quickstart-centos-ceph-jewel
baseurl=${NODEPOOL_CENTOS_MIRROR}/7/storage/x86_64/ceph-jewel/
gpgcheck=0
enabled=1
EOF
cat<<EOF >quickstart-centos-opstools.repo
[quickstart-centos-opstools]
name=quickstart-centos-opstools
baseurl=${NODEPOOL_CENTOS_MIRROR}/7/opstools/x86_64/
gpgcheck=0
enabled=1
EOF
sudo yum install -y yum-plugin-priorities;
sudo yum-config-manager --save --setopt centos-opstools.enable=0;
sudo yum-config-manager --disable rdo-qemu-ev;
sudo rpm -e epel-release || true;
sudo yum remove -y rdo-release centos-release-openstack-* || true;
sudo rm -rf /etc/yum.repos.d/CentOS-OpenStack-*.repo /etc/yum.repos.d/CentOS-QEMU-EV.repo;
sudo rm -rf /etc/yum.repos.d/*.rpmsave;
sudo yum repolist;
{% endif %}
popd
yum clean all

View File

@ -3,28 +3,103 @@ set -e
pushd /etc/yum.repos.d/
rm -rf delorean*
{% if target_upgrade_version == 'master' %}
REPO_PREFIX=/etc/yum.repos.d
DELOREAN_REPO_URL=https://trunk.rdoproject.org/centos7/current-tripleo
DELOREAN_REPO_FILE=delorean.repo
sudo curl -Lvo $REPO_PREFIX/delorean-deps.repo https://trunk.rdoproject.org/centos7/delorean-deps.repo
sudo sed -i -e 's%priority=.*%priority=30%' $REPO_PREFIX/delorean-deps.repo
cat $REPO_PREFIX/delorean-deps.repo
sudo yum clean all;
sudo yum-config-manager --disable "*"
sudo rm -rf /etc/yum.repos.d/delorean*;
sudo rm -rf /etc/yum.repos.d/*.rpmsave;
if [ -e /etc/ci/mirror_info.sh ]; then
source /etc/ci/mirror_info.sh
else
# Otherwise, fallback to official mirrors provided by CentOS.
export NODEPOOL_CENTOS_MIRROR=http://mirror.centos.org/centos
export NODEPOOL_BUILDLOGS_CENTOS_PROXY=https://buildlogs.centos.org
export NODEPOOL_RDO_PROXY=https://trunk.rdoproject.org
fi
rdo_dlrn=`curl --silent ${NODEPOOL_RDO_PROXY}/centos7/current/delorean.repo | grep baseurl | cut -d= -f2`
tripleo_dlrn=`curl --silent ${NODEPOOL_RDO_PROXY}/centos7/current-tripleo/delorean.repo | grep baseurl | cut -d= -f2`
if [[ -z "$rdo_dlrn" || -z "$tripleo_dlrn" ]]; then
echo "Failed to parse dlrn hash"
exit 1
fi
export RDO_DLRN_REPO=${rdo_dlrn/https:\/\/trunk.rdoproject.org/$NODEPOOL_RDO_PROXY}
export TRIPLEO_DLRN_REPO=${tripleo_dlrn/https:\/\/trunk.rdoproject.org/$NODEPOOL_RDO_PROXY}
# Enable last known good RDO Trunk Delorean repository
sudo curl -Lvo $REPO_PREFIX/delorean.repo $DELOREAN_REPO_URL/$DELOREAN_REPO_FILE
sudo sed -i -e 's%priority=.*%priority=20%' $REPO_PREFIX/delorean.repo
cat $REPO_PREFIX/delorean.repo
# Enable latest RDO Trunk Delorean repository
sudo curl -Lvo $REPO_PREFIX/delorean-current.repo https://trunk.rdoproject.org/centos7/current/delorean.repo
sudo sed -i -e 's%priority=.*%priority=10%' $REPO_PREFIX/delorean-current.repo
sudo sed -i 's/\[delorean\]/\[delorean-current\]/' $REPO_PREFIX/delorean-current.repo
sudo /bin/bash -c "cat <<-EOF>>$REPO_PREFIX/delorean-current.repo
cat<<EOF >delorean.repo
[delorean]
name=delorean
baseurl=$TRIPLEO_DLRN_REPO
gpgcheck=0
enabled=1
EOF
cat<<EOF >delorean-current.repo
[delorean-current]
name=delorean-current
baseurl=$RDO_DLRN_REPO
gpgcheck=0
enabled=1
priority=10
includepkgs=diskimage-builder,instack,instack-undercloud,os-apply-config,os-collect-config,os-net-config,os-refresh-config,python-tripleoclient,openstack-tripleo-common*,openstack-tripleo-heat-templates,openstack-tripleo-image-elements,openstack-tripleo,openstack-tripleo-puppet-elements,openstack-puppet-modules,openstack-tripleo-ui,puppet-*
EOF"
cat $REPO_PREFIX/delorean-current.repo
EOF
cat<<EOF >delorean-pike-testing.repo
[delorean-pike-testing]
name=delorean-pike-testing
baseurl=${NODEPOOL_BUILDLOGS_CENTOS_PROXY}/centos/7/cloud/x86_64/openstack-pike/
gpgcheck=0
enabled=1
priority=30
EOF
cat<<EOF >quickstart-centos-updates.repo
[quickstart-centos-updates]
name=quickstart-centos-updates
baseurl=${NODEPOOL_CENTOS_MIRROR}/7/updates/x86_64/
gpgcheck=0
enabled=1
EOF
cat<<EOF >quickstart-centos-extras.repo
[quickstart-centos-extras]
name=quickstart-centos-extras
baseurl=${NODEPOOL_CENTOS_MIRROR}/7/extras/x86_64/
gpgcheck=0
enabled=1
EOF
cat<<EOF >quickstart-centos-qemu.repo
[quickstart-centos-qemu]
name=quickstart-centos-qemu
baseurl=${NODEPOOL_CENTOS_MIRROR}/7/virt/x86_64/kvm-common/
gpgcheck=0
enabled=1
EOF
cat<<EOF >quickstart-centos-ceph-jewel.repo
[quickstart-centos-ceph-jewel]
name=quickstart-centos-ceph-jewel
baseurl=${NODEPOOL_CENTOS_MIRROR}/7/storage/x86_64/ceph-jewel/
gpgcheck=0
enabled=1
EOF
cat<<EOF >quickstart-centos-opstools.repo
[quickstart-centos-opstools]
name=quickstart-centos-opstools
baseurl=${NODEPOOL_CENTOS_MIRROR}/7/opstools/x86_64/
gpgcheck=0
enabled=1
EOF
sudo yum install -y yum-plugin-priorities;
sudo yum-config-manager --save --setopt centos-opstools.enable=0;
sudo yum-config-manager --disable rdo-qemu-ev;
sudo rpm -e epel-release || true;
sudo yum remove -y rdo-release centos-release-openstack-* || true;
sudo rm -rf /etc/yum.repos.d/CentOS-OpenStack-*.repo /etc/yum.repos.d/CentOS-QEMU-EV.repo;
sudo rm -rf /etc/yum.repos.d/*.rpmsave;
sudo yum repolist;
{% endif %}
popd
yum clean all