2014-09-04 11:12:19 -07:00
|
|
|
#!/bin/bash -xe
|
|
|
|
|
|
|
|
# Copyright (C) 2014 Hewlett-Packard Development Company, L.P.
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
|
|
|
source /etc/nodepool/provider
|
|
|
|
|
2016-01-13 11:15:49 -08:00
|
|
|
# Generate the AFS Slug from the host system.
|
|
|
|
source /usr/local/jenkins/slave_scripts/afs-slug.sh
|
|
|
|
|
2015-10-22 20:08:38 -07:00
|
|
|
NODEPOOL_MIRROR_HOST=${NODEPOOL_MIRROR_HOST:-mirror.$NODEPOOL_REGION.$NODEPOOL_CLOUD.openstack.org}
|
2016-01-29 13:16:22 -08:00
|
|
|
NODEPOOL_MIRROR_HOST=$(echo $NODEPOOL_MIRROR_HOST|tr '[:upper:]' '[:lower:]')
|
2016-01-29 07:27:39 -08:00
|
|
|
NODEPOOL_PYPI_MIRROR=${NODEPOOL_PYPI_MIRROR:-http://$NODEPOOL_MIRROR_HOST/pypi/simple}
|
2016-01-13 11:15:49 -08:00
|
|
|
NODEPOOL_WHEEL_MIRROR=${NODEPOOL_WHEEL_MIRROR:-http://$NODEPOOL_MIRROR_HOST/wheel/$AFS_SLUG}
|
2016-02-06 14:29:41 -06:00
|
|
|
NODEPOOL_UBUNTU_MIRROR=${NODEPOOL_UBUNTU_MIRROR:-http://$NODEPOOL_MIRROR_HOST/ubuntu}
|
2016-04-15 20:25:23 -04:00
|
|
|
NODEPOOL_CEPH_MIRROR=${NODEPOOL_CEPH_MIRROR:-http://$NODEPOOL_MIRROR_HOST/ceph-deb-hammer}
|
2016-01-28 07:58:38 -08:00
|
|
|
|
2016-01-28 15:56:21 -08:00
|
|
|
cat >/tmp/pip.conf <<EOF
|
2016-01-28 07:58:38 -08:00
|
|
|
[global]
|
|
|
|
timeout = 60
|
|
|
|
index-url = $NODEPOOL_PYPI_MIRROR
|
2016-01-29 10:01:09 -08:00
|
|
|
trusted-host = $NODEPOOL_MIRROR_HOST
|
2016-01-13 11:15:49 -08:00
|
|
|
extra-index-url = $NODEPOOL_WHEEL_MIRROR
|
2016-01-28 07:58:38 -08:00
|
|
|
EOF
|
2016-01-28 15:56:21 -08:00
|
|
|
sudo mv /tmp/pip.conf /etc/pip.conf
|
2014-09-04 11:12:19 -07:00
|
|
|
|
|
|
|
cat >/home/jenkins/.pydistutils.cfg <<EOF
|
|
|
|
[easy_install]
|
2014-10-29 22:27:05 +01:00
|
|
|
index_url = $NODEPOOL_PYPI_MIRROR
|
2015-06-02 10:48:27 -07:00
|
|
|
allow_hosts = *.openstack.org
|
2014-09-04 11:12:19 -07:00
|
|
|
EOF
|
2014-10-31 08:13:09 -07:00
|
|
|
|
|
|
|
# Double check that when the node is made ready it is able
|
|
|
|
# to resolve names against DNS.
|
|
|
|
host git.openstack.org
|
2016-01-28 07:58:38 -08:00
|
|
|
host $NODEPOOL_MIRROR_HOST
|
2015-04-28 08:15:46 -04:00
|
|
|
|
|
|
|
LSBDISTID=$(lsb_release -is)
|
|
|
|
LSBDISTCODENAME=$(lsb_release -cs)
|
2016-05-05 15:31:37 -04:00
|
|
|
# NOTE(pabelanger): We don't actually have mirrors for ubuntu-precise, so skip
|
|
|
|
# them.
|
|
|
|
if [ "$LSBDISTID" == "Ubuntu" ] && [ "$LSBDISTCODENAME" != 'precise' ]; then
|
2016-04-14 10:19:21 -04:00
|
|
|
# NOTE(pabelanger): We only have a xenial mirror ATM because reprepro cannot
|
|
|
|
# mirror repositories with 0 packages. Once our reprepro mirrors is 100% we
|
2016-04-27 10:16:14 -05:00
|
|
|
# can remove this logic check. We are only missing -backports on the mirrors
|
2016-04-14 10:19:21 -04:00
|
|
|
if [ "$LSBDISTCODENAME" == "xenial" ] ; then
|
|
|
|
sudo dd of=/etc/apt/sources.list <<EOF
|
|
|
|
deb $NODEPOOL_UBUNTU_MIRROR $LSBDISTCODENAME main universe
|
2016-04-27 10:16:14 -05:00
|
|
|
deb $NODEPOOL_UBUNTU_MIRROR $LSBDISTCODENAME-updates main universe
|
|
|
|
deb $NODEPOOL_UBUNTU_MIRROR $LSBDISTCODENAME-security main universe
|
2016-04-14 10:19:21 -04:00
|
|
|
EOF
|
|
|
|
else
|
|
|
|
sudo dd of=/etc/apt/sources.list <<EOF
|
2016-02-06 14:29:41 -06:00
|
|
|
deb $NODEPOOL_UBUNTU_MIRROR $LSBDISTCODENAME main universe
|
|
|
|
deb $NODEPOOL_UBUNTU_MIRROR $LSBDISTCODENAME-updates main universe
|
|
|
|
deb $NODEPOOL_UBUNTU_MIRROR $LSBDISTCODENAME-backports main universe
|
|
|
|
deb $NODEPOOL_UBUNTU_MIRROR $LSBDISTCODENAME-security main universe
|
2016-04-15 20:25:23 -04:00
|
|
|
EOF
|
2016-05-03 12:36:04 -04:00
|
|
|
fi
|
|
|
|
sudo dd of=/etc/apt/sources.list.d/ceph-deb-hammer.list <<EOF
|
2016-04-15 20:25:23 -04:00
|
|
|
deb $NODEPOOL_CEPH_MIRROR $LSBDISTCODENAME main
|
2016-02-06 14:29:41 -06:00
|
|
|
EOF
|
2016-05-03 12:36:04 -04:00
|
|
|
|
2016-02-12 09:41:40 -06:00
|
|
|
if [ "$LSBDISTCODENAME" != 'precise' ] ; then
|
|
|
|
# Turn off multi-arch
|
|
|
|
sudo dpkg --remove-architecture i386
|
|
|
|
fi
|
2016-02-06 14:29:41 -06:00
|
|
|
# Turn off checking of GPG signatures
|
|
|
|
sudo dd of=/etc/apt/apt.conf.d/99unauthenticated <<EOF
|
|
|
|
APT::Get::AllowUnauthenticated "true";
|
2015-04-28 08:15:46 -04:00
|
|
|
EOF
|
2016-01-07 19:05:48 +08:00
|
|
|
elif [ "$LSBDISTID" == "Debian" ] ; then
|
|
|
|
sudo dd of=/etc/apt/sources.list <<EOF
|
|
|
|
deb http://httpredir.debian.org/debian $LSBDISTCODENAME main
|
|
|
|
deb-src http://httpredir.debian.org/debian $LSBDISTCODENAME main
|
|
|
|
|
|
|
|
deb http://httpredir.debian.org/debian $LSBDISTCODENAME-updates main
|
|
|
|
deb-src http://httpredir.debian.org/debian $LSBDISTCODENAME-updates main
|
|
|
|
|
|
|
|
deb http://security.debian.org/ $LSBDISTCODENAME/updates main
|
|
|
|
deb-src http://security.debian.org/ $LSBDISTCODENAME/updates main
|
|
|
|
|
|
|
|
deb http://httpredir.debian.org/debian $LSBDISTCODENAME-backports main
|
|
|
|
deb-src http://httpredir.debian.org/debian $LSBDISTCODENAME-backports main
|
|
|
|
EOF
|
2015-04-28 08:15:46 -04:00
|
|
|
fi
|