mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
citemplate: also check the forked registry for image builds
In case you are developing a set of changes in a module, in conjunction with a branch in gst-ci, you will end up with a template with a different tag than the upstream repo, which will be refferencing your gst-ci forked registry. But that image won't existin in the namespace the module would be running at, so we need to copy it from there. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-ci/-/merge_requests/308>
This commit is contained in:
parent
3a004f7ca4
commit
5c490de1bd
1 changed files with 32 additions and 4 deletions
|
@ -100,6 +100,9 @@ variables:
|
||||||
# we store the sha of the digest and the layers
|
# we store the sha of the digest and the layers
|
||||||
skopeo inspect docker://$LOCAL_IMAGE | jq '[.Digest, .Layers]' > local_sha
|
skopeo inspect docker://$LOCAL_IMAGE | jq '[.Digest, .Layers]' > local_sha
|
||||||
|
|
||||||
|
# check if our image is already in our gst-ci registry fork
|
||||||
|
skopeo inspect docker://$LOCAL_GST_CI_IMAGE | jq '[.Digest, .Layers]' > local_gst_ci_sha
|
||||||
|
|
||||||
# check if our image is already in the upstream registry
|
# check if our image is already in the upstream registry
|
||||||
if [[ -z "$GST_UPSTREAM_REPO" ]]
|
if [[ -z "$GST_UPSTREAM_REPO" ]]
|
||||||
then
|
then
|
||||||
|
@ -130,6 +133,25 @@ variables:
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# if the local ci fork repo has an image, ensure we use the same
|
||||||
|
if [ -s local_gst_ci_sha ]
|
||||||
|
then
|
||||||
|
|
||||||
|
# ensure we use the same image from upstream
|
||||||
|
diff local_gst_ci_sha local_sha && exit 0 || true
|
||||||
|
|
||||||
|
# copy the original image into the current project registry namespace
|
||||||
|
# we do 2 attempts with skopeo copy at most
|
||||||
|
skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD \
|
||||||
|
docker://$LOCAL_GST_CI_IMAGE \
|
||||||
|
docker://$LOCAL_IMAGE || \
|
||||||
|
skopeo copy --dest-creds $CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD \
|
||||||
|
docker://$LOCAL_GST_CI_IMAGE \
|
||||||
|
docker://$LOCAL_IMAGE
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# if we have a local image but none in the upstream repo, use our
|
# if we have a local image but none in the upstream repo, use our
|
||||||
if [ -s local_sha ]
|
if [ -s local_sha ]
|
||||||
then
|
then
|
||||||
|
@ -161,13 +183,10 @@ variables:
|
||||||
BUILDAH_FORMAT: 'docker'
|
BUILDAH_FORMAT: 'docker'
|
||||||
BUILDAH_ISOLATION: 'chroot'
|
BUILDAH_ISOLATION: 'chroot'
|
||||||
|
|
||||||
# FIXME: Probably needs to be changed to none and clone gst-ci repo each time, sigh
|
|
||||||
# as these jobs *could* run potentially in a fork of smth like -bad
|
|
||||||
# though given our current setup, its only possible to tweak the CI from a gst-ci
|
|
||||||
# fork so it might be fine
|
|
||||||
GIT_STRATEGY: fetch
|
GIT_STRATEGY: fetch
|
||||||
script:
|
script:
|
||||||
- export LOCAL_IMAGE="$CI_REGISTRY_IMAGE/$REPO_SUFFIX:$TAG"
|
- export LOCAL_IMAGE="$CI_REGISTRY_IMAGE/$REPO_SUFFIX:$TAG"
|
||||||
|
- export LOCAL_GST_CI_IMAGE="$CI_REGISTRY/$CI_PROJECT_NAMESPACE/gst-ci/$REPO_SUFFIX:$TAG"
|
||||||
- export GST_UPSTREAM_IMAGE="$CI_REGISTRY/$GST_UPSTREAM_REPO/$REPO_SUFFIX:$TAG"
|
- export GST_UPSTREAM_IMAGE="$CI_REGISTRY/$GST_UPSTREAM_REPO/$REPO_SUFFIX:$TAG"
|
||||||
|
|
||||||
# Newer versions of podman/buildah try to set overlayfs mount options when
|
# Newer versions of podman/buildah try to set overlayfs mount options when
|
||||||
|
@ -178,6 +197,15 @@ variables:
|
||||||
|
|
||||||
- *check_image_exists
|
- *check_image_exists
|
||||||
|
|
||||||
|
# This part of the job should only ever be possible to be reach in a gst-ci fork
|
||||||
|
- |
|
||||||
|
if [[ "$CI_PROJECT_NAME" != 'gst-ci' ]]
|
||||||
|
then
|
||||||
|
echo "ERROR! Something is wrong!"
|
||||||
|
echo "This part of the job is supposed to be executed only in gst-ci forks, and its probably going to fail else"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
- echo "Building image $LOCAL_IMAGE"
|
- echo "Building image $LOCAL_IMAGE"
|
||||||
|
|
||||||
- >
|
- >
|
||||||
|
|
Loading…
Reference in a new issue