mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-08 05:26:58 +02:00
ci-automation: Change the way we prepare torcx manifest for testing
Now URLs for torcx packages are always present in the torcx manifest, but for releases they may be pointing to the origin server where the packages will be eventually uploaded. At the time of running the tests, those packages are still only in the build cache, so change the URLs to point to the build cache, so the test can pass.
This commit is contained in:
parent
b2d6f7fc6e
commit
1ecea3544f
@ -74,8 +74,11 @@
|
|||||||
# script would need to make anyway. For more information, please refer
|
# script would need to make anyway. For more information, please refer
|
||||||
# to the vendor_test.sh file.
|
# to the vendor_test.sh file.
|
||||||
|
|
||||||
# Download torcx package and manifest, add build cache URL to manifest
|
# Download torcx manifest and modify URLs pointing to the origin
|
||||||
# so the docker.torcx-manifest-pkgs test can use it.
|
# server to point to the build cache. This is because the tests for
|
||||||
|
# releases are run before artifacts are uploaded to the origin
|
||||||
|
# server. This would make kola's docker.torcx-manifest-pkgs test to
|
||||||
|
# fail.
|
||||||
function __prepare_torcx() {
|
function __prepare_torcx() {
|
||||||
local arch="$1"
|
local arch="$1"
|
||||||
local vernum="$2"
|
local vernum="$2"
|
||||||
@ -83,16 +86,28 @@ function __prepare_torcx() {
|
|||||||
|
|
||||||
copy_from_buildcache "images/${arch}/${vernum}/torcx/torcx_manifest.json" "${workdir}"
|
copy_from_buildcache "images/${arch}/${vernum}/torcx/torcx_manifest.json" "${workdir}"
|
||||||
|
|
||||||
local docker_pkg
|
# Change URLs from:
|
||||||
docker_pkg="$(basename \
|
#
|
||||||
"$(jq -r ".value.packages[0].versions[0].locations[0].path" \
|
# https://${channel}.release.flatcar-linux.net/${arch}-usr/${vernum}/torcx/…
|
||||||
${workdir}/torcx_manifest.json)")"
|
#
|
||||||
|
# to:
|
||||||
# Add docker package URL on build cache to manifest
|
#
|
||||||
local docker_url="http://${BUILDCACHE_SERVER}/images/${arch}/${vernum}/torcx/${docker_pkg}"
|
# https://bincache.flatcar-linux.net/images/${arch}/${vernum}/torcx/…
|
||||||
jq ".value.packages[0].versions[0].locations += [{\"url\" : \"${docker_url}\"}]" \
|
#
|
||||||
|
# This is done in two parts - replacing host part and arch part.
|
||||||
|
#
|
||||||
|
# Replace 'https://${channel}.release.flatcar-linux.net/' with
|
||||||
|
# 'https://bincache.flatcar-linux.net/' matching the initial "url"
|
||||||
|
# JSON key too.
|
||||||
|
local host_match='\("url":\s*"https://\)[a-z]\+\.release\([^/]\+/\)'
|
||||||
|
local host_replace='\1bincache\2'
|
||||||
|
# Replace '${arch}-usr/` part with 'images/${arch}/'.
|
||||||
|
local arch_match='\([a-z0-9]\+\)-usr/'
|
||||||
|
local arch_replace='images/\3/'
|
||||||
|
sed \
|
||||||
|
-e "s#${host_match}${arch_match}#${host_replace}${arch_replace}#g" \
|
||||||
"${workdir}/torcx_manifest.json" \
|
"${workdir}/torcx_manifest.json" \
|
||||||
> "${workdir}/torcx_manifest_new.json"
|
>"${workdir}/torcx_manifest_new.json"
|
||||||
|
|
||||||
mv "${workdir}/torcx_manifest.json" "${workdir}/torcx_manifest.json.original"
|
mv "${workdir}/torcx_manifest.json" "${workdir}/torcx_manifest.json.original"
|
||||||
mv "${workdir}/torcx_manifest_new.json" "${workdir}/torcx_manifest.json"
|
mv "${workdir}/torcx_manifest_new.json" "${workdir}/torcx_manifest.json"
|
||||||
|
Loading…
Reference in New Issue
Block a user