From 7dba62112ec9dbb369972ba046b2e69b1af14c19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Kadl=C4=8D=C3=ADk?= Date: Thu, 6 Apr 2023 11:54:26 +0200 Subject: [PATCH] Create TMT plans --- .fmf/version | 1 + plans/all_tests.fmf | 11 +++++ plans/ci.fmf | 12 ++++++ plans/provide_secondary_arch_rpms.sh | 63 ++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+) create mode 100644 .fmf/version create mode 100644 plans/all_tests.fmf create mode 100644 plans/ci.fmf create mode 100755 plans/provide_secondary_arch_rpms.sh diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/plans/all_tests.fmf b/plans/all_tests.fmf new file mode 100644 index 0000000..9eed518 --- /dev/null +++ b/plans/all_tests.fmf @@ -0,0 +1,11 @@ +summary: All available tests +discover: + how: fmf +execute: + how: tmt +adjust: + prepare+: + - name: Add secondary architecture RPMs + how: shell + script: ./plans/provide_secondary_arch_rpms.sh + when: distro == fedora and arch == x86_64 diff --git a/plans/ci.fmf b/plans/ci.fmf new file mode 100644 index 0000000..c5eca90 --- /dev/null +++ b/plans/ci.fmf @@ -0,0 +1,12 @@ +summary: CI Gating Plan +discover: + how: fmf + filter: 'tag: Fedora-CI-gating' +execute: + how: tmt +adjust: + prepare+: + - name: Add secondary architecture RPMs + how: shell + script: ./plans/provide_secondary_arch_rpms.sh + when: distro == fedora and arch == x86_64 diff --git a/plans/provide_secondary_arch_rpms.sh b/plans/provide_secondary_arch_rpms.sh new file mode 100755 index 0000000..55b3311 --- /dev/null +++ b/plans/provide_secondary_arch_rpms.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +# Fedora CI testing systems don't provide a repository with the i686 +# RPMs of the build being tests. As a consequence, most +# dnf install -y .i686 +# commands (whether being run by a test or by TMT's prepare) will probably +# fail on a version mismatch with present x86_64 gcc RPMs. To prevent such +# failures we provide this script which we recommend to include in every +# Fedora CI test plan. +# +# Implementation notes: +# +# * The gcc build being tested in Fedora CI is given via KOJI_TASK_ID. See +# https://github.com/fedora-ci/dist-git-pipeline/pull/50 for details. +# +# * Currently this script just downloads and installs the i686 RPMs. It +# would not be sufficient for tests that uninstall and reinstall those +# RPMs. If such a test appears, this script should create a repository. +# +# * Fedora CI testing systems seem to have extremely small RAM-based /tmp, +# unable to host all the downloaded RPMs, and no other "real" filesystem +# than "/". That's the reason for using +# mktemp -d --tmpdir=/ + +set -x + +true "V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V-V" + +echo "KOJI_TASK_ID=$KOJI_TASK_ID" + +. /etc/os-release + +echo "ID=$ID" +echo "arch=$(arch)" +echo "KOJI_TASK_ID=$KOJI_TASK_ID" + +if [[ "$ID" = fedora ]] && [[ "$(arch)" = x86_64 ]] && [[ -n "$KOJI_TASK_ID" ]]; then + + if tmpd=$(mktemp -d --tmpdir=/) && pushd $tmpd; then + + # Download + rpm -q koji || dnf -y install koji + koji download-task $KOJI_TASK_ID --noprogress --arch={x86_64,i686,noarch} + + # Remove conflicting RPMs + rm -f *debuginfo* *debugsource* + rm -f gcc-[0-9]*.i686.* + rm -f *docs*.i686.* + + # Install + ls + dnf -y install *.rpm + + # Clean up + popd + rm -rf $tmpd + fi + +else + echo "Not applicable" +fi + +true "^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^"