ci: Add a metadata file into the images we build

Create a file we can check at runtime, and identify if the
environment we run against is one of our CI build images.
Useful mostly for our internal scritps so we can  match against
metadata rather than heuristics, ex. if /subprojects exists

Conceptually similar to /.flatpak-info

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8763>
This commit is contained in:
Jordan Petridis 2025-04-02 12:07:51 +03:00 committed by GStreamer Marge Bot
parent d5e9779e55
commit 936a3cefcd
4 changed files with 26 additions and 3 deletions

View File

@ -2,6 +2,8 @@
set -eux
bash ./ci/scripts/create-ci-identifier.sh
bash ./ci/docker/debian/install-deps.sh
bash ./ci/scripts/install-rust.sh

View File

@ -2,6 +2,8 @@
set -eux
bash ./ci/scripts/create-ci-identifier.sh
bash ./ci/docker/fedora/install-deps.sh
# Configure git for various usage

View File

@ -0,0 +1,12 @@
#! /bin/bash
# Create a file we can check at runtime, and identify if the environment we
# run against is one of our CI build images.
# Useful mostly for our internal scripts so we can match against metadata
# rather than heuristics, ex. if /subprojects exists
#
# Conceptually similar to /.flatpak-info
# We can also later on add various metadata once we need to.
# Preferebly in an .ini format
touch /.gstreamer-ci-linux-image
chmod 644 /.gstreamer-ci-linux-image

View File

@ -1,12 +1,20 @@
#! /bin/bash
image_cache="${SUBPROJECTS_CACHE_DIR:-}"
ci_image_info="/.gstreamer-ci-linux-image";
# Print useful metadata at the start of the build
if [[ -e "/etc/os-release" ]]; then
cat /etc/os-release
fi
if [[ -e "$ci_image_info" && -n "${CI:-}" ]]; then
if [[ -z "$image_cache" ]]; then
echo "Running in CI but haven't defined SUBPROJECTS_CACHE_DIR"
exit 1
fi
fi
whoami
id -u
id -g
@ -15,10 +23,9 @@ echo $SHELL
echo $PATH
# On the CI image we install the rust toolcahin under this path
# If it exists set the HOME and PATH variables and print the versions
# set the HOME and PATH variables and print the versions
# of what we have installed
cargo_binary="/usr/local/cargo/bin/cargo";
if [[ -e "$cargo_binary" ]]; then
if [[ -e "$ci_image_info" ]]; then
export RUSTUP_HOME="/usr/local/rustup"
export CARGO_HOME="/usr/local/cargo"
export PATH="/usr/local/cargo/bin:$PATH"