From e7aca50345671b602a16047fb55697a5a8a62b12 Mon Sep 17 00:00:00 2001 From: Oliver Pajonk Date: Wed, 29 Oct 2025 12:23:21 +0000 Subject: [PATCH 1/3] aside: bump version of docker-in-docker ... just because. --- .devcontainer/devcontainer-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer-lock.json b/.devcontainer/devcontainer-lock.json index 681a747..4a5dc27 100644 --- a/.devcontainer/devcontainer-lock.json +++ b/.devcontainer/devcontainer-lock.json @@ -6,9 +6,9 @@ "integrity": "sha256:6e0bb2ce80caca1d94f44dab5d0653d88a1c00984e590adb7c6bce012d0ade6e" }, "ghcr.io/devcontainers/features/docker-in-docker:2": { - "version": "2.12.2", - "resolved": "ghcr.io/devcontainers/features/docker-in-docker@sha256:842d2ed40827dc91b95ef727771e170b0e52272404f00dba063cee94eafac4bb", - "integrity": "sha256:842d2ed40827dc91b95ef727771e170b0e52272404f00dba063cee94eafac4bb" + "version": "2.12.4", + "resolved": "ghcr.io/devcontainers/features/docker-in-docker@sha256:7f32d985aac6929b4f37cf8a0bdb9196473e9e192281a3d708207a70633f83df", + "integrity": "sha256:7f32d985aac6929b4f37cf8a0bdb9196473e9e192281a3d708207a70633f83df" }, "ghcr.io/devcontainers/features/git-lfs:1": { "version": "1.2.5", From 8aead3753c834db04088b5e939d9bb3713a93bad Mon Sep 17 00:00:00 2001 From: Oliver Pajonk Date: Wed, 29 Oct 2025 12:28:30 +0000 Subject: [PATCH 2/3] extend the publish script to multiarch There are problems with creating multiarch devcontainers in one go via buildx and docker. One of the several solutions is to build and push per-architecture-tags, then create a merged metadata file with *all* architectures in one tag. Not perfect, but fits the current structure best (with docker-in-docker etc.) --- scripts/publish.sh | 55 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/scripts/publish.sh b/scripts/publish.sh index 1dbca82..c4eb3e1 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -1,19 +1,52 @@ #!/usr/bin/env bash set -euxo pipefail -IMAGES=("--image-name \"ghcr.io/eclipse-score/devcontainer:main\"") -if [ "$#" -gt 0 ]; then - IMAGES=() - for arg in "$@"; do - IMAGES+=("--image-name \"ghcr.io/eclipse-score/devcontainer:${arg}\"") +# Define target architectures +ARCHITECTURES=("amd64" "arm64") + +# Prepare manifest creation command +MANIFEST_MAIN_CALL="docker manifest create ghcr.io/eclipse-score/devcontainer:main" + +for ARCH in "${ARCHITECTURES[@]}"; do + echo "Building for architecture: ${ARCH}" + + # Prepare image names - they should include the architectures and also tags if provided + IMAGES=("--image-name \"ghcr.io/eclipse-score/devcontainer:main-${ARCH}\"") + # Handle additional tags if provided + if [ "$#" -gt 0 ]; then + IMAGES=() + for arg in "$@"; do + IMAGES+=("--image-name \"ghcr.io/eclipse-score/devcontainer:${arg}\"") + done + fi + + # Prepare devcontainer build command + DEVCONTAINER_CALL="devcontainer build --push --workspace-folder src/s-core-devcontainer --cache-from ghcr.io/eclipse-score/devcontainer" + + # Append image names to the build command + for IMAGE in "${IMAGES[@]}"; do + DEVCONTAINER_CALL+=" $IMAGE" done -fi -DEVCONTAINER_CALL="devcontainer build --push --workspace-folder src/s-core-devcontainer --cache-from ghcr.io/eclipse-score/devcontainer" + # Execute the build for the specific architecture + eval "$DEVCONTAINER_CALL --platform linux/${ARCH}" -for IMAGE in "${IMAGES[@]}"; do - DEVCONTAINER_CALL+=" $IMAGE" + # Append the architecture-specific image to the manifest creation command (those need to be merged into *one* manifest) + MANIFEST_MAIN_CALL+="ghcr.io/eclipse-score/devcontainer:main-${ARCH}" done -eval "$DEVCONTAINER_CALL --platform linux/arm64" -eval "$DEVCONTAINER_CALL --platform linux/amd64" +# Create and push the manifest for 'main' tag +eval "$MANIFEST_MAIN_CALL" +docker manifest push ghcr.io/eclipse-score/devcontainer:main + +# If additional tags are provided: merge metadata and push those as well +if [ "$#" -gt 0 ]; then + for arg in "$@"; do + MANIFEST_TAG_CALL="docker manifest create ghcr.io/eclipse-score/devcontainer:${arg}" + for ARCH in "${ARCHITECTURES[@]}"; do + MANIFEST_TAG_CALL+=" ghcr.io/eclipse-score/devcontainer:${arg}-${ARCH}" + done + eval "$MANIFEST_TAG_CALL" + docker manifest push ghcr.io/eclipse-score/devcontainer:${arg} + done +fi From c49ef8d97637eae51fadc129041b128a277994a2 Mon Sep 17 00:00:00 2001 From: Oliver Pajonk Date: Wed, 29 Oct 2025 13:28:13 +0000 Subject: [PATCH 3/3] replace git and git-lfs features with apt calls this dramatically speeds up the builds, and the exact tool versions probably do not matter that much. --- .../.devcontainer/devcontainer-lock.json | 10 ---------- .../.devcontainer/devcontainer.json | 10 ---------- .../.devcontainer/s-core-local/install.sh | 4 ++++ .../.devcontainer/s-core-local/tests/test_default.sh | 4 ++++ .../.devcontainer/s-core-local/versions.yaml | 6 ++++++ src/s-core-devcontainer/test-project/test.sh | 4 ---- 6 files changed, 14 insertions(+), 24 deletions(-) diff --git a/src/s-core-devcontainer/.devcontainer/devcontainer-lock.json b/src/s-core-devcontainer/.devcontainer/devcontainer-lock.json index d857f7f..4f1a4f3 100644 --- a/src/s-core-devcontainer/.devcontainer/devcontainer-lock.json +++ b/src/s-core-devcontainer/.devcontainer/devcontainer-lock.json @@ -10,16 +10,6 @@ "resolved": "ghcr.io/devcontainers/features/common-utils@sha256:00fd45550f578d9d515044d9e2226e908dbc3d7aa6fcb9dee4d8bdb60be114cf", "integrity": "sha256:00fd45550f578d9d515044d9e2226e908dbc3d7aa6fcb9dee4d8bdb60be114cf" }, - "ghcr.io/devcontainers/features/git": { - "version": "1.3.4", - "resolved": "ghcr.io/devcontainers/features/git@sha256:f24645e64ad39a596131a50ec96f7d5cf7a2a87544cce772dd4b7182a233e98a", - "integrity": "sha256:f24645e64ad39a596131a50ec96f7d5cf7a2a87544cce772dd4b7182a233e98a" - }, - "ghcr.io/devcontainers/features/git-lfs": { - "version": "1.2.5", - "resolved": "ghcr.io/devcontainers/features/git-lfs@sha256:71c2b371cf12ab7fcec47cf17369c6f59156100dad9abf9e4c593049d789de72", - "integrity": "sha256:71c2b371cf12ab7fcec47cf17369c6f59156100dad9abf9e4c593049d789de72" - }, "ghcr.io/devcontainers/features/rust": { "version": "1.5.0", "resolved": "ghcr.io/devcontainers/features/rust@sha256:0c55e65f2e3df736e478f26ee4d5ed41bae6b54dac1318c443e31444c8ed283c", diff --git a/src/s-core-devcontainer/.devcontainer/devcontainer.json b/src/s-core-devcontainer/.devcontainer/devcontainer.json index 241c872..8a0e60b 100644 --- a/src/s-core-devcontainer/.devcontainer/devcontainer.json +++ b/src/s-core-devcontainer/.devcontainer/devcontainer.json @@ -5,14 +5,6 @@ "context": "." }, "features": { - "ghcr.io/devcontainers/features/git": { - "version": "2.49.0", - "ppa": "true" - }, - "ghcr.io/devcontainers/features/git-lfs": { - "version": "3.7.0", - "autoPull": "false" // do not automatically pull LFS files when creating the container - }, "ghcr.io/devcontainers/features/common-utils": { // Installs latest version from the Distribution "installZsh": "false", @@ -42,8 +34,6 @@ "overrideFeatureInstallOrder": [ // this order makes it more convenient to develop the s-core-local feature, since it will be installed last // which means changes to it will be applied without needing to rebuild all other features - "ghcr.io/devcontainers/features/git", - "ghcr.io/devcontainers/features/git-lfs", "ghcr.io/devcontainers/features/common-utils", "ghcr.io/devcontainers-community/features/llvm", "ghcr.io/devcontainers/features/rust", diff --git a/src/s-core-devcontainer/.devcontainer/s-core-local/install.sh b/src/s-core-devcontainer/.devcontainer/s-core-local/install.sh index b26366c..36ebec1 100755 --- a/src/s-core-devcontainer/.devcontainer/s-core-local/install.sh +++ b/src/s-core-devcontainer/.devcontainer/s-core-local/install.sh @@ -30,6 +30,10 @@ apt-get install -y graphviz="${graphviz_version}*" # Protobuf compiler, via APT (needed by FEO) apt-get install -y protobuf-compiler="${protobuf_compiler_version}*" +# Git and Git LFS, via APT +apt-get install -y git +apt-get install -y git-lfs + # Python, via APT apt-get install -y python${python_version} python3-pip python3-venv # The following packages correspond to the list of packages installed by the diff --git a/src/s-core-devcontainer/.devcontainer/s-core-local/tests/test_default.sh b/src/s-core-devcontainer/.devcontainer/s-core-local/tests/test_default.sh index 889306c..9c39f27 100755 --- a/src/s-core-devcontainer/.devcontainer/s-core-local/tests/test_default.sh +++ b/src/s-core-devcontainer/.devcontainer/s-core-local/tests/test_default.sh @@ -13,6 +13,10 @@ check "validate graphviz has the correct version" bash -c "dpkg -s graphviz | gr # Other build-related tools check "validate protoc is working and has the correct version" bash -c "protoc --version | grep 'libprotoc ${protobuf_compiler_version}'" +# Common tooling +check "validate git is working and has the correct version" bash -c "git --version | grep '${git_version}'" +check "validate git-lfs is working and has the correct version" bash -c "git lfs version | grep '${git_lfs_version}'" + # Python-related tools (a selected sub-set; others may be added later) check "validate python3 is working and has the correct version" bash -c "python3 --version | grep '${python_version}'" check "validate pip3 is working and has the correct version" bash -c "pip3 --version | grep '${python_version}'" diff --git a/src/s-core-devcontainer/.devcontainer/s-core-local/versions.yaml b/src/s-core-devcontainer/.devcontainer/s-core-local/versions.yaml index f16c5f0..09205d7 100644 --- a/src/s-core-devcontainer/.devcontainer/s-core-local/versions.yaml +++ b/src/s-core-devcontainer/.devcontainer/s-core-local/versions.yaml @@ -10,6 +10,12 @@ qemu_system_arm: sshpass: version: 1.09 +git: + version: "2.43.0" + +git_lfs: + version: "3.4.1" + python: version: "3.12" diff --git a/src/s-core-devcontainer/test-project/test.sh b/src/s-core-devcontainer/test-project/test.sh index 329c4c4..1afeb65 100755 --- a/src/s-core-devcontainer/test-project/test.sh +++ b/src/s-core-devcontainer/test-project/test.sh @@ -5,10 +5,6 @@ SCRIPT_PATH=$(readlink -f "$0") SCRIPT_DIR=$(dirname -- "${SCRIPT_PATH}") source "${SCRIPT_DIR}/../../../scripts/test-utils.sh" vscode -# Common tooling -check "validate git is working and has the correct version" bash -c "git --version | grep '2.49.0'" -check "validate git-lfs is working and has the correct version" bash -c "git lfs version | grep '3.7.0'" - # C++ tooling check "validate clangd is working and has the correct version" bash -c "clangd --version | grep '20.1.8'" check "validate clang-format is working and has the correct version" bash -c "clang-format --version | grep '20.1.8'"