Skip to content

Commit

Permalink
yum-minimal : update mirrors for Centos 8
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ianw committed Oct 3, 2019
1 parent 456b6cf commit 3bc89ed
Show file tree
Hide file tree
Showing 14 changed files with 86 additions and 10 deletions.
32 changes: 30 additions & 2 deletions contrib/setup-gate-mirrors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF > $CENTOS_MIN_DIR/dib-mirror-base.repo
Expand All @@ -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 <<EOF > $CENTOS_MIN_DIR/dib-mirror-base.repo
[base]
name=CentOS-\$releasever - Base
baseurl=$NODEPOOL_CENTOS_MIRROR/\$releasever/BaseOS/\$basearch/os/
gpgcheck=0
EOF

cat <<EOF > $CENTOS_MIN_DIR/dib-mirror-appstream.repo
[base]
name=CentOS-\$releasever - AppStream
baseurl=$NODEPOOL_CENTOS_MIRROR/\$releasever/AppStream/\$basearch/os/
gpgcheck=0
EOF


cat <<EOF > $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)
2 changes: 1 addition & 1 deletion diskimage_builder/elements/centos-minimal/README.rst
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[centos-appstream]
name=CentOS-$releasever - AppStream
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=appstream
gpgcheck=0

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[centos-base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=baseos
gpgcheck=0

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 22 additions & 5 deletions roles/dib-setup-gate-mirrors/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[AppStream]
name=CentOS-$releasever - AppStream
baseurl=http://{{ mirror_fqdn }}/centos/$releasever/AppStream/$basearch/os/
gpgcheck=0
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[base]
name=CentOS-$releasever - Base
baseurl=http://{{ mirror_fqdn }}/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=0
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 3bc89ed

Please sign in to comment.