From 3bc89edd32ccb243ad01afbda085b3063ecffa52 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 25 Sep 2019 00:53:39 +0000 Subject: [PATCH] yum-minimal : update mirrors for Centos 8 The repo format has slightly changed for CentOS 8 (s/os/baseos/). Make the chroot builder look for a more specific repos.d directory first named for the distro variable, then fall back to to top-level dir (this avoids having to constantly change fedora). Update the gate mirror setup and roles for new Centos 8 paths too. Change-Id: I5b7f0c3624cac1d7aa7ed8bf6286b85d808b9c9a --- contrib/setup-gate-mirrors.sh | 32 +++++++++++++++++-- .../elements/centos-minimal/README.rst | 2 +- .../yum.repos.d/{ => 7}/yum.repo | 0 .../yum.repos.d/8/appstream.repo | 5 +++ .../centos-minimal/yum.repos.d/8/base.repo | 5 +++ .../11-dib-distribution-mirror.bash | 2 +- .../elements/yum-minimal/root.d/08-yum-chroot | 10 +++++- roles/dib-setup-gate-mirrors/tasks/main.yaml | 27 +++++++++++++--- .../centos-minimal/{ => 7}/base.repo.j2 | 0 .../centos-minimal/{ => 7}/extras.repo.j2 | 0 .../centos-minimal/{ => 7}/updates.repo.j2 | 0 .../centos-minimal/8/appstream.repo.j2 | 4 +++ .../templates/centos-minimal/8/base.repo.j2 | 4 +++ .../templates/centos-minimal/8/extras.repo.j2 | 5 +++ 14 files changed, 86 insertions(+), 10 deletions(-) rename diskimage_builder/elements/centos-minimal/yum.repos.d/{ => 7}/yum.repo (100%) create mode 100644 diskimage_builder/elements/centos-minimal/yum.repos.d/8/appstream.repo create mode 100644 diskimage_builder/elements/centos-minimal/yum.repos.d/8/base.repo rename roles/dib-setup-gate-mirrors/templates/centos-minimal/{ => 7}/base.repo.j2 (100%) rename roles/dib-setup-gate-mirrors/templates/centos-minimal/{ => 7}/extras.repo.j2 (100%) rename roles/dib-setup-gate-mirrors/templates/centos-minimal/{ => 7}/updates.repo.j2 (100%) create mode 100644 roles/dib-setup-gate-mirrors/templates/centos-minimal/8/appstream.repo.j2 create mode 100644 roles/dib-setup-gate-mirrors/templates/centos-minimal/8/base.repo.j2 create mode 100644 roles/dib-setup-gate-mirrors/templates/centos-minimal/8/extras.repo.j2 diff --git a/contrib/setup-gate-mirrors.sh b/contrib/setup-gate-mirrors.sh index 5cff802b..5e8f4c9f 100755 --- a/contrib/setup-gate-mirrors.sh +++ b/contrib/setup-gate-mirrors.sh @@ -49,8 +49,8 @@ deltarpm=False deltarpm_percentage=0 EOF -# Centos Minimal -CENTOS_MIN_DIR=$BASE_DIR/centos-minimal/yum.repos.d +# Centos 7 Minimal +CENTOS_MIN_DIR=$BASE_DIR/centos-minimal/yum.repos.d/7 mkdir -p $CENTOS_MIN_DIR cat < $CENTOS_MIN_DIR/dib-mirror-base.repo @@ -76,4 +76,32 @@ baseurl=$NODEPOOL_CENTOS_MIRROR/\$releasever/extras/\$basearch/ gpgcheck=0 EOF +# Centos 8 Minimal +CENTOS_MIN_DIR=$BASE_DIR/centos-minimal/yum.repos.d/8 +mkdir -p $CENTOS_MIN_DIR + +cat < $CENTOS_MIN_DIR/dib-mirror-base.repo +[base] +name=CentOS-\$releasever - Base +baseurl=$NODEPOOL_CENTOS_MIRROR/\$releasever/BaseOS/\$basearch/os/ +gpgcheck=0 +EOF + +cat < $CENTOS_MIN_DIR/dib-mirror-appstream.repo +[base] +name=CentOS-\$releasever - AppStream +baseurl=$NODEPOOL_CENTOS_MIRROR/\$releasever/AppStream/\$basearch/os/ +gpgcheck=0 +EOF + + +cat < $CENTOS_MIN_DIR/dib-mirror-extras.repo +#additional packages that may be useful +[extras] +name=CentOS-\$releasever - Extras +baseurl=$NODEPOOL_CENTOS_MIRROR/\$releasever/extras/\$basearch/os/ +gpgcheck=0 +EOF + + ## apt sources (todo) diff --git a/diskimage_builder/elements/centos-minimal/README.rst b/diskimage_builder/elements/centos-minimal/README.rst index f43b9d91..f9187772 100644 --- a/diskimage_builder/elements/centos-minimal/README.rst +++ b/diskimage_builder/elements/centos-minimal/README.rst @@ -1,7 +1,7 @@ ============== centos-minimal ============== -Create a minimal image based on CentOS 7. +Create a minimal image based on CentOS Use of this element will require 'yum' and 'yum-utils' to be installed on Ubuntu and Debian. Nothing additional is needed on Fedora or CentOS. diff --git a/diskimage_builder/elements/centos-minimal/yum.repos.d/yum.repo b/diskimage_builder/elements/centos-minimal/yum.repos.d/7/yum.repo similarity index 100% rename from diskimage_builder/elements/centos-minimal/yum.repos.d/yum.repo rename to diskimage_builder/elements/centos-minimal/yum.repos.d/7/yum.repo diff --git a/diskimage_builder/elements/centos-minimal/yum.repos.d/8/appstream.repo b/diskimage_builder/elements/centos-minimal/yum.repos.d/8/appstream.repo new file mode 100644 index 00000000..328475e0 --- /dev/null +++ b/diskimage_builder/elements/centos-minimal/yum.repos.d/8/appstream.repo @@ -0,0 +1,5 @@ +[centos-appstream] +name=CentOS-$releasever - AppStream +mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=appstream +gpgcheck=0 + diff --git a/diskimage_builder/elements/centos-minimal/yum.repos.d/8/base.repo b/diskimage_builder/elements/centos-minimal/yum.repos.d/8/base.repo new file mode 100644 index 00000000..f263b2b6 --- /dev/null +++ b/diskimage_builder/elements/centos-minimal/yum.repos.d/8/base.repo @@ -0,0 +1,5 @@ +[centos-base] +name=CentOS-$releasever - Base +mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=baseos +gpgcheck=0 + diff --git a/diskimage_builder/elements/openstack-ci-mirrors/environment.d/11-dib-distribution-mirror.bash b/diskimage_builder/elements/openstack-ci-mirrors/environment.d/11-dib-distribution-mirror.bash index 83119084..92c94f13 100644 --- a/diskimage_builder/elements/openstack-ci-mirrors/environment.d/11-dib-distribution-mirror.bash +++ b/diskimage_builder/elements/openstack-ci-mirrors/environment.d/11-dib-distribution-mirror.bash @@ -53,7 +53,7 @@ if [[ -d ${DIB_OS_CI_YUM_REPOS:-/not/a/path/} ]]; then export DIB_YUM_MINIMAL_BOOTSTRAP_REPOS=${DIB_OS_CI_YUM_REPOS}/fedora-minimal/default/yum.repos.d fi elif [[ "${DISTRO_NAME}" == "centos" ]]; then - export DIB_YUM_MINIMAL_BOOTSTRAP_REPOS=${DIB_OS_CI_YUM_REPOS}/centos-minimal/yum.repos.d + export DIB_YUM_MINIMAL_BOOTSTRAP_REPOS=${DIB_OS_CI_YUM_REPOS}/centos-minimal/${DIB_RELEASE}/yum.repos.d fi fi diff --git a/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot b/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot index 841f9262..326c4e66 100755 --- a/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot +++ b/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot @@ -95,7 +95,15 @@ function _install_repos { # routines. In the gate, environment.d files for the funtional # tests will set DIB_YUM_MINIMAL_BOOTSTRAP_REPOS -- this contains # mirrors correct for the region setup by contrib/setup-gate-mirrors.sh - local repo=${DIB_YUM_MINIMAL_BOOTSTRAP_REPOS:-${TMP_HOOKS_PATH}/yum.repos.d} + local repo=${DIB_YUM_MINIMAL_BOOTSTRAP_REPOS:-} + if [[ -z ${repo} ]]; then + # take in preference more specific subdirs + if [[ -d ${TMP_HOOKS_PATH}/yum.repos.d/${DIB_RELEASE} ]]; then + repo=${TMP_HOOKS_PATH}/yum.repos.d/${DIB_RELEASE} + else + repo=${TMP_HOOKS_PATH}/yum.repos.d + fi + fi # yumdownloader puts repo xml files and such into a directory # ${TMPDIR}/yum-$USER-random. Since we don't need this once the diff --git a/roles/dib-setup-gate-mirrors/tasks/main.yaml b/roles/dib-setup-gate-mirrors/tasks/main.yaml index 862b68a7..9a6114fd 100644 --- a/roles/dib-setup-gate-mirrors/tasks/main.yaml +++ b/roles/dib-setup-gate-mirrors/tasks/main.yaml @@ -5,23 +5,40 @@ - debug: msg="zuul site mirror {{ zuul_site_mirror_fqdn }}" - debug: msg="mirror_fqdn {{ mirror_fqdn }}" -- name: Create centos-minimal directory +- name: Create centos-minimal 7 directory file: - path: "{{ dib_gate_mirror_repos }}/centos-minimal/yum.repos.d" + path: "{{ dib_gate_mirror_repos }}/centos-minimal/7/yum.repos.d" state: directory mode: 0775 recurse: yes -- name: Install centos-minimal repo files +- name: Install centos-minimal 7 repo files template: - dest: "{{ dib_gate_mirror_repos }}/centos-minimal/yum.repos.d/dib-mirror-{{ item }}" + dest: "{{ dib_gate_mirror_repos }}/centos-minimal/7/yum.repos.d/dib-mirror-{{ item }}" mode: 0644 - src: "centos-minimal/{{ item }}.j2" + src: "centos-minimal/7/{{ item }}.j2" with_items: - base.repo - updates.repo - extras.repo +- name: Create centos-minimal 8 directory + file: + path: "{{ dib_gate_mirror_repos }}/centos-minimal/8/yum.repos.d" + state: directory + mode: 0775 + recurse: yes + +- name: Install centos-minimal 8 repo files + template: + dest: "{{ dib_gate_mirror_repos }}/centos-minimal/8/yum.repos.d/dib-mirror-{{ item }}" + mode: 0644 + src: "centos-minimal/8/{{ item }}.j2" + with_items: + - base.repo + - appstream.repo + - extras.repo + - name: Create fedora-minimal directories file: path: "{{ dib_gate_mirror_repos }}/fedora-minimal/{{ item }}/yum.repos.d" diff --git a/roles/dib-setup-gate-mirrors/templates/centos-minimal/base.repo.j2 b/roles/dib-setup-gate-mirrors/templates/centos-minimal/7/base.repo.j2 similarity index 100% rename from roles/dib-setup-gate-mirrors/templates/centos-minimal/base.repo.j2 rename to roles/dib-setup-gate-mirrors/templates/centos-minimal/7/base.repo.j2 diff --git a/roles/dib-setup-gate-mirrors/templates/centos-minimal/extras.repo.j2 b/roles/dib-setup-gate-mirrors/templates/centos-minimal/7/extras.repo.j2 similarity index 100% rename from roles/dib-setup-gate-mirrors/templates/centos-minimal/extras.repo.j2 rename to roles/dib-setup-gate-mirrors/templates/centos-minimal/7/extras.repo.j2 diff --git a/roles/dib-setup-gate-mirrors/templates/centos-minimal/updates.repo.j2 b/roles/dib-setup-gate-mirrors/templates/centos-minimal/7/updates.repo.j2 similarity index 100% rename from roles/dib-setup-gate-mirrors/templates/centos-minimal/updates.repo.j2 rename to roles/dib-setup-gate-mirrors/templates/centos-minimal/7/updates.repo.j2 diff --git a/roles/dib-setup-gate-mirrors/templates/centos-minimal/8/appstream.repo.j2 b/roles/dib-setup-gate-mirrors/templates/centos-minimal/8/appstream.repo.j2 new file mode 100644 index 00000000..2cfa3951 --- /dev/null +++ b/roles/dib-setup-gate-mirrors/templates/centos-minimal/8/appstream.repo.j2 @@ -0,0 +1,4 @@ +[AppStream] +name=CentOS-$releasever - AppStream +baseurl=http://{{ mirror_fqdn }}/centos/$releasever/AppStream/$basearch/os/ +gpgcheck=0 diff --git a/roles/dib-setup-gate-mirrors/templates/centos-minimal/8/base.repo.j2 b/roles/dib-setup-gate-mirrors/templates/centos-minimal/8/base.repo.j2 new file mode 100644 index 00000000..2f3aeb5e --- /dev/null +++ b/roles/dib-setup-gate-mirrors/templates/centos-minimal/8/base.repo.j2 @@ -0,0 +1,4 @@ +[base] +name=CentOS-$releasever - Base +baseurl=http://{{ mirror_fqdn }}/centos/$releasever/BaseOS/$basearch/os/ +gpgcheck=0 diff --git a/roles/dib-setup-gate-mirrors/templates/centos-minimal/8/extras.repo.j2 b/roles/dib-setup-gate-mirrors/templates/centos-minimal/8/extras.repo.j2 new file mode 100644 index 00000000..2c1d46ed --- /dev/null +++ b/roles/dib-setup-gate-mirrors/templates/centos-minimal/8/extras.repo.j2 @@ -0,0 +1,5 @@ +#additional packages that may be useful +[extras] +name=CentOS-$releasever - Extras +baseurl=http://{{ mirror_fqdn }}/centos/$releasever/extras/$basearch/os/ +gpgcheck=0