Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitlab/ci/container-build.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
script:
- CACHE_TO=""
- |
if [ "$C0_GH_REF_NAME" = "main" ]; then
if [ "$C0_GH_REF_NAME" = "main" ] && ! compgen -v | grep -q '^OVERRIDE_.*_VERSION$'; then
CACHE_TO="--cache-to type=registry,ref=ghcr.io/code0-tech/reticulum/ci-cache:${image}-${PLATFORM}"
fi
- >
Expand All @@ -52,7 +52,7 @@
script:
- CACHE_TO=""
- |
if [ "$C0_GH_REF_NAME" = "main" ]; then
if [ "$C0_GH_REF_NAME" = "main" ] && ! compgen -v | grep -q '^OVERRIDE_.*_VERSION$'; then
CACHE_TO="--cache-to type=registry,ref=ghcr.io/code0-tech/reticulum/ci-cache:${image}-${VARIANT}-${PLATFORM}"
fi
- >
Expand Down
23 changes: 18 additions & 5 deletions support/helpers.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function download_project() {
project=$1
version=$(cat versions/$project)
version=$(get_component_version $project)
echo "Downloading $project at $version"
mkdir -p projects
curl --output projects/$project.tar.gz --fail-with-body -L "https://github.com/code0-tech/$project/archive/$version.tar.gz" || return 10
Expand Down Expand Up @@ -39,8 +39,8 @@ function build_image() {
build_args+=" --label org.opencontainers.image.source=https://github.com/code0-tech/reticulum"
build_args+=" --label org.opencontainers.image.version=$reticulum_tag"

if [ -e "versions/$image" ]; then
build_args+=" --label org.opencontainers.image.revision=$(cat versions/$image)"
if [[ -n "$(get_component_version $image)" ]]; then
build_args+=" --label org.opencontainers.image.revision=$(get_component_version $image)"
fi

docker buildx build \
Expand All @@ -59,8 +59,8 @@ function create_manifest() {
args+=(--annotation "index:org.opencontainers.image.source=https://github.com/code0-tech/reticulum")
args+=(--annotation "index:org.opencontainers.image.version=$reticulum_tag")

if [ -e "versions/$image" ]; then
args+=(--annotation "index:org.opencontainers.image.revision=$(cat versions/$image)")
if [[ -n "$(get_component_version $image)" ]]; then
args+=(--annotation "index:org.opencontainers.image.revision=$(get_component_version $image)")
fi

for manifest in manifest-*.json; do
Expand All @@ -79,3 +79,16 @@ function get_image_tag() {
echo $reticulum_tag-$reticulum_variant
fi
}

function get_component_version() {
component=$1
override_variable="OVERRIDE_${component}_VERSION"

if [[ -n "${!override_variable:+x}" ]]; then
echo ${!override_variable}
elif [[ -e "versions/$component" ]]; then
cat versions/$component
else
echo ""
fi
}