puppet-openstack-integration/configure_facts.sh
yatinkarel b44d0bdd5a Add CentOS8 support and jobs
- scenario001 and 004 will be running without ceph
  until ceph repos get available for CentOS8
- scenario003 will run not run with linuxbridge until next CentOS
  minor version as it has issues:-
    - https://bugzilla.redhat.com/show_bug.cgi?id=1720637
- Add Puppetfile_centos7 to have different puppet modules
  as compared to other distros. Currently only puppet-mysql
  needs to be kept pinned for centos7 as newere mariadb version
  is required to remove the pin, CentOS8 and ubuntu have required
  mariadb version so pin is removed. So automatic updates of puppet
  modules will not be applied for CentOS7 as those jobs are going to
  be removed in coming months.
- check for rdo_dlrn url existence only for RedHat distros.

Change-Id: I98fc088cd87c1412544f9590ce7a925b413297e2
2019-12-20 10:18:18 +00:00

96 lines
3.9 KiB
Bash

#!/bin/bash -ex
# Copyright 2017 Red Hat, Inc.
#
# 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/os-release
OS_NAME_VERS=${REDHAT_SUPPORT_PRODUCT}${REDHAT_SUPPORT_PRODUCT_VERSION}
# Write out facts to the facter folder when we generate them.
export WRITE_FACTS=${WRITE_FACTS:-true}
export DLRN_BASE=${DLRN_BASE:-${OS_NAME_VERS}-master/puppet-passed-ci}
export DLRN_DEPS_BASE=${DLRN_DEPS_BASE:-${OS_NAME_VERS}-master/deps/latest/}
export CEPH_VERSION=${CEPH_VERSION:-nautilus}
export SCRIPT_DIR=$(cd `dirname $0` && pwd -P)
source $SCRIPT_DIR/functions
if [ -f /etc/fedora-release ]; then
DLRN_BASE="fedora/puppet-passed-ci"
DLRN_DEPS_BASE="fedora/stable-base/latest/"
fi
if [ -f /etc/ci/mirror_info.sh ]; then
source /etc/ci/mirror_info.sh
CENTOS_MIRROR_HOST="http://${NODEPOOL_MIRROR_HOST}"
DEPS_MIRROR_HOST="${NODEPOOL_RDO_PROXY}/${DLRN_DEPS_BASE}/"
if uses_debs; then
CEPH_MIRROR_HOST="${CENTOS_MIRROR_HOST}/ceph-deb-${CEPH_VERSION}"
NODEPOOL_PUPPETLABS_MIRROR="http://${NODEPOOL_MIRROR_HOST}/apt-puppetlabs"
else
# NOTE(tobias-urdin): Mimic was never released by Storage SIG to official mirros so we use CBS.
if [ "$CEPH_VERSION" == "mimic" ]; then
CEPH_MIRROR_HOST='http://cbs.centos.org/repos/storage7-ceph-mimic-release/x86_64/os/'
else
CEPH_MIRROR_HOST="${CENTOS_MIRROR_HOST}/centos/7/storage/x86_64/ceph-${CEPH_VERSION}/"
fi
NODEPOOL_PUPPETLABS_MIRROR="http://${NODEPOOL_MIRROR_HOST}/yum-puppetlabs"
fi
else
CENTOS_MIRROR_HOST='http://mirror.centos.org'
DEPS_MIRROR_HOST="https://trunk.rdoproject.org/${DLRN_DEPS_BASE}/"
NODEPOOL_RDO_PROXY='https://trunk.rdoproject.org'
NODEPOOL_UCA_MIRROR='http://ubuntu-cloud.archive.canonical.com/ubuntu'
if uses_debs; then
CEPH_MIRROR_HOST="https://download.ceph.com/debian-${CEPH_VERSION}"
NODEPOOL_PUPPETLABS_MIRROR='https://apt.puppetlabs.com'
else
# NOTE(tobias-urdin): Mimic was never released by Storage SIG to official mirros so we use CBS.
if [ "$CEPH_VERSION" == "mimic" ]; then
CEPH_MIRROR_HOST='http://cbs.centos.org/repos/storage7-ceph-mimic-release/x86_64/os/'
else
CEPH_MIRROR_HOST="${CENTOS_MIRROR_HOST}/centos/7/storage/x86_64/ceph-${CEPH_VERSION}/"
fi
NODEPOOL_PUPPETLABS_MIRROR="https://yum.puppetlabs.com"
fi
fi
rdo_dlrn=`curl --silent ${NODEPOOL_RDO_PROXY}/${DLRN_BASE}/delorean.repo | grep baseurl | cut -d= -f2`
if [[ -z "$rdo_dlrn" ]] && [ -f /etc/redhat-release ] ; then
echo "Failed to parse dlrn hash"
exit 1
fi
RDO_MIRROR_HOST=${rdo_dlrn/https:\/\/trunk.rdoproject.org/$NODEPOOL_RDO_PROXY}
export FACTER_nodepool_mirror_host=$NODEPOOL_MIRROR_HOST
export FACTER_centos_mirror_host=$CENTOS_MIRROR_HOST
export FACTER_uca_mirror_host=$NODEPOOL_UCA_MIRROR
export FACTER_deps_mirror_host=$DEPS_MIRROR_HOST
export FACTER_ceph_mirror_host=$CEPH_MIRROR_HOST
export FACTER_rdo_mirror_host=$RDO_MIRROR_HOST
export FACTER_ceph_version=$CEPH_VERSION
MIRROR_FACTS="\
nodepool_mirror_host=${FACTER_nodepool_mirror_host}
centos_mirror_host=${FACTER_centos_mirror_host}
uca_mirror_host=${FACTER_uca_mirror_host}
deps_mirror_host=${FACTER_deps_mirror_host}
ceph_mirror_host=${FACTER_ceph_mirror_host}
rdo_mirror_host=${FACTER_rdo_mirror_host}
ceph_version=${FACTER_ceph_version}"
if [ "${WRITE_FACTS}" = true ]; then
$SUDO mkdir -p /etc/facter/facts.d/
echo "$MIRROR_FACTS" | $SUDO tee /etc/facter/facts.d/mirrors.txt
fi