From 9011a67dd027caa859a9fdc16c6f6f2dbfd961fd Mon Sep 17 00:00:00 2001 From: Major Hayden Date: Tue, 30 Jun 2020 07:35:03 -0500 Subject: [PATCH] Switch Fedora mock builds to minimal images Use minimal images when building RPMs via mock on Fedora (PR for RHEL will come later). Signed-off-by: Major Hayden --- schutzbot/Jenkinsfile | 4 ++-- schutzbot/mockbuild.sh | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/schutzbot/Jenkinsfile b/schutzbot/Jenkinsfile index 92d0af46e..78a7cbda4 100644 --- a/schutzbot/Jenkinsfile +++ b/schutzbot/Jenkinsfile @@ -36,7 +36,7 @@ pipeline { parallel { stage('Fedora 31') { - agent { label "fedora31" } + agent { label "f31 && minimal" } environment { AWS_CREDS = credentials('aws-credentials-osbuildci') } @@ -50,7 +50,7 @@ pipeline { } } stage('Fedora 32') { - agent { label "fedora32" } + agent { label "f32 && minimal" } environment { AWS_CREDS = credentials('aws-credentials-osbuildci') } diff --git a/schutzbot/mockbuild.sh b/schutzbot/mockbuild.sh index eed879067..5e2e95294 100755 --- a/schutzbot/mockbuild.sh +++ b/schutzbot/mockbuild.sh @@ -9,12 +9,28 @@ function greenprint { # Get OS details. source /etc/os-release +# Prepare dnf on Fedora for performance. +if [[ $ID == fedora ]]; then + sudo rm -f /etc/yum.repos.d/fedora*modular* + echo -e "fastestmirror=1\ninstall_weak_deps=0" | sudo tee -a /etc/dnf/dnf.conf +fi + +# Install requirements for building RPMs in mock. +greenprint "📦 Installing mock requirements" +sudo dnf -y install createrepo_c make mock rpm-build + # Install s3cmd if it is not present. -if ! s3cmd --version; then +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 +fi + # Jenkins sets a workspace variable as the root of its working directory. WORKSPACE=${WORKSPACE:-$(pwd)}