mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-22 22:21:10 +02:00
Merge pull request #167 from flatcar-linux/jepio/simplify-pr-builds
jenkins/manifest: support PR numbers in PORTAGE_REF/OVERLAY_REF variables
This commit is contained in:
commit
aae8bdf74b
@ -95,20 +95,34 @@ set_manifest_ref() {
|
|||||||
local reference="$2"
|
local reference="$2"
|
||||||
# Select lines with "/$reponame" (kept as first group) and "revision" (kept as second group) and replace the value
|
# Select lines with "/$reponame" (kept as first group) and "revision" (kept as second group) and replace the value
|
||||||
# of "revision" (third group, not kept) with the new reference.
|
# of "revision" (third group, not kept) with the new reference.
|
||||||
sed -i -E "s#(/$reponame.*)(revision=\")([^\"]*)#\1\2refs/heads/$reference#g" "manifest/${FLATCAR_BUILD_ID}.xml"
|
sed -i -E "s#(/$reponame.*)(revision=\")([^\"]*)#\1\2$reference#g" "manifest/${FLATCAR_BUILD_ID}.xml"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ -n "${SCRIPTS_REF}" ]]
|
if [[ -n "${SCRIPTS_REF}" ]]
|
||||||
then
|
then
|
||||||
set_manifest_ref scripts "${SCRIPTS_REF}"
|
set_manifest_ref scripts "refs/heads/${SCRIPTS_REF}"
|
||||||
fi
|
fi
|
||||||
if [[ -n "${OVERLAY_REF}" ]]
|
if [[ -n "${OVERLAY_REF}" ]]
|
||||||
then
|
then
|
||||||
set_manifest_ref coreos-overlay "${OVERLAY_REF}"
|
prefix="refs/heads/"
|
||||||
|
suffix=""
|
||||||
|
# treat numbers as PR refs
|
||||||
|
if [ "${OVERLAY_REF}" -eq "${OVERLAY_REF}" ] 2>/dev/null; then
|
||||||
|
prefix="refs/pull/"
|
||||||
|
suffix="/head"
|
||||||
|
fi
|
||||||
|
set_manifest_ref coreos-overlay "$prefix${OVERLAY_REF}$suffix"
|
||||||
fi
|
fi
|
||||||
if [[ -n "${PORTAGE_REF}" ]]
|
if [[ -n "${PORTAGE_REF}" ]]
|
||||||
then
|
then
|
||||||
set_manifest_ref portage-stable "${PORTAGE_REF}"
|
prefix="refs/heads/"
|
||||||
|
suffix=""
|
||||||
|
# treat numbers as PR refs
|
||||||
|
if [ "${PORTAGE_REF}" -eq "${PORTAGE_REF}" ] 2>/dev/null; then
|
||||||
|
prefix="refs/pull/"
|
||||||
|
suffix="/head"
|
||||||
|
fi
|
||||||
|
set_manifest_ref portage-stable "$prefix${PORTAGE_REF}$suffix"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ln -fns "${FLATCAR_BUILD_ID}.xml" manifest/default.xml
|
ln -fns "${FLATCAR_BUILD_ID}.xml" manifest/default.xml
|
||||||
|
Loading…
x
Reference in New Issue
Block a user