tests: Enable use of custom osbuild-composer repo
This enables the user to specify custom REPO_URL for use during internal RHEL build testing as ENV in scheduled pipelines. It also gives the option to use osbuild build specified in Schutzfile or from the nightly build repository.
This commit is contained in:
parent
905c297bc7
commit
b6c579cbe3
2 changed files with 44 additions and 37 deletions
|
|
@ -100,8 +100,13 @@ fi
|
|||
if [ -f "rhel8internal.repo" ]; then
|
||||
greenprint "Preparing repos for internal build testing"
|
||||
sudo mv rhel8internal.repo /etc/yum.repos.d/
|
||||
# Change back to removing osbuild*.repo when we have rpms in 8.5
|
||||
sudo rm -f /etc/yum.repos.d/osbuild-composer.repo
|
||||
# Use osbuild from schutzfile if desired for testing custom osbuild-composer packages
|
||||
# specified by $REPO_URL in ENV and used in prepare-rhel-internal.sh
|
||||
if [ "$SCHUTZ_OSBUILD" == 1 ]; then
|
||||
sudo rm -f /etc/yum.repos.d/osbuild-composer.repo
|
||||
else
|
||||
sudo rm -f /etc/yum.repos.d/osbuild*.repo
|
||||
fi
|
||||
fi
|
||||
|
||||
greenprint "Installing test packages for ${PROJECT}"
|
||||
|
|
|
|||
|
|
@ -62,50 +62,52 @@ EOF
|
|||
|
||||
cp rhel-8.json rhel-8-beta.json
|
||||
|
||||
|
||||
greenprint "📦 Installing requirements"
|
||||
sudo dnf -y install createrepo_c wget python3-pip
|
||||
|
||||
# Install s3cmd if it is not present.
|
||||
if ! s3cmd --version > /dev/null 2>&1; then
|
||||
greenprint "📦 Installing s3cmd"
|
||||
sudo pip3 -q install s3cmd
|
||||
fi
|
||||
|
||||
JOB_NAME="${JOB_NAME:-${CI_JOB_ID}}"
|
||||
REPO_DIR_LATEST="repo/${JOB_NAME}/latest/internal"
|
||||
mkdir -p "$REPO_DIR_LATEST"
|
||||
# Do not create tests repo if it's provided from ENV
|
||||
if [ -z "$REPO_URL" ]; then
|
||||
greenprint "📦 Installing requirements"
|
||||
sudo dnf -y install createrepo_c wget python3-pip
|
||||
|
||||
greenprint "Discover latest osbuild-composer NVR"
|
||||
# Download only osbuild-composer-worker-*.rpm and use it in rpm --qf below
|
||||
wget --quiet --recursive --no-parent --no-directories --accept "osbuild-composer-worker-*.rpm" \
|
||||
"${COMPOSE_URL}/compose/AppStream/${ARCH}/os/Packages/"
|
||||
# Install s3cmd if it is not present.
|
||||
if ! s3cmd --version > /dev/null 2>&1; then
|
||||
greenprint "📦 Installing s3cmd"
|
||||
sudo pip3 -q install s3cmd
|
||||
fi
|
||||
|
||||
# Download osbuild-composer-tests from Brew b/c it is not available in the distro
|
||||
# version matches osbuild-composer from the internal tree
|
||||
greenprint "Downloading osbuild-composer-tests from Brew"
|
||||
TESTS_RPM_URL=$(rpm -qp ./osbuild-composer-worker-*.rpm --qf "http://download.devel.redhat.com/brewroot/vol/rhel-8/packages/osbuild-composer/%{version}/%{release}/%{arch}/osbuild-composer-tests-%{version}-%{release}.%{arch}.rpm")
|
||||
wget --directory-prefix "$REPO_DIR_LATEST" "$TESTS_RPM_URL"
|
||||
REPO_DIR_LATEST="repo/${JOB_NAME}/latest/internal"
|
||||
mkdir -p "$REPO_DIR_LATEST"
|
||||
|
||||
greenprint "⛓ Creating dnf repository"
|
||||
createrepo_c "${REPO_DIR_LATEST}"
|
||||
greenprint "Discover latest osbuild-composer NVR"
|
||||
# Download only osbuild-composer-worker-*.rpm and use it in rpm --qf below
|
||||
wget --quiet --recursive --no-parent --no-directories --accept "osbuild-composer-worker-*.rpm" \
|
||||
"${COMPOSE_URL}/compose/AppStream/${ARCH}/os/Packages/"
|
||||
|
||||
# Bucket in S3 where our artifacts are uploaded
|
||||
REPO_BUCKET=osbuild-composer-repos
|
||||
# Download osbuild-composer-tests from Brew b/c it is not available in the distro
|
||||
# version matches osbuild-composer from the internal tree
|
||||
greenprint "Downloading osbuild-composer-tests from Brew"
|
||||
TESTS_RPM_URL=$(rpm -qp ./osbuild-composer-worker-*.rpm --qf "http://download.devel.redhat.com/brewroot/vol/rhel-8/packages/osbuild-composer/%{version}/%{release}/%{arch}/osbuild-composer-tests-%{version}-%{release}.%{arch}.rpm")
|
||||
wget --directory-prefix "$REPO_DIR_LATEST" "$TESTS_RPM_URL"
|
||||
|
||||
# Remove the previous latest repo for this job.
|
||||
# Don't fail if the path is missing.
|
||||
s3cmd --recursive rm "s3://${REPO_BUCKET}/${REPO_DIR_LATEST}" || true
|
||||
greenprint "⛓ Creating dnf repository"
|
||||
createrepo_c "${REPO_DIR_LATEST}"
|
||||
|
||||
# Upload repository to S3.
|
||||
greenprint "☁ Uploading RPMs to S3"
|
||||
s3cmd --acl-public sync . s3://${REPO_BUCKET}/
|
||||
# Bucket in S3 where our artifacts are uploaded
|
||||
REPO_BUCKET=osbuild-composer-repos
|
||||
|
||||
# Public URL for the S3 bucket with our artifacts.
|
||||
MOCK_REPO_BASE_URL="http://osbuild-composer-repos.s3-website.us-east-2.amazonaws.com"
|
||||
# Remove the previous latest repo for this job.
|
||||
# Don't fail if the path is missing.
|
||||
s3cmd --recursive rm "s3://${REPO_BUCKET}/${REPO_DIR_LATEST}" || true
|
||||
|
||||
# Full URL to the RPM repository after they are uploaded.
|
||||
REPO_URL=${MOCK_REPO_BASE_URL}/${REPO_DIR_LATEST}
|
||||
# Upload repository to S3.
|
||||
greenprint "☁ Uploading RPMs to S3"
|
||||
s3cmd --acl-public sync . s3://${REPO_BUCKET}/
|
||||
|
||||
# Public URL for the S3 bucket with our artifacts.
|
||||
MOCK_REPO_BASE_URL="http://osbuild-composer-repos.s3-website.us-east-2.amazonaws.com"
|
||||
|
||||
# Full URL to the RPM repository after they are uploaded.
|
||||
REPO_URL=${MOCK_REPO_BASE_URL}/${REPO_DIR_LATEST}
|
||||
fi
|
||||
|
||||
# amend repository file.
|
||||
greenprint "📜 Amend dnf repository file"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue