ci: Replace custom toolbox image with FDO_DISTRIBUTION_POST_EXEC
We were building a different image cause we needed to do a couple things that are not possible yet through cbuild/ci-templates. Now that we have FDO_DISTRIBUTION_POST_EXEC we can do it on the same job and use the same image tag to extend the image. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9277>
This commit is contained in:
parent
7c4b87cc33
commit
18684c6d04
@ -1,9 +1,9 @@
|
||||
include:
|
||||
- project: 'freedesktop/ci-templates'
|
||||
ref: "1a1fb9ebb233afded69c3dbde51fc58e6d706509"
|
||||
ref: "32afe5644697e503af18a736587c8619fa036a72"
|
||||
file:
|
||||
- '/templates/debian.yml'
|
||||
- '/templates/fedora.yml'
|
||||
- '/templates/debian.yml'
|
||||
###
|
||||
# IMPORTANT
|
||||
# These are the version tags for the docker images the CI runs against.
|
||||
@ -163,6 +163,8 @@ fedora amd64 docker:
|
||||
- '.fdo.container-build@fedora'
|
||||
stage: 'preparation'
|
||||
needs: []
|
||||
variables:
|
||||
FDO_DISTRIBUTION_POST_EXEC: 'bash ci/scripts/build-toolbox-image.sh'
|
||||
# Note: assumption is that placeholder jobs run on a packet runner
|
||||
# (which has faster network connectivity to the registry).
|
||||
tags: [ 'kvm' ]
|
||||
@ -177,21 +179,6 @@ fedora amd64 docker fluster:
|
||||
# (which has faster network connectivity to the registry).
|
||||
tags: [ 'kvm' ]
|
||||
|
||||
# Build a toolbox specific image to workaround ci-templates
|
||||
fedora amd64 toolbox:
|
||||
image: quay.io/freedesktop.org/ci-templates:container-build-base-2024-01-31.0
|
||||
stage: 'preparation'
|
||||
needs: ["fedora amd64 docker"]
|
||||
# Note: assumption is that placeholder jobs run on a packet runner
|
||||
# (which has faster network connectivity to the registry).
|
||||
tags: [ 'kvm' ]
|
||||
variables:
|
||||
GST_CI_IMAGE: !reference [".build fedora x86_64", "variables", FDO_DISTRIBUTION_IMAGE]
|
||||
FDO_DISTRIBUTION_TAG: !reference [".fedora image", "variables", FDO_DISTRIBUTION_TAG]
|
||||
FDO_REPO_SUFFIX: !reference [".fedora image", "variables", FDO_REPO_SUFFIX]
|
||||
script:
|
||||
- bash ci/scripts/build-toolbox-image.sh $GST_CI_IMAGE $FDO_DISTRIBUTION_TAG $GST_UPSTREAM_BRANCH
|
||||
|
||||
.debian image:
|
||||
variables:
|
||||
CCACHE_DIR: '/cache/gstreamer/gstreamer/ccache_debian_containeruser/'
|
||||
|
@ -5,7 +5,7 @@ variables:
|
||||
# If you are hacking on them or need a them to rebuild, its enough
|
||||
# to change any part of the string of the image you want.
|
||||
###
|
||||
FEDORA_TAG: '2025-07-01.0'
|
||||
FEDORA_TAG: '2025-07-02.0-post-push'
|
||||
|
||||
DEBIAN_TAG: '2025-07-01.0'
|
||||
|
||||
|
@ -11,15 +11,9 @@ die() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
check_image_base() {
|
||||
local base=$(
|
||||
skopeo inspect docker://$TOOLBOX_IMAGE 2>/dev/null |
|
||||
jq -r '.Labels["org.opencontainers.image.base.name"]')
|
||||
[[ "$base" == "$BASE_CI_IMAGE" ]]
|
||||
}
|
||||
|
||||
build_container() {
|
||||
echo Building $TOOLBOX_IMAGE from $BASE_CI_IMAGE
|
||||
local tmptag="localhost/rebuilt-tmp-tag"
|
||||
echo Rebuilding image: $BASE_CI_IMAGE
|
||||
|
||||
export BUILDAH_ISOLATION=chroot
|
||||
export BUILDAH_FORMAT=docker
|
||||
@ -116,38 +110,38 @@ build_container() {
|
||||
--label org.opencontainers.image.base.name=$BASE_CI_IMAGE \
|
||||
$build_cntr
|
||||
|
||||
buildah commit $build_cntr $TOOLBOX_IMAGE
|
||||
buildah tag $TOOLBOX_IMAGE $TOOLBOX_LATEST
|
||||
buildah commit $build_cntr $tmptag
|
||||
|
||||
# Retag the image to have the same tag as the base image
|
||||
buildah tag $tmptag $BASE_CI_IMAGE
|
||||
|
||||
# Unmount and remove the container
|
||||
buildah umount "$build_cntr"
|
||||
buildah rm "$build_cntr"
|
||||
}
|
||||
|
||||
BASE_CI_IMAGE="$1"
|
||||
TOOLBOX_BRANCH="$2"
|
||||
GST_UPSTREAM_BRANCH="$3"
|
||||
gstbranch="${GST_UPSTREAM_BRANCH:-main}"
|
||||
|
||||
TOOLBOX_IMAGE="$CI_REGISTRY_IMAGE/$FDO_REPO_SUFFIX:gst-toolbox-${TOOLBOX_BRANCH}"
|
||||
# push an unversioned tag to make it easier to use.
|
||||
# ex. pull foobar:toolbox-main
|
||||
TOOLBOX_LATEST="$CI_REGISTRY_IMAGE/$FDO_REPO_SUFFIX:gst-toolbox-${GST_UPSTREAM_BRANCH}"
|
||||
|
||||
[[ -n "$BASE_CI_IMAGE" && -n "$TOOLBOX_BRANCH" && -n "$GST_UPSTREAM_BRANCH" ]] ||
|
||||
die "Usage: $(basename $0) BASE_CI_IMAGE TOOLBOX TAG GST_UPSTREAM_BRANCH"
|
||||
[[ -n "$BASE_CI_IMAGE" ]] ||
|
||||
die "Usage: $(basename $0) BASE_CI_IMAGE "
|
||||
|
||||
[[ -n "$CI_REGISTRY" && -n "$CI_REGISTRY_USER" && -n "$CI_REGISTRY_PASSWORD" ]] ||
|
||||
die "Insufficient information to log in."
|
||||
|
||||
podman login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||
|
||||
if ! check_image_base; then
|
||||
build_container
|
||||
build_container
|
||||
|
||||
podman push "$TOOLBOX_IMAGE"
|
||||
if [ "$GST_UPSTREAM_BRANCH" == "$CI_COMMIT_BRANCH" ]; then
|
||||
podman push "$TOOLBOX_LATEST"
|
||||
fi
|
||||
echo "Publishing $BASE_CI_IMAGE"
|
||||
podman push "$BASE_CI_IMAGE"
|
||||
|
||||
# Publish an unversioned ref as well that we can always fetch
|
||||
if [ "$CI_COMMIT_BRANCH" == "main" ] && [ "$CI_PROJECT_NAMESAPCE" == "gstreamer" ]; then
|
||||
latest="$CI_REGISTRY_IMAGE/$FDO_REPO_SUFFIX:gst-toolbox-main"
|
||||
podman tag "$BASE_CI_IMAGE" "$latest"
|
||||
podman push "$latest"
|
||||
fi
|
||||
|
||||
echo "Create your toolbox with either of the following commands"
|
||||
echo " $ toolbox create gst-$TOOLBOX_BRANCH --image $TOOLBOX_IMAGE"
|
||||
if [ "$GST_UPSTREAM_BRANCH" == "$CI_COMMIT_BRANCH" ]; then
|
||||
echo " $ toolbox create gst-$GST_UPSTREAM_BRANCH --image $TOOLBOX_LATEST"
|
||||
fi
|
||||
echo " $ toolbox create gst-$gstbranch --image $BASE_CI_IMAGE"
|
||||
|
Loading…
x
Reference in New Issue
Block a user