⛅ Run mock builds on AWS + PSI
Increase reliability and performance by running the mock builds at AWS when PSI is having trouble. Signed-off-by: Major Hayden <major@redhat.com>
This commit is contained in:
parent
0579bc6385
commit
e8cae4ffc4
4 changed files with 26 additions and 119 deletions
20
schutzbot/Jenkinsfile
vendored
20
schutzbot/Jenkinsfile
vendored
|
|
@ -27,8 +27,17 @@ pipeline {
|
|||
unit: "HOURS"
|
||||
)
|
||||
}
|
||||
|
||||
stages {
|
||||
stage("Prepare") {
|
||||
agent { label "schutzbot" }
|
||||
steps {
|
||||
sh (
|
||||
label: "Get environment variables",
|
||||
script: "env | sort"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
stage("Mock") {
|
||||
// Halt the entire pipeline if a single RPM build fails. That
|
||||
// could indicate a code problem that needs to be investigated.
|
||||
|
|
@ -36,7 +45,7 @@ pipeline {
|
|||
|
||||
parallel {
|
||||
stage('Fedora 31') {
|
||||
agent { label "f31 && minimal" }
|
||||
agent { label "f31cloudbase" }
|
||||
environment {
|
||||
AWS_CREDS = credentials('aws-credentials-osbuildci')
|
||||
}
|
||||
|
|
@ -52,7 +61,7 @@ pipeline {
|
|||
}
|
||||
}
|
||||
stage('Fedora 32') {
|
||||
agent { label "f32 && minimal" }
|
||||
agent { label "f32cloudbase" }
|
||||
environment {
|
||||
AWS_CREDS = credentials('aws-credentials-osbuildci')
|
||||
}
|
||||
|
|
@ -68,9 +77,10 @@ pipeline {
|
|||
}
|
||||
}
|
||||
stage('RHEL 8 CDN') {
|
||||
agent { label "rhel8cdn && minimal" }
|
||||
agent { label "rhel8cloudbase" }
|
||||
environment {
|
||||
AWS_CREDS = credentials('aws-credentials-osbuildci')
|
||||
RHN_REGISTRATION_SCRIPT = credentials('rhn-register-script-production')
|
||||
}
|
||||
steps {
|
||||
sh "schutzbot/ci_details.sh"
|
||||
|
|
@ -85,7 +95,7 @@ pipeline {
|
|||
}
|
||||
// NOTE(mhayden): RHEL 8.3 is only available in PSI for now.
|
||||
stage('RHEL 8.3 Nightly') {
|
||||
agent { label "rhel83nightly && minimal" }
|
||||
agent { label "rhel83cloudbase" }
|
||||
environment {
|
||||
AWS_CREDS = credentials('aws-credentials-osbuildci')
|
||||
NIGHTLY_REPO = credentials('rhel8-nightly-repo')
|
||||
|
|
|
|||
|
|
@ -1,60 +0,0 @@
|
|||
config_opts['root'] = 'fedora-{{ releasever }}-{{ target_arch }}'
|
||||
# config_opts['module_enable'] = ['list', 'of', 'modules']
|
||||
# config_opts['module_install'] = ['module1/profile', 'module2/profile']
|
||||
|
||||
# fedora 31+ isn't mirrored, we need to run from koji
|
||||
|
||||
config_opts['chroot_setup_cmd'] = 'install @buildsys-build'
|
||||
|
||||
config_opts['dist'] = 'fc{{ releasever }}' # only useful for --resultdir variable subst
|
||||
config_opts['extra_chroot_dirs'] = [ '/run/lock', ]
|
||||
config_opts['package_manager'] = 'dnf'
|
||||
config_opts['bootstrap_image'] = 'fedora:{{ releasever }}'
|
||||
|
||||
config_opts['dnf.conf'] = """
|
||||
[main]
|
||||
keepcache=1
|
||||
debuglevel=2
|
||||
reposdir=/dev/null
|
||||
logfile=/var/log/yum.log
|
||||
retries=20
|
||||
obsoletes=1
|
||||
gpgcheck=0
|
||||
assumeyes=1
|
||||
syslog_ident=mock
|
||||
syslog_device=
|
||||
install_weak_deps=0
|
||||
metadata_expire=0
|
||||
best=1
|
||||
module_platform_id=platform:f{{ releasever }}
|
||||
protected_packages=
|
||||
|
||||
# repos
|
||||
|
||||
[fedora-internal]
|
||||
name=Fedora Internal
|
||||
baseurl=http://download-rdu01.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
|
||||
enabled=1
|
||||
countme=1
|
||||
metadata_expire=7d
|
||||
repo_gpgcheck=0
|
||||
type=rpm
|
||||
gpgcheck=1
|
||||
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
|
||||
skip_if_unavailable=False
|
||||
priority=5
|
||||
|
||||
[updates-internal]
|
||||
name=Fedora Updates Internal
|
||||
baseurl=http://download-rdu01.fedoraproject.org/pub/fedora/linux/updates/$releasever/Everything/$basearch/
|
||||
enabled=1
|
||||
countme=1
|
||||
repo_gpgcheck=0
|
||||
type=rpm
|
||||
gpgcheck=1
|
||||
metadata_expire=6h
|
||||
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
|
||||
skip_if_unavailable=False
|
||||
priority=5
|
||||
|
||||
"""
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
[fedora-internal]
|
||||
name=Fedora Internal
|
||||
baseurl=http://download-rdu01.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
|
||||
enabled=1
|
||||
countme=1
|
||||
metadata_expire=7d
|
||||
repo_gpgcheck=0
|
||||
type=rpm
|
||||
gpgcheck=1
|
||||
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
|
||||
skip_if_unavailable=False
|
||||
priority=5
|
||||
|
||||
[updates-internal]
|
||||
name=Fedora Updates Internal
|
||||
baseurl=http://download-rdu01.fedoraproject.org/pub/fedora/linux/updates/$releasever/Everything/$basearch/
|
||||
enabled=1
|
||||
countme=1
|
||||
repo_gpgcheck=0
|
||||
type=rpm
|
||||
gpgcheck=1
|
||||
metadata_expire=6h
|
||||
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
|
||||
skip_if_unavailable=False
|
||||
priority=5
|
||||
|
|
@ -9,19 +9,6 @@ function greenprint {
|
|||
# Get OS details.
|
||||
source /etc/os-release
|
||||
|
||||
# Remove Fedora's modular repositories to speed up dnf.
|
||||
sudo rm -f /etc/yum.repos.d/fedora*modular*
|
||||
|
||||
# Enable fastestmirror and disable weak dependency installation to speed up
|
||||
# dnf operations.
|
||||
echo -e "fastestmirror=1\ninstall_weak_deps=0" | sudo tee -a /etc/dnf/dnf.conf
|
||||
|
||||
# Fedora: Use a reliable set of mirrors for faster downloads.
|
||||
if [[ $ID == fedora ]]; then
|
||||
sudo rm -f /etc/yum.repos.d/*.repo
|
||||
sudo cp schutzbot/assets/fedora.repo /etc/yum.repos.d/fedora.repo
|
||||
fi
|
||||
|
||||
# Mock is only available in EPEL for RHEL.
|
||||
if [[ $ID == rhel ]]; then
|
||||
greenprint "📦 Setting up EPEL repository"
|
||||
|
|
@ -30,20 +17,21 @@ if [[ $ID == rhel ]]; then
|
|||
sudo rpm -Uvh /tmp/epel.rpm
|
||||
fi
|
||||
|
||||
# Register RHEL if we are provided with a registration script.
|
||||
if [[ -n "${RHN_REGISTRATION_SCRIPT:-}" ]]; then
|
||||
greenprint "🪙 Registering RHEL instance"
|
||||
sudo chmod +x $RHN_REGISTRATION_SCRIPT
|
||||
sudo $RHN_REGISTRATION_SCRIPT
|
||||
fi
|
||||
|
||||
# Install requirements for building RPMs in mock.
|
||||
greenprint "📦 Installing mock requirements"
|
||||
sudo dnf -y install createrepo_c make mock rpm-build
|
||||
sudo dnf -y install createrepo_c make mock python3-pip rpm-build
|
||||
|
||||
# Install s3cmd if it is not present.
|
||||
if ! s3cmd --version > /dev/null 2>&1; then
|
||||
greenprint "📦 Installing s3cmd"
|
||||
sudo pip3 install s3cmd
|
||||
fi
|
||||
|
||||
# Enable fastestmirror for mock on Fedora.
|
||||
if [[ $ID == fedora ]]; then
|
||||
sudo sed -i '/^install_weak_deps=.*/a fastestmirror=1' \
|
||||
/etc/mock/templates/fedora-branched.tpl
|
||||
sudo pip3 -q install s3cmd
|
||||
fi
|
||||
|
||||
# Jenkins sets a workspace variable as the root of its working directory.
|
||||
|
|
@ -80,13 +68,8 @@ greenprint "🔧 Building source RPMs."
|
|||
make srpm
|
||||
make -C osbuild srpm
|
||||
|
||||
# Use optimized mock template for Fedora.
|
||||
if [[ $ID == fedora ]]; then
|
||||
sudo cp schutzbot/assets/fedora-branched.tpl /etc/mock/templates/fedora-branched.tpl
|
||||
fi
|
||||
|
||||
# Fix RHEL 8 mock template for non-subscribed images.
|
||||
if [[ $NODE_NAME == *rhel8[23]* ]]; then
|
||||
if [[ "${ID}${VERSION_ID//./}" == rhel83 ]]; then
|
||||
greenprint "📋 Updating RHEL 8 mock template for unsubscribed image"
|
||||
sudo mv $NIGHTLY_MOCK_TEMPLATE /etc/mock/templates/rhel-8.tpl
|
||||
cat $NIGHTLY_REPO | sudo tee -a /etc/mock/templates/rhel-8.tpl > /dev/null
|
||||
|
|
@ -95,8 +78,7 @@ fi
|
|||
|
||||
# Compile RPMs in a mock chroot
|
||||
greenprint "🎁 Building RPMs with mock"
|
||||
sudo mock -r $MOCK_CONFIG --no-bootstrap-chroot \
|
||||
--resultdir $REPO_DIR --with=tests \
|
||||
sudo mock -r $MOCK_CONFIG --resultdir $REPO_DIR --with=tests \
|
||||
rpmbuild/SRPMS/*.src.rpm osbuild/rpmbuild/SRPMS/*.src.rpm
|
||||
sudo chown -R $USER ${REPO_DIR}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue