ci: Overwrite REPO_PATH based on the value of $NIGHTLY

Override only for osbuild-composer, not other projects

will produce different repositories/rpms for the same commit when
executed from a PR and from the scheduled pipelines. We need the
distinction b/c osbuild-composer-tests RPMs end up slightly different in
these two cases. For more info see:
https://github.com/osbuild/osbuild-composer/pull/2093#pullrequestreview-854328838
https://github.com/osbuild/osbuild-composer/pull/2093#issuecomment-1014469915
This commit is contained in:
Alexander Todorov 2022-01-18 13:22:07 +02:00 committed by Sanne Raymaekers
parent 43738d6caa
commit b31f61649a
2 changed files with 10 additions and 1 deletions

View file

@ -39,11 +39,17 @@ function setup_repo {
local project=$1
local commit=$2
local priority=${3:-10}
local REPO_PATH=${project}/${DISTRO_VERSION}/${ARCH}/${commit}
if [[ "${NIGHTLY:=false}" == "true" && "${project}" == "osbuild-composer" ]]; then
REPO_PATH=nightly/${REPO_PATH}
fi
greenprint "Setting up dnf repository for ${project} ${commit}"
sudo tee "/etc/yum.repos.d/${project}.repo" << EOF
[${project}]
name=${project} ${commit}
baseurl=http://osbuild-composer-repos.s3-website.us-east-2.amazonaws.com/${project}/${DISTRO_VERSION}/${ARCH}/${commit}
baseurl=http://osbuild-composer-repos.s3-website.us-east-2.amazonaws.com/${REPO_PATH}
enabled=1
gpgcheck=0
priority=${priority}

View file

@ -38,6 +38,9 @@ fi
# Relative path of the repository used for constructing both the local and
# remote paths below, so that they're consistent.
REPO_PATH=osbuild-composer/${DISTRO_VERSION}/${ARCH}/${COMMIT}
if [ "${NIGHTLY:=false}" == "true" ]; then
REPO_PATH=nightly/${REPO_PATH}
fi
# Directory to hold the RPMs temporarily before we upload them.
REPO_DIR=repo/${REPO_PATH}