From ae855cfe2bac19226a4637eaa1e09b5c08c9e1da Mon Sep 17 00:00:00 2001 From: Pietro Abate Date: Tue, 15 Jul 2025 15:14:31 +0200 Subject: [PATCH 1/6] base images: restrict proxy to deb.debian.org --- images/base-images/Dockerfile.debian | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/base-images/Dockerfile.debian b/images/base-images/Dockerfile.debian index 5490ee914f34..8d835607fc4b 100644 --- a/images/base-images/Dockerfile.debian +++ b/images/base-images/Dockerfile.debian @@ -9,7 +9,7 @@ ENV TZ=Etc/UTC # Setup proxy ARG APT_PROXY ENV APT_PROXY=${APT_PROXY:-false} -RUN echo "Acquire::http::Proxy \"$APT_PROXY\";" > /etc/apt/apt.conf.d/01proxy +RUN echo "Acquire::http::Proxy::deb.debian.org \"$APT_PROXY\";" > /etc/apt/apt.conf.d/01proxy # install datadog static binary COPY images/scripts/install_datadog_static.sh /tmp -- GitLab From 5d569c88f5ad863d674495349126391582be7d92 Mon Sep 17 00:00:00 2001 From: Pietro Abate Date: Tue, 15 Jul 2025 14:40:37 +0200 Subject: [PATCH 2/6] images: refactor packages dependency image --- images/packages/debian-deps-build.Dockerfile | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/images/packages/debian-deps-build.Dockerfile b/images/packages/debian-deps-build.Dockerfile index 19dc6ed61602..963ea3c62ee0 100644 --- a/images/packages/debian-deps-build.Dockerfile +++ b/images/packages/debian-deps-build.Dockerfile @@ -5,7 +5,6 @@ FROM ${IMAGE} ARG DEBIAN_FRONTEND=noninteractive ENV TZ=Etc/UTC -ENV BLST_PORTABLE=true # Build blst used by ocaml-bls12-381 without ADX to support old CPU # architectures. @@ -13,10 +12,7 @@ ENV BLST_PORTABLE=true # https://gitlab.com/dannywillems/ocaml-bls12-381/-/merge_requests/135/ ENV BLST_PORTABLE=true -ARG APT_PROXY -ENV APT_PROXY=${APT_PROXY:-false} COPY --chown=tezos:tezos \ - images/scripts/install_datadog_static.sh \ images/scripts/install_sccache_static.sh \ images/scripts/install_opam_static.sh \ scripts/kiss-fetch.sh \ @@ -27,8 +23,7 @@ COPY --chown=tezos:tezos \ # We install sccache as a static binary because at the moment of writing # the package sccache is not available on ubuntu jammy #hadolint ignore=DL3008,DL3009 -RUN echo "Acquire::http::Proxy \"$APT_PROXY\";" > /etc/apt/apt.conf.d/01proxy && \ - apt-get update && \ +RUN apt-get update && \ apt-get install --no-install-recommends -y bubblewrap \ rsync git m4 build-essential \ patch unzip curl wget ca-certificates \ @@ -44,7 +39,6 @@ RUN echo "Acquire::http::Proxy \"$APT_PROXY\";" > /etc/apt/apt.conf.d/01proxy && rm -rf /var/lib/apt/lists/* RUN /tmp/install_sccache_static.sh && \ - /tmp/install_datadog_static.sh && \ /tmp/install_opam_static.sh COPY --link scripts/version.sh /root/tezos/scripts/ -- GitLab From 177202308d4ede191811e5de197098055820ea85 Mon Sep 17 00:00:00 2001 From: Pietro Abate Date: Tue, 15 Jul 2025 14:15:35 +0200 Subject: [PATCH 3/6] ciao: use base tezos images --- .gitlab/ci/pipelines/before_merging.yml | 2 +- .gitlab/ci/pipelines/debian_repository_full.yml | 6 +++--- .gitlab/ci/pipelines/debian_repository_partial.yml | 6 +++--- .gitlab/ci/pipelines/debian_repository_partial_auto.yml | 6 +++--- .gitlab/ci/pipelines/homebrew.yml | 4 ++-- .gitlab/ci/pipelines/homebrew_auto.yml | 4 ++-- .gitlab/ci/pipelines/merge_train.yml | 2 +- .gitlab/ci/pipelines/non_release_tag.yml | 4 ++-- .gitlab/ci/pipelines/non_release_tag_test.yml | 4 ++-- .gitlab/ci/pipelines/octez_beta_release_tag.yml | 4 ++-- .gitlab/ci/pipelines/octez_major_release_tag_test.yml | 4 ++-- .gitlab/ci/pipelines/octez_minor_release_tag_test.yml | 4 ++-- .gitlab/ci/pipelines/octez_release_tag.yml | 4 ++-- .gitlab/ci/pipelines/schedule_extended_test.yml | 2 +- .gitlab/ci/pipelines/schedule_master_test_release.yml | 4 ++-- ci/lib_tezos_ci/tezos_ci.ml | 3 ++- scripts/ci/build-packages-dependencies.sh | 2 +- 17 files changed, 33 insertions(+), 32 deletions(-) diff --git a/.gitlab/ci/pipelines/before_merging.yml b/.gitlab/ci/pipelines/before_merging.yml index a01cd0cd231f..baaf8c7a41aa 100644 --- a/.gitlab/ci/pipelines/before_merging.yml +++ b/.gitlab/ci/pipelines/before_merging.yml @@ -3920,7 +3920,7 @@ oc.unified_coverage: coverage: '/Coverage: ([^%]+%)/' documentation:install_python_bookworm: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: test tags: - gcp diff --git a/.gitlab/ci/pipelines/debian_repository_full.yml b/.gitlab/ci/pipelines/debian_repository_full.yml index bc307e504a8e..c91ebcd32be9 100644 --- a/.gitlab/ci/pipelines/debian_repository_full.yml +++ b/.gitlab/ci/pipelines/debian_repository_full.yml @@ -203,7 +203,7 @@ oc.build-data_packages: - packages/$DISTRIBUTION/$RELEASE apt_repo_debian: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: publish tags: - gcp @@ -348,7 +348,7 @@ apt_repo_ubuntu: - runner_system_failure oc.lintian_debian: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: publishing_tests tags: - gcp @@ -368,7 +368,7 @@ oc.lintian_debian: variables: {} oc.install_bin_debian_bookworm: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: publishing_tests tags: - gcp diff --git a/.gitlab/ci/pipelines/debian_repository_partial.yml b/.gitlab/ci/pipelines/debian_repository_partial.yml index 649d3fda47b5..2586a5c9c757 100644 --- a/.gitlab/ci/pipelines/debian_repository_partial.yml +++ b/.gitlab/ci/pipelines/debian_repository_partial.yml @@ -163,7 +163,7 @@ oc.build-data_packages: - packages/$DISTRIBUTION/$RELEASE apt_repo_debian: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: publish tags: - gcp @@ -195,7 +195,7 @@ apt_repo_debian: - runner_system_failure oc.lintian_debian: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: publishing_tests tags: - gcp @@ -215,7 +215,7 @@ oc.lintian_debian: variables: {} oc.install_bin_debian_bookworm: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: publishing_tests tags: - gcp diff --git a/.gitlab/ci/pipelines/debian_repository_partial_auto.yml b/.gitlab/ci/pipelines/debian_repository_partial_auto.yml index 649d3fda47b5..2586a5c9c757 100644 --- a/.gitlab/ci/pipelines/debian_repository_partial_auto.yml +++ b/.gitlab/ci/pipelines/debian_repository_partial_auto.yml @@ -163,7 +163,7 @@ oc.build-data_packages: - packages/$DISTRIBUTION/$RELEASE apt_repo_debian: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: publish tags: - gcp @@ -195,7 +195,7 @@ apt_repo_debian: - runner_system_failure oc.lintian_debian: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: publishing_tests tags: - gcp @@ -215,7 +215,7 @@ oc.lintian_debian: variables: {} oc.install_bin_debian_bookworm: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: publishing_tests tags: - gcp diff --git a/.gitlab/ci/pipelines/homebrew.yml b/.gitlab/ci/pipelines/homebrew.yml index 614d9161d930..8d0bcbec1333 100644 --- a/.gitlab/ci/pipelines/homebrew.yml +++ b/.gitlab/ci/pipelines/homebrew.yml @@ -26,7 +26,7 @@ datadog_pipeline_trace: --tags mr_number:$CI_MERGE_REQUEST_IID oc.install-homebrew: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: build tags: - gcp_very_high_cpu @@ -48,7 +48,7 @@ oc.install-homebrew: CARGO_NET_OFFLINE: "false" oc.build-homebrew: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: build tags: - gcp diff --git a/.gitlab/ci/pipelines/homebrew_auto.yml b/.gitlab/ci/pipelines/homebrew_auto.yml index 614d9161d930..8d0bcbec1333 100644 --- a/.gitlab/ci/pipelines/homebrew_auto.yml +++ b/.gitlab/ci/pipelines/homebrew_auto.yml @@ -26,7 +26,7 @@ datadog_pipeline_trace: --tags mr_number:$CI_MERGE_REQUEST_IID oc.install-homebrew: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: build tags: - gcp_very_high_cpu @@ -48,7 +48,7 @@ oc.install-homebrew: CARGO_NET_OFFLINE: "false" oc.build-homebrew: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: build tags: - gcp diff --git a/.gitlab/ci/pipelines/merge_train.yml b/.gitlab/ci/pipelines/merge_train.yml index f0939aecabf2..cfb496ac6ff2 100644 --- a/.gitlab/ci/pipelines/merge_train.yml +++ b/.gitlab/ci/pipelines/merge_train.yml @@ -3919,7 +3919,7 @@ oc.unified_coverage: coverage: '/Coverage: ([^%]+%)/' documentation:install_python_bookworm: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: test tags: - gcp diff --git a/.gitlab/ci/pipelines/non_release_tag.yml b/.gitlab/ci/pipelines/non_release_tag.yml index cb4e02527224..18a0747b5ec3 100644 --- a/.gitlab/ci/pipelines/non_release_tag.yml +++ b/.gitlab/ci/pipelines/non_release_tag.yml @@ -235,7 +235,7 @@ oc.docker:arm64: EXECUTABLE_FILES: script-inputs/released-executables oc.install-release-homebrew: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: build tags: - gcp @@ -422,7 +422,7 @@ oc.build-data_packages: - packages/$DISTRIBUTION/$RELEASE apt_repo_debian: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: publish tags: - gcp diff --git a/.gitlab/ci/pipelines/non_release_tag_test.yml b/.gitlab/ci/pipelines/non_release_tag_test.yml index c018129e4da8..383887f94473 100644 --- a/.gitlab/ci/pipelines/non_release_tag_test.yml +++ b/.gitlab/ci/pipelines/non_release_tag_test.yml @@ -235,7 +235,7 @@ oc.docker:arm64: EXECUTABLE_FILES: script-inputs/released-executables script-inputs/experimental-executables oc.install-release-homebrew: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: build tags: - gcp @@ -422,7 +422,7 @@ oc.build-data_packages: - packages/$DISTRIBUTION/$RELEASE apt_repo_debian: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: publish tags: - gcp diff --git a/.gitlab/ci/pipelines/octez_beta_release_tag.yml b/.gitlab/ci/pipelines/octez_beta_release_tag.yml index 9b5cbf2597bd..b836203603ee 100644 --- a/.gitlab/ci/pipelines/octez_beta_release_tag.yml +++ b/.gitlab/ci/pipelines/octez_beta_release_tag.yml @@ -235,7 +235,7 @@ oc.docker:arm64: EXECUTABLE_FILES: script-inputs/released-executables oc.install-release-homebrew: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: build tags: - gcp @@ -424,7 +424,7 @@ oc.build-data_packages: - packages/$DISTRIBUTION/$RELEASE apt_repo_debian: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: publish tags: - gcp diff --git a/.gitlab/ci/pipelines/octez_major_release_tag_test.yml b/.gitlab/ci/pipelines/octez_major_release_tag_test.yml index de1e997d7df4..4e290db8a856 100644 --- a/.gitlab/ci/pipelines/octez_major_release_tag_test.yml +++ b/.gitlab/ci/pipelines/octez_major_release_tag_test.yml @@ -235,7 +235,7 @@ oc.docker:arm64: EXECUTABLE_FILES: script-inputs/released-executables script-inputs/experimental-executables oc.install-release-homebrew: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: build tags: - gcp @@ -424,7 +424,7 @@ oc.build-data_packages: - packages/$DISTRIBUTION/$RELEASE apt_repo_debian: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: publish tags: - gcp diff --git a/.gitlab/ci/pipelines/octez_minor_release_tag_test.yml b/.gitlab/ci/pipelines/octez_minor_release_tag_test.yml index 8f420b3221ad..ec14403fef33 100644 --- a/.gitlab/ci/pipelines/octez_minor_release_tag_test.yml +++ b/.gitlab/ci/pipelines/octez_minor_release_tag_test.yml @@ -214,7 +214,7 @@ oc.docker:arm64: EXECUTABLE_FILES: script-inputs/released-executables script-inputs/experimental-executables oc.install-release-homebrew: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: build tags: - gcp @@ -403,7 +403,7 @@ oc.build-data_packages: - packages/$DISTRIBUTION/$RELEASE apt_repo_debian: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: publish tags: - gcp diff --git a/.gitlab/ci/pipelines/octez_release_tag.yml b/.gitlab/ci/pipelines/octez_release_tag.yml index 1f66baaf04a9..9d66047ba78f 100644 --- a/.gitlab/ci/pipelines/octez_release_tag.yml +++ b/.gitlab/ci/pipelines/octez_release_tag.yml @@ -214,7 +214,7 @@ oc.docker:arm64: EXECUTABLE_FILES: script-inputs/released-executables oc.install-release-homebrew: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: build tags: - gcp @@ -403,7 +403,7 @@ oc.build-data_packages: - packages/$DISTRIBUTION/$RELEASE apt_repo_debian: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: publish tags: - gcp diff --git a/.gitlab/ci/pipelines/schedule_extended_test.yml b/.gitlab/ci/pipelines/schedule_extended_test.yml index 3363be2668b2..5289a1607c0e 100644 --- a/.gitlab/ci/pipelines/schedule_extended_test.yml +++ b/.gitlab/ci/pipelines/schedule_extended_test.yml @@ -3519,7 +3519,7 @@ documentation:install_python_jammy: - ./docs/developer/install-python-debian-ubuntu.sh tezos/tezos master documentation:install_python_bookworm: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: test tags: - gcp diff --git a/.gitlab/ci/pipelines/schedule_master_test_release.yml b/.gitlab/ci/pipelines/schedule_master_test_release.yml index 1732edbd3bcc..7a072c6db066 100644 --- a/.gitlab/ci/pipelines/schedule_master_test_release.yml +++ b/.gitlab/ci/pipelines/schedule_master_test_release.yml @@ -235,7 +235,7 @@ oc.docker:arm64: EXECUTABLE_FILES: script-inputs/released-executables script-inputs/experimental-executables oc.install-release-homebrew: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: build tags: - gcp @@ -425,7 +425,7 @@ oc.build-data_packages: - packages/$DISTRIBUTION/$RELEASE apt_repo_debian: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm stage: publish tags: - gcp diff --git a/ci/lib_tezos_ci/tezos_ci.ml b/ci/lib_tezos_ci/tezos_ci.ml index 555be1fce9f2..cd8ed9e4ffee 100644 --- a/ci/lib_tezos_ci/tezos_ci.ml +++ b/ci/lib_tezos_ci/tezos_ci.ml @@ -1364,7 +1364,8 @@ module Images_external = struct external image below and the internal image [e2etest]. *) let datadog_ci = Image.mk_external ~image_path:"datadog/ci:v2.44.0" - let debian_bookworm = Image.mk_external ~image_path:"debian:bookworm" + let debian_bookworm = + Image.mk_external ~image_path:"${GCP_REGISTRY}/tezos/tezos/debian:bookworm" let ubuntu_noble = Image.mk_external ~image_path:"public.ecr.aws/lts/ubuntu:24.04_stable" diff --git a/scripts/ci/build-packages-dependencies.sh b/scripts/ci/build-packages-dependencies.sh index e655bb7f532f..d8e18a481ab0 100755 --- a/scripts/ci/build-packages-dependencies.sh +++ b/scripts/ci/build-packages-dependencies.sh @@ -38,7 +38,7 @@ docker build \ --label "com.tezos.build-tezos-revision"="${CI_COMMIT_SHA}" \ -f "$DOCKERFILE" \ --build-arg=BUILDKIT_INLINE_CACHE=1 \ - --build-arg IMAGE="$DISTRIBUTION:$RELEASE" \ + --build-arg IMAGE="${GCP_REGISTRY}/tezos/tezos/$DISTRIBUTION:$RELEASE" \ --build-arg APT_PROXY="${APT_PROXY_DEB:-}" \ --cache-from="${DEP_IMAGE}:${ARCHITECTURE}-${CI_COMMIT_REF_SLUG}" \ --cache-from="${DEP_IMAGE_PROTECTED}:master" \ -- GitLab From aae1eff44b796d33b586157d49df5964a69a1e71 Mon Sep 17 00:00:00 2001 From: Pietro Abate Date: Tue, 15 Jul 2025 15:50:35 +0200 Subject: [PATCH 4/6] ciao: add docker base images tag job --- .gitlab/ci/pipelines/before_merging.yml | 2 +- .../ci/pipelines/debian_repository_full.yml | 29 +++++++++++++++++-- .../pipelines/debian_repository_partial.yml | 29 +++++++++++++++++-- .../debian_repository_partial_auto.yml | 29 +++++++++++++++++-- .gitlab/ci/pipelines/homebrew.yml | 4 +-- .gitlab/ci/pipelines/homebrew_auto.yml | 4 +-- .gitlab/ci/pipelines/merge_train.yml | 2 +- .gitlab/ci/pipelines/non_release_tag.yml | 27 +++++++++++++++-- .gitlab/ci/pipelines/non_release_tag_test.yml | 27 +++++++++++++++-- .../ci/pipelines/octez_beta_release_tag.yml | 27 +++++++++++++++-- .../octez_major_release_tag_test.yml | 27 +++++++++++++++-- .../octez_minor_release_tag_test.yml | 27 +++++++++++++++-- .gitlab/ci/pipelines/octez_release_tag.yml | 27 +++++++++++++++-- .../ci/pipelines/schedule_extended_test.yml | 2 +- .../schedule_master_test_release.yml | 27 +++++++++++++++-- ci/bin/debian_repository.ml | 20 +++++++++++-- ci/lib_tezos_ci/tezos_ci.ml | 13 ++++++++- ci/lib_tezos_ci/tezos_ci.mli | 3 ++ scripts/ci/build-packages-dependencies.sh | 3 ++ 19 files changed, 295 insertions(+), 34 deletions(-) diff --git a/.gitlab/ci/pipelines/before_merging.yml b/.gitlab/ci/pipelines/before_merging.yml index baaf8c7a41aa..bd66520ab55d 100644 --- a/.gitlab/ci/pipelines/before_merging.yml +++ b/.gitlab/ci/pipelines/before_merging.yml @@ -3920,7 +3920,7 @@ oc.unified_coverage: coverage: '/Coverage: ([^%]+%)/' documentation:install_python_bookworm: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: test tags: - gcp diff --git a/.gitlab/ci/pipelines/debian_repository_full.yml b/.gitlab/ci/pipelines/debian_repository_full.yml index c91ebcd32be9..181bcfbfb301 100644 --- a/.gitlab/ci/pipelines/debian_repository_full.yml +++ b/.gitlab/ci/pipelines/debian_repository_full.yml @@ -28,6 +28,29 @@ datadog_pipeline_trace: - DATADOG_SITE=datadoghq.eu datadog-ci tag --level pipeline --tags pipeline_type:$PIPELINE_TYPE --tags mr_number:$CI_MERGE_REQUEST_IID +docker-base-tag: + image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 + stage: images + tags: + - gcp + rules: + - changes: + - images/base-images/**/* + - scripts/ci/build-base-images.sh + when: on_success + - if: $CI_COMMIT_BRANCH == "master" + when: on_success + - when: never + dependencies: [] + timeout: 60 minutes + before_script: + - . ./scripts/ci/datadog_send_job_info.sh + script: + - echo "LABEL=-${CI_COMMIT_REF_SLUG}" > docker-tag.env + artifacts: + reports: + dotenv: docker-tag.env + oc.docker-systemd_tests_debian: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 stage: images @@ -203,7 +226,7 @@ oc.build-data_packages: - packages/$DISTRIBUTION/$RELEASE apt_repo_debian: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: publish tags: - gcp @@ -348,7 +371,7 @@ apt_repo_ubuntu: - runner_system_failure oc.lintian_debian: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: publishing_tests tags: - gcp @@ -368,7 +391,7 @@ oc.lintian_debian: variables: {} oc.install_bin_debian_bookworm: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: publishing_tests tags: - gcp diff --git a/.gitlab/ci/pipelines/debian_repository_partial.yml b/.gitlab/ci/pipelines/debian_repository_partial.yml index 2586a5c9c757..6759b3d98e4c 100644 --- a/.gitlab/ci/pipelines/debian_repository_partial.yml +++ b/.gitlab/ci/pipelines/debian_repository_partial.yml @@ -28,6 +28,29 @@ datadog_pipeline_trace: - DATADOG_SITE=datadoghq.eu datadog-ci tag --level pipeline --tags pipeline_type:$PIPELINE_TYPE --tags mr_number:$CI_MERGE_REQUEST_IID +docker-base-tag: + image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 + stage: images + tags: + - gcp + rules: + - changes: + - images/base-images/**/* + - scripts/ci/build-base-images.sh + when: on_success + - if: $CI_COMMIT_BRANCH == "master" + when: on_success + - when: never + dependencies: [] + timeout: 60 minutes + before_script: + - . ./scripts/ci/datadog_send_job_info.sh + script: + - echo "LABEL=-${CI_COMMIT_REF_SLUG}" > docker-tag.env + artifacts: + reports: + dotenv: docker-tag.env + oc.docker-systemd_tests_debian: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 stage: images @@ -163,7 +186,7 @@ oc.build-data_packages: - packages/$DISTRIBUTION/$RELEASE apt_repo_debian: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: publish tags: - gcp @@ -195,7 +218,7 @@ apt_repo_debian: - runner_system_failure oc.lintian_debian: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: publishing_tests tags: - gcp @@ -215,7 +238,7 @@ oc.lintian_debian: variables: {} oc.install_bin_debian_bookworm: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: publishing_tests tags: - gcp diff --git a/.gitlab/ci/pipelines/debian_repository_partial_auto.yml b/.gitlab/ci/pipelines/debian_repository_partial_auto.yml index 2586a5c9c757..6759b3d98e4c 100644 --- a/.gitlab/ci/pipelines/debian_repository_partial_auto.yml +++ b/.gitlab/ci/pipelines/debian_repository_partial_auto.yml @@ -28,6 +28,29 @@ datadog_pipeline_trace: - DATADOG_SITE=datadoghq.eu datadog-ci tag --level pipeline --tags pipeline_type:$PIPELINE_TYPE --tags mr_number:$CI_MERGE_REQUEST_IID +docker-base-tag: + image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 + stage: images + tags: + - gcp + rules: + - changes: + - images/base-images/**/* + - scripts/ci/build-base-images.sh + when: on_success + - if: $CI_COMMIT_BRANCH == "master" + when: on_success + - when: never + dependencies: [] + timeout: 60 minutes + before_script: + - . ./scripts/ci/datadog_send_job_info.sh + script: + - echo "LABEL=-${CI_COMMIT_REF_SLUG}" > docker-tag.env + artifacts: + reports: + dotenv: docker-tag.env + oc.docker-systemd_tests_debian: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 stage: images @@ -163,7 +186,7 @@ oc.build-data_packages: - packages/$DISTRIBUTION/$RELEASE apt_repo_debian: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: publish tags: - gcp @@ -195,7 +218,7 @@ apt_repo_debian: - runner_system_failure oc.lintian_debian: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: publishing_tests tags: - gcp @@ -215,7 +238,7 @@ oc.lintian_debian: variables: {} oc.install_bin_debian_bookworm: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: publishing_tests tags: - gcp diff --git a/.gitlab/ci/pipelines/homebrew.yml b/.gitlab/ci/pipelines/homebrew.yml index 8d0bcbec1333..c83d8739f3c9 100644 --- a/.gitlab/ci/pipelines/homebrew.yml +++ b/.gitlab/ci/pipelines/homebrew.yml @@ -26,7 +26,7 @@ datadog_pipeline_trace: --tags mr_number:$CI_MERGE_REQUEST_IID oc.install-homebrew: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: build tags: - gcp_very_high_cpu @@ -48,7 +48,7 @@ oc.install-homebrew: CARGO_NET_OFFLINE: "false" oc.build-homebrew: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: build tags: - gcp diff --git a/.gitlab/ci/pipelines/homebrew_auto.yml b/.gitlab/ci/pipelines/homebrew_auto.yml index 8d0bcbec1333..c83d8739f3c9 100644 --- a/.gitlab/ci/pipelines/homebrew_auto.yml +++ b/.gitlab/ci/pipelines/homebrew_auto.yml @@ -26,7 +26,7 @@ datadog_pipeline_trace: --tags mr_number:$CI_MERGE_REQUEST_IID oc.install-homebrew: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: build tags: - gcp_very_high_cpu @@ -48,7 +48,7 @@ oc.install-homebrew: CARGO_NET_OFFLINE: "false" oc.build-homebrew: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: build tags: - gcp diff --git a/.gitlab/ci/pipelines/merge_train.yml b/.gitlab/ci/pipelines/merge_train.yml index cfb496ac6ff2..3a857501b385 100644 --- a/.gitlab/ci/pipelines/merge_train.yml +++ b/.gitlab/ci/pipelines/merge_train.yml @@ -3919,7 +3919,7 @@ oc.unified_coverage: coverage: '/Coverage: ([^%]+%)/' documentation:install_python_bookworm: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: test tags: - gcp diff --git a/.gitlab/ci/pipelines/non_release_tag.yml b/.gitlab/ci/pipelines/non_release_tag.yml index 18a0747b5ec3..a8daa908e46b 100644 --- a/.gitlab/ci/pipelines/non_release_tag.yml +++ b/.gitlab/ci/pipelines/non_release_tag.yml @@ -235,7 +235,7 @@ oc.docker:arm64: EXECUTABLE_FILES: script-inputs/released-executables oc.install-release-homebrew: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: build tags: - gcp @@ -315,6 +315,29 @@ trigger:octez_monitoring: include: .gitlab/ci/pipelines/octez_monitoring.yml strategy: depend +docker-base-tag: + image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 + stage: images + tags: + - gcp + rules: + - changes: + - images/base-images/**/* + - scripts/ci/build-base-images.sh + when: on_success + - if: $CI_COMMIT_BRANCH == "master" + when: on_success + - when: never + dependencies: [] + timeout: 60 minutes + before_script: + - . ./scripts/ci/datadog_send_job_info.sh + script: + - echo "LABEL=-${CI_COMMIT_REF_SLUG}" > docker-tag.env + artifacts: + reports: + dotenv: docker-tag.env + oc.docker-build-debian-dependencies: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 stage: images @@ -422,7 +445,7 @@ oc.build-data_packages: - packages/$DISTRIBUTION/$RELEASE apt_repo_debian: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: publish tags: - gcp diff --git a/.gitlab/ci/pipelines/non_release_tag_test.yml b/.gitlab/ci/pipelines/non_release_tag_test.yml index 383887f94473..afd92da90dff 100644 --- a/.gitlab/ci/pipelines/non_release_tag_test.yml +++ b/.gitlab/ci/pipelines/non_release_tag_test.yml @@ -235,7 +235,7 @@ oc.docker:arm64: EXECUTABLE_FILES: script-inputs/released-executables script-inputs/experimental-executables oc.install-release-homebrew: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: build tags: - gcp @@ -315,6 +315,29 @@ trigger:octez_monitoring: include: .gitlab/ci/pipelines/octez_monitoring.yml strategy: depend +docker-base-tag: + image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 + stage: images + tags: + - gcp + rules: + - changes: + - images/base-images/**/* + - scripts/ci/build-base-images.sh + when: on_success + - if: $CI_COMMIT_BRANCH == "master" + when: on_success + - when: never + dependencies: [] + timeout: 60 minutes + before_script: + - . ./scripts/ci/datadog_send_job_info.sh + script: + - echo "LABEL=-${CI_COMMIT_REF_SLUG}" > docker-tag.env + artifacts: + reports: + dotenv: docker-tag.env + oc.docker-build-debian-dependencies: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 stage: images @@ -422,7 +445,7 @@ oc.build-data_packages: - packages/$DISTRIBUTION/$RELEASE apt_repo_debian: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: publish tags: - gcp diff --git a/.gitlab/ci/pipelines/octez_beta_release_tag.yml b/.gitlab/ci/pipelines/octez_beta_release_tag.yml index b836203603ee..2edc71619c17 100644 --- a/.gitlab/ci/pipelines/octez_beta_release_tag.yml +++ b/.gitlab/ci/pipelines/octez_beta_release_tag.yml @@ -235,7 +235,7 @@ oc.docker:arm64: EXECUTABLE_FILES: script-inputs/released-executables oc.install-release-homebrew: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: build tags: - gcp @@ -317,6 +317,29 @@ trigger:octez_monitoring: include: .gitlab/ci/pipelines/octez_monitoring.yml strategy: depend +docker-base-tag: + image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 + stage: images + tags: + - gcp + rules: + - changes: + - images/base-images/**/* + - scripts/ci/build-base-images.sh + when: on_success + - if: $CI_COMMIT_BRANCH == "master" + when: on_success + - when: never + dependencies: [] + timeout: 60 minutes + before_script: + - . ./scripts/ci/datadog_send_job_info.sh + script: + - echo "LABEL=-${CI_COMMIT_REF_SLUG}" > docker-tag.env + artifacts: + reports: + dotenv: docker-tag.env + oc.docker-build-debian-dependencies: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 stage: images @@ -424,7 +447,7 @@ oc.build-data_packages: - packages/$DISTRIBUTION/$RELEASE apt_repo_debian: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: publish tags: - gcp diff --git a/.gitlab/ci/pipelines/octez_major_release_tag_test.yml b/.gitlab/ci/pipelines/octez_major_release_tag_test.yml index 4e290db8a856..61aab91dc012 100644 --- a/.gitlab/ci/pipelines/octez_major_release_tag_test.yml +++ b/.gitlab/ci/pipelines/octez_major_release_tag_test.yml @@ -235,7 +235,7 @@ oc.docker:arm64: EXECUTABLE_FILES: script-inputs/released-executables script-inputs/experimental-executables oc.install-release-homebrew: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: build tags: - gcp @@ -317,6 +317,29 @@ trigger:octez_monitoring: include: .gitlab/ci/pipelines/octez_monitoring.yml strategy: depend +docker-base-tag: + image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 + stage: images + tags: + - gcp + rules: + - changes: + - images/base-images/**/* + - scripts/ci/build-base-images.sh + when: on_success + - if: $CI_COMMIT_BRANCH == "master" + when: on_success + - when: never + dependencies: [] + timeout: 60 minutes + before_script: + - . ./scripts/ci/datadog_send_job_info.sh + script: + - echo "LABEL=-${CI_COMMIT_REF_SLUG}" > docker-tag.env + artifacts: + reports: + dotenv: docker-tag.env + oc.docker-build-debian-dependencies: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 stage: images @@ -424,7 +447,7 @@ oc.build-data_packages: - packages/$DISTRIBUTION/$RELEASE apt_repo_debian: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: publish tags: - gcp diff --git a/.gitlab/ci/pipelines/octez_minor_release_tag_test.yml b/.gitlab/ci/pipelines/octez_minor_release_tag_test.yml index ec14403fef33..c9b4fbcad5a7 100644 --- a/.gitlab/ci/pipelines/octez_minor_release_tag_test.yml +++ b/.gitlab/ci/pipelines/octez_minor_release_tag_test.yml @@ -214,7 +214,7 @@ oc.docker:arm64: EXECUTABLE_FILES: script-inputs/released-executables script-inputs/experimental-executables oc.install-release-homebrew: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: build tags: - gcp @@ -296,6 +296,29 @@ trigger:octez_monitoring: include: .gitlab/ci/pipelines/octez_monitoring.yml strategy: depend +docker-base-tag: + image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 + stage: images + tags: + - gcp + rules: + - changes: + - images/base-images/**/* + - scripts/ci/build-base-images.sh + when: on_success + - if: $CI_COMMIT_BRANCH == "master" + when: on_success + - when: never + dependencies: [] + timeout: 60 minutes + before_script: + - . ./scripts/ci/datadog_send_job_info.sh + script: + - echo "LABEL=-${CI_COMMIT_REF_SLUG}" > docker-tag.env + artifacts: + reports: + dotenv: docker-tag.env + oc.docker-build-debian-dependencies: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 stage: images @@ -403,7 +426,7 @@ oc.build-data_packages: - packages/$DISTRIBUTION/$RELEASE apt_repo_debian: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: publish tags: - gcp diff --git a/.gitlab/ci/pipelines/octez_release_tag.yml b/.gitlab/ci/pipelines/octez_release_tag.yml index 9d66047ba78f..f541906b4265 100644 --- a/.gitlab/ci/pipelines/octez_release_tag.yml +++ b/.gitlab/ci/pipelines/octez_release_tag.yml @@ -214,7 +214,7 @@ oc.docker:arm64: EXECUTABLE_FILES: script-inputs/released-executables oc.install-release-homebrew: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: build tags: - gcp @@ -296,6 +296,29 @@ trigger:octez_monitoring: include: .gitlab/ci/pipelines/octez_monitoring.yml strategy: depend +docker-base-tag: + image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 + stage: images + tags: + - gcp + rules: + - changes: + - images/base-images/**/* + - scripts/ci/build-base-images.sh + when: on_success + - if: $CI_COMMIT_BRANCH == "master" + when: on_success + - when: never + dependencies: [] + timeout: 60 minutes + before_script: + - . ./scripts/ci/datadog_send_job_info.sh + script: + - echo "LABEL=-${CI_COMMIT_REF_SLUG}" > docker-tag.env + artifacts: + reports: + dotenv: docker-tag.env + oc.docker-build-debian-dependencies: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 stage: images @@ -403,7 +426,7 @@ oc.build-data_packages: - packages/$DISTRIBUTION/$RELEASE apt_repo_debian: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: publish tags: - gcp diff --git a/.gitlab/ci/pipelines/schedule_extended_test.yml b/.gitlab/ci/pipelines/schedule_extended_test.yml index 5289a1607c0e..ca5181d3700c 100644 --- a/.gitlab/ci/pipelines/schedule_extended_test.yml +++ b/.gitlab/ci/pipelines/schedule_extended_test.yml @@ -3519,7 +3519,7 @@ documentation:install_python_jammy: - ./docs/developer/install-python-debian-ubuntu.sh tezos/tezos master documentation:install_python_bookworm: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: test tags: - gcp diff --git a/.gitlab/ci/pipelines/schedule_master_test_release.yml b/.gitlab/ci/pipelines/schedule_master_test_release.yml index 7a072c6db066..9caa47897d02 100644 --- a/.gitlab/ci/pipelines/schedule_master_test_release.yml +++ b/.gitlab/ci/pipelines/schedule_master_test_release.yml @@ -235,7 +235,7 @@ oc.docker:arm64: EXECUTABLE_FILES: script-inputs/released-executables script-inputs/experimental-executables oc.install-release-homebrew: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: build tags: - gcp @@ -318,6 +318,29 @@ trigger:octez_monitoring: include: .gitlab/ci/pipelines/octez_monitoring.yml strategy: depend +docker-base-tag: + image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 + stage: images + tags: + - gcp + rules: + - changes: + - images/base-images/**/* + - scripts/ci/build-base-images.sh + when: on_success + - if: $CI_COMMIT_BRANCH == "master" + when: on_success + - when: never + dependencies: [] + timeout: 60 minutes + before_script: + - . ./scripts/ci/datadog_send_job_info.sh + script: + - echo "LABEL=-${CI_COMMIT_REF_SLUG}" > docker-tag.env + artifacts: + reports: + dotenv: docker-tag.env + oc.docker-build-debian-dependencies: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 stage: images @@ -425,7 +448,7 @@ oc.build-data_packages: - packages/$DISTRIBUTION/$RELEASE apt_repo_debian: - image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: publish tags: - gcp diff --git a/ci/bin/debian_repository.ml b/ci/bin/debian_repository.ml index 61e367e997ba..7ea1dca1b68b 100644 --- a/ci/bin/debian_repository.ml +++ b/ci/bin/debian_repository.ml @@ -112,6 +112,19 @@ let jobs pipeline_type = ) :: add in + let job_docker_base_tag = + job_docker_base_tag + ~rules: + [ + job_rule + ~changes:(Changeset.encode changeset_base_images) + ~when_:On_success + (); + job_rule ~if_:Rules.(on_branch "master") ~when_:On_success (); + job_rule ~when_:Never (); + ] + ~stage:Stages.images + in let make_job_docker_systemd_tests ~__POS__ ~name ~matrix ~distribution = job_docker_authenticated ~__POS__ @@ -545,13 +558,14 @@ let jobs pipeline_type = in match pipeline_type with | Partial -> - (job_docker_systemd_test_debian_dependencies :: debian_jobs) + job_docker_base_tag :: job_docker_systemd_test_debian_dependencies + :: debian_jobs @ test_debian_packages_jobs | Full -> - job_docker_systemd_test_debian_dependencies + job_docker_base_tag :: job_docker_systemd_test_debian_dependencies :: job_docker_systemd_test_ubuntu_dependencies :: debian_jobs @ ubuntu_jobs @ test_debian_packages_jobs @ test_ubuntu_packages_jobs - | Release -> debian_jobs @ ubuntu_jobs + | Release -> (job_docker_base_tag :: debian_jobs) @ ubuntu_jobs let register ~auto ~description pipeline_type = let pipeline_name = diff --git a/ci/lib_tezos_ci/tezos_ci.ml b/ci/lib_tezos_ci/tezos_ci.ml index cd8ed9e4ffee..da764fb154f4 100644 --- a/ci/lib_tezos_ci/tezos_ci.ml +++ b/ci/lib_tezos_ci/tezos_ci.ml @@ -1365,7 +1365,8 @@ module Images_external = struct let datadog_ci = Image.mk_external ~image_path:"datadog/ci:v2.44.0" let debian_bookworm = - Image.mk_external ~image_path:"${GCP_REGISTRY}/tezos/tezos/debian:bookworm" + Image.mk_external + ~image_path:"${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL}" let ubuntu_noble = Image.mk_external ~image_path:"public.ecr.aws/lts/ubuntu:24.04_stable" @@ -1760,3 +1761,13 @@ let job_datadog_pipeline_trace : tezos_job = "DATADOG_SITE=datadoghq.eu datadog-ci tag --level pipeline --tags \ pipeline_type:$PIPELINE_TYPE --tags mr_number:$CI_MERGE_REQUEST_IID"; ] + +let job_docker_base_tag ~stage ~rules = + job + ~__POS__ + ~stage + ~name:"docker-base-tag" + ~image:Images_external.docker + ~rules + ~artifacts:(artifacts ~reports:(reports ~dotenv:"docker-tag.env" ()) []) + ["echo \"LABEL=-${CI_COMMIT_REF_SLUG}\" > docker-tag.env"] diff --git a/ci/lib_tezos_ci/tezos_ci.mli b/ci/lib_tezos_ci/tezos_ci.mli index a983cac13a5f..07dbbe2b0911 100644 --- a/ci/lib_tezos_ci/tezos_ci.mli +++ b/ci/lib_tezos_ci/tezos_ci.mli @@ -732,3 +732,6 @@ module Hooks : sig end val job_datadog_pipeline_trace : tezos_job + +val job_docker_base_tag : + stage:Stage.t -> rules:Gitlab_ci.Types.job_rule list -> tezos_job diff --git a/scripts/ci/build-packages-dependencies.sh b/scripts/ci/build-packages-dependencies.sh index d8e18a481ab0..57c1fb459134 100755 --- a/scripts/ci/build-packages-dependencies.sh +++ b/scripts/ci/build-packages-dependencies.sh @@ -27,6 +27,9 @@ esac LOCAL_IMAGE_NAME="$DEP_IMAGE:${ARCHITECTURE}-${CI_COMMIT_REF_SLUG}" +# Use the base image build on this branch if the label exists +BASE_IMAGE="${GCP_REGISTRY}/tezos/tezos/${DISTRIBUTION}:${RELEASE}${LABEL}" + docker build \ --network host \ --platform $PLATFORM \ -- GitLab From 96432d200b8e8d6d67e3f2f8fe0771a429b65c64 Mon Sep 17 00:00:00 2001 From: Pietro Abate Date: Tue, 15 Jul 2025 16:34:06 +0200 Subject: [PATCH 5/6] packages: use base image in packages job --- scripts/ci/build-packages-dependencies.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/build-packages-dependencies.sh b/scripts/ci/build-packages-dependencies.sh index 57c1fb459134..c09ba6ca55a5 100755 --- a/scripts/ci/build-packages-dependencies.sh +++ b/scripts/ci/build-packages-dependencies.sh @@ -41,7 +41,7 @@ docker build \ --label "com.tezos.build-tezos-revision"="${CI_COMMIT_SHA}" \ -f "$DOCKERFILE" \ --build-arg=BUILDKIT_INLINE_CACHE=1 \ - --build-arg IMAGE="${GCP_REGISTRY}/tezos/tezos/$DISTRIBUTION:$RELEASE" \ + --build-arg IMAGE="${BASE_IMAGE}" \ --build-arg APT_PROXY="${APT_PROXY_DEB:-}" \ --cache-from="${DEP_IMAGE}:${ARCHITECTURE}-${CI_COMMIT_REF_SLUG}" \ --cache-from="${DEP_IMAGE_PROTECTED}:master" \ -- GitLab From afb870b87d156d4b37074e77517bd9c1dda19d58 Mon Sep 17 00:00:00 2001 From: Pietro Abate Date: Mon, 21 Jul 2025 13:58:25 +0200 Subject: [PATCH 6/6] ci: add ?variables to trigger_job function --- .gitlab/ci/pipelines/before_merging.yml | 27 ++++++- .../ci/pipelines/debian_repository_full.yml | 23 ------ .../pipelines/debian_repository_partial.yml | 23 ------ .../debian_repository_partial_auto.yml | 23 ------ .gitlab/ci/pipelines/merge_train.yml | 23 ++++++ .gitlab/ci/pipelines/non_release_tag.yml | 23 ------ .gitlab/ci/pipelines/non_release_tag_test.yml | 23 ------ .../ci/pipelines/octez_beta_release_tag.yml | 23 ------ .../octez_major_release_tag_test.yml | 23 ------ .../octez_minor_release_tag_test.yml | 23 ------ .gitlab/ci/pipelines/octez_release_tag.yml | 23 ------ .../ci/pipelines/schedule_extended_test.yml | 24 ++++++ .../schedule_master_test_release.yml | 23 ------ ci/bin/code_verification.ml | 18 ++++- ci/bin/debian_repository.ml | 20 +---- ci/lib_tezos_ci/tezos_ci.ml | 22 ++++-- ci/lib_tezos_ci/tezos_ci.mli | 4 +- scripts/check_modified_files.sh | 76 +++++++++++++++++++ 18 files changed, 183 insertions(+), 261 deletions(-) create mode 100755 scripts/check_modified_files.sh diff --git a/.gitlab/ci/pipelines/before_merging.yml b/.gitlab/ci/pipelines/before_merging.yml index bd66520ab55d..ef6519bd5b39 100644 --- a/.gitlab/ci/pipelines/before_merging.yml +++ b/.gitlab/ci/pipelines/before_merging.yml @@ -159,6 +159,29 @@ trigger: - DATADOG_SITE=datadoghq.eu datadog-ci tag --level pipeline --tags pipeline_type:$PIPELINE_TYPE --tags mr_number:$CI_MERGE_REQUEST_IID +docker-base-tag: + image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 + stage: sanity + tags: + - gcp + needs: [] + dependencies: [] + timeout: 60 minutes + before_script: + - . ./scripts/ci/datadog_send_job_info.sh + script: + - scripts/check_modified_files.sh $PATTERNS + - exit_code=$? + - label="LABEL=" + - '[ $exit_code -ne 0 ] && label="LABEL=-${CI_COMMIT_REF_SLUG}"' + - echo "Setting label to LABEL=$label" + - echo "$label" > docker-tag.env + variables: + PATTERNS: images/base-images/* scripts/ci/build-base-images.sh + artifacts: + reports: + dotenv: docker-tag.env + sanity_ci: image: ${ci_image_name_protected}/build:amd64--master stage: sanity @@ -4255,10 +4278,12 @@ trigger:debian_repository_partial: stage: manual variables: PIPELINE_TYPE: before_merging-debian_repository_partial + LABEL: $LABEL rules: - when: manual allow_failure: true - needs: [] + needs: + - docker-base-tag trigger: include: .gitlab/ci/pipelines/debian_repository_partial.yml strategy: depend diff --git a/.gitlab/ci/pipelines/debian_repository_full.yml b/.gitlab/ci/pipelines/debian_repository_full.yml index 181bcfbfb301..ff6aa8a03c49 100644 --- a/.gitlab/ci/pipelines/debian_repository_full.yml +++ b/.gitlab/ci/pipelines/debian_repository_full.yml @@ -28,29 +28,6 @@ datadog_pipeline_trace: - DATADOG_SITE=datadoghq.eu datadog-ci tag --level pipeline --tags pipeline_type:$PIPELINE_TYPE --tags mr_number:$CI_MERGE_REQUEST_IID -docker-base-tag: - image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 - stage: images - tags: - - gcp - rules: - - changes: - - images/base-images/**/* - - scripts/ci/build-base-images.sh - when: on_success - - if: $CI_COMMIT_BRANCH == "master" - when: on_success - - when: never - dependencies: [] - timeout: 60 minutes - before_script: - - . ./scripts/ci/datadog_send_job_info.sh - script: - - echo "LABEL=-${CI_COMMIT_REF_SLUG}" > docker-tag.env - artifacts: - reports: - dotenv: docker-tag.env - oc.docker-systemd_tests_debian: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 stage: images diff --git a/.gitlab/ci/pipelines/debian_repository_partial.yml b/.gitlab/ci/pipelines/debian_repository_partial.yml index 6759b3d98e4c..7253652e9d18 100644 --- a/.gitlab/ci/pipelines/debian_repository_partial.yml +++ b/.gitlab/ci/pipelines/debian_repository_partial.yml @@ -28,29 +28,6 @@ datadog_pipeline_trace: - DATADOG_SITE=datadoghq.eu datadog-ci tag --level pipeline --tags pipeline_type:$PIPELINE_TYPE --tags mr_number:$CI_MERGE_REQUEST_IID -docker-base-tag: - image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 - stage: images - tags: - - gcp - rules: - - changes: - - images/base-images/**/* - - scripts/ci/build-base-images.sh - when: on_success - - if: $CI_COMMIT_BRANCH == "master" - when: on_success - - when: never - dependencies: [] - timeout: 60 minutes - before_script: - - . ./scripts/ci/datadog_send_job_info.sh - script: - - echo "LABEL=-${CI_COMMIT_REF_SLUG}" > docker-tag.env - artifacts: - reports: - dotenv: docker-tag.env - oc.docker-systemd_tests_debian: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 stage: images diff --git a/.gitlab/ci/pipelines/debian_repository_partial_auto.yml b/.gitlab/ci/pipelines/debian_repository_partial_auto.yml index 6759b3d98e4c..7253652e9d18 100644 --- a/.gitlab/ci/pipelines/debian_repository_partial_auto.yml +++ b/.gitlab/ci/pipelines/debian_repository_partial_auto.yml @@ -28,29 +28,6 @@ datadog_pipeline_trace: - DATADOG_SITE=datadoghq.eu datadog-ci tag --level pipeline --tags pipeline_type:$PIPELINE_TYPE --tags mr_number:$CI_MERGE_REQUEST_IID -docker-base-tag: - image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 - stage: images - tags: - - gcp - rules: - - changes: - - images/base-images/**/* - - scripts/ci/build-base-images.sh - when: on_success - - if: $CI_COMMIT_BRANCH == "master" - when: on_success - - when: never - dependencies: [] - timeout: 60 minutes - before_script: - - . ./scripts/ci/datadog_send_job_info.sh - script: - - echo "LABEL=-${CI_COMMIT_REF_SLUG}" > docker-tag.env - artifacts: - reports: - dotenv: docker-tag.env - oc.docker-systemd_tests_debian: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 stage: images diff --git a/.gitlab/ci/pipelines/merge_train.yml b/.gitlab/ci/pipelines/merge_train.yml index 3a857501b385..5673bc49dfc2 100644 --- a/.gitlab/ci/pipelines/merge_train.yml +++ b/.gitlab/ci/pipelines/merge_train.yml @@ -159,6 +159,29 @@ trigger: - DATADOG_SITE=datadoghq.eu datadog-ci tag --level pipeline --tags pipeline_type:$PIPELINE_TYPE --tags mr_number:$CI_MERGE_REQUEST_IID +docker-base-tag: + image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 + stage: sanity + tags: + - gcp + needs: [] + dependencies: [] + timeout: 60 minutes + before_script: + - . ./scripts/ci/datadog_send_job_info.sh + script: + - scripts/check_modified_files.sh $PATTERNS + - exit_code=$? + - label="LABEL=" + - '[ $exit_code -ne 0 ] && label="LABEL=-${CI_COMMIT_REF_SLUG}"' + - echo "Setting label to LABEL=$label" + - echo "$label" > docker-tag.env + variables: + PATTERNS: images/base-images/* scripts/ci/build-base-images.sh + artifacts: + reports: + dotenv: docker-tag.env + sanity_ci: image: ${ci_image_name_protected}/build:amd64--master stage: sanity diff --git a/.gitlab/ci/pipelines/non_release_tag.yml b/.gitlab/ci/pipelines/non_release_tag.yml index a8daa908e46b..5630e1a744b9 100644 --- a/.gitlab/ci/pipelines/non_release_tag.yml +++ b/.gitlab/ci/pipelines/non_release_tag.yml @@ -315,29 +315,6 @@ trigger:octez_monitoring: include: .gitlab/ci/pipelines/octez_monitoring.yml strategy: depend -docker-base-tag: - image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 - stage: images - tags: - - gcp - rules: - - changes: - - images/base-images/**/* - - scripts/ci/build-base-images.sh - when: on_success - - if: $CI_COMMIT_BRANCH == "master" - when: on_success - - when: never - dependencies: [] - timeout: 60 minutes - before_script: - - . ./scripts/ci/datadog_send_job_info.sh - script: - - echo "LABEL=-${CI_COMMIT_REF_SLUG}" > docker-tag.env - artifacts: - reports: - dotenv: docker-tag.env - oc.docker-build-debian-dependencies: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 stage: images diff --git a/.gitlab/ci/pipelines/non_release_tag_test.yml b/.gitlab/ci/pipelines/non_release_tag_test.yml index afd92da90dff..a9311be611b0 100644 --- a/.gitlab/ci/pipelines/non_release_tag_test.yml +++ b/.gitlab/ci/pipelines/non_release_tag_test.yml @@ -315,29 +315,6 @@ trigger:octez_monitoring: include: .gitlab/ci/pipelines/octez_monitoring.yml strategy: depend -docker-base-tag: - image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 - stage: images - tags: - - gcp - rules: - - changes: - - images/base-images/**/* - - scripts/ci/build-base-images.sh - when: on_success - - if: $CI_COMMIT_BRANCH == "master" - when: on_success - - when: never - dependencies: [] - timeout: 60 minutes - before_script: - - . ./scripts/ci/datadog_send_job_info.sh - script: - - echo "LABEL=-${CI_COMMIT_REF_SLUG}" > docker-tag.env - artifacts: - reports: - dotenv: docker-tag.env - oc.docker-build-debian-dependencies: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 stage: images diff --git a/.gitlab/ci/pipelines/octez_beta_release_tag.yml b/.gitlab/ci/pipelines/octez_beta_release_tag.yml index 2edc71619c17..98ad1e645d1c 100644 --- a/.gitlab/ci/pipelines/octez_beta_release_tag.yml +++ b/.gitlab/ci/pipelines/octez_beta_release_tag.yml @@ -317,29 +317,6 @@ trigger:octez_monitoring: include: .gitlab/ci/pipelines/octez_monitoring.yml strategy: depend -docker-base-tag: - image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 - stage: images - tags: - - gcp - rules: - - changes: - - images/base-images/**/* - - scripts/ci/build-base-images.sh - when: on_success - - if: $CI_COMMIT_BRANCH == "master" - when: on_success - - when: never - dependencies: [] - timeout: 60 minutes - before_script: - - . ./scripts/ci/datadog_send_job_info.sh - script: - - echo "LABEL=-${CI_COMMIT_REF_SLUG}" > docker-tag.env - artifacts: - reports: - dotenv: docker-tag.env - oc.docker-build-debian-dependencies: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 stage: images diff --git a/.gitlab/ci/pipelines/octez_major_release_tag_test.yml b/.gitlab/ci/pipelines/octez_major_release_tag_test.yml index 61aab91dc012..1b21bf650612 100644 --- a/.gitlab/ci/pipelines/octez_major_release_tag_test.yml +++ b/.gitlab/ci/pipelines/octez_major_release_tag_test.yml @@ -317,29 +317,6 @@ trigger:octez_monitoring: include: .gitlab/ci/pipelines/octez_monitoring.yml strategy: depend -docker-base-tag: - image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 - stage: images - tags: - - gcp - rules: - - changes: - - images/base-images/**/* - - scripts/ci/build-base-images.sh - when: on_success - - if: $CI_COMMIT_BRANCH == "master" - when: on_success - - when: never - dependencies: [] - timeout: 60 minutes - before_script: - - . ./scripts/ci/datadog_send_job_info.sh - script: - - echo "LABEL=-${CI_COMMIT_REF_SLUG}" > docker-tag.env - artifacts: - reports: - dotenv: docker-tag.env - oc.docker-build-debian-dependencies: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 stage: images diff --git a/.gitlab/ci/pipelines/octez_minor_release_tag_test.yml b/.gitlab/ci/pipelines/octez_minor_release_tag_test.yml index c9b4fbcad5a7..0fa9b2d7f345 100644 --- a/.gitlab/ci/pipelines/octez_minor_release_tag_test.yml +++ b/.gitlab/ci/pipelines/octez_minor_release_tag_test.yml @@ -296,29 +296,6 @@ trigger:octez_monitoring: include: .gitlab/ci/pipelines/octez_monitoring.yml strategy: depend -docker-base-tag: - image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 - stage: images - tags: - - gcp - rules: - - changes: - - images/base-images/**/* - - scripts/ci/build-base-images.sh - when: on_success - - if: $CI_COMMIT_BRANCH == "master" - when: on_success - - when: never - dependencies: [] - timeout: 60 minutes - before_script: - - . ./scripts/ci/datadog_send_job_info.sh - script: - - echo "LABEL=-${CI_COMMIT_REF_SLUG}" > docker-tag.env - artifacts: - reports: - dotenv: docker-tag.env - oc.docker-build-debian-dependencies: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 stage: images diff --git a/.gitlab/ci/pipelines/octez_release_tag.yml b/.gitlab/ci/pipelines/octez_release_tag.yml index f541906b4265..b0e6fc1f349a 100644 --- a/.gitlab/ci/pipelines/octez_release_tag.yml +++ b/.gitlab/ci/pipelines/octez_release_tag.yml @@ -296,29 +296,6 @@ trigger:octez_monitoring: include: .gitlab/ci/pipelines/octez_monitoring.yml strategy: depend -docker-base-tag: - image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 - stage: images - tags: - - gcp - rules: - - changes: - - images/base-images/**/* - - scripts/ci/build-base-images.sh - when: on_success - - if: $CI_COMMIT_BRANCH == "master" - when: on_success - - when: never - dependencies: [] - timeout: 60 minutes - before_script: - - . ./scripts/ci/datadog_send_job_info.sh - script: - - echo "LABEL=-${CI_COMMIT_REF_SLUG}" > docker-tag.env - artifacts: - reports: - dotenv: docker-tag.env - oc.docker-build-debian-dependencies: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 stage: images diff --git a/.gitlab/ci/pipelines/schedule_extended_test.yml b/.gitlab/ci/pipelines/schedule_extended_test.yml index ca5181d3700c..789a95fe3f5a 100644 --- a/.gitlab/ci/pipelines/schedule_extended_test.yml +++ b/.gitlab/ci/pipelines/schedule_extended_test.yml @@ -153,6 +153,30 @@ datadog_pipeline_trace: - DATADOG_SITE=datadoghq.eu datadog-ci tag --level pipeline --tags pipeline_type:$PIPELINE_TYPE --tags mr_number:$CI_MERGE_REQUEST_IID +docker-base-tag: + image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 + stage: sanity + tags: + - gcp + needs: [] + dependencies: [] + timeout: 60 minutes + interruptible: false + before_script: + - . ./scripts/ci/datadog_send_job_info.sh + script: + - scripts/check_modified_files.sh $PATTERNS + - exit_code=$? + - label="LABEL=" + - '[ $exit_code -ne 0 ] && label="LABEL=-${CI_COMMIT_REF_SLUG}"' + - echo "Setting label to LABEL=$label" + - echo "$label" > docker-tag.env + variables: + PATTERNS: images/base-images/* scripts/ci/build-base-images.sh + artifacts: + reports: + dotenv: docker-tag.env + sanity_ci: image: ${ci_image_name_protected}/build:amd64--master stage: sanity diff --git a/.gitlab/ci/pipelines/schedule_master_test_release.yml b/.gitlab/ci/pipelines/schedule_master_test_release.yml index 9caa47897d02..167e9d389bb5 100644 --- a/.gitlab/ci/pipelines/schedule_master_test_release.yml +++ b/.gitlab/ci/pipelines/schedule_master_test_release.yml @@ -318,29 +318,6 @@ trigger:octez_monitoring: include: .gitlab/ci/pipelines/octez_monitoring.yml strategy: depend -docker-base-tag: - image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 - stage: images - tags: - - gcp - rules: - - changes: - - images/base-images/**/* - - scripts/ci/build-base-images.sh - when: on_success - - if: $CI_COMMIT_BRANCH == "master" - when: on_success - - when: never - dependencies: [] - timeout: 60 minutes - before_script: - - . ./scripts/ci/datadog_send_job_info.sh - script: - - echo "LABEL=-${CI_COMMIT_REF_SLUG}" > docker-tag.env - artifacts: - reports: - dotenv: docker-tag.env - oc.docker-build-debian-dependencies: image: ${GCP_REGISTRY}/tezos/docker-images/ci-docker:v1.13.0 stage: images diff --git a/ci/bin/code_verification.ml b/ci/bin/code_verification.ml index f504082fbac3..8c61ec1ed22b 100644 --- a/ci/bin/code_verification.ml +++ b/ci/bin/code_verification.ml @@ -370,17 +370,23 @@ let jobs pipeline_type = (* Used in trigger job definitions. For code verification pipelines, add type of parent pipeline. This definition shadows [Tezos_ci.trigger_job]. *) - let trigger_job ~__POS__ ?rules ?dependencies ?description child_pipeline_path - = + let trigger_job ~__POS__ ?rules ?dependencies ?description ?variables + child_pipeline_path = trigger_job ~__POS__ ?rules ?dependencies + ?variables ?description ~parent_pipeline_name:(code_verification_pipeline_name pipeline_type) child_pipeline_path in (* Sanity jobs *) + let job_docker_base_tag = + job_docker_base_tag + ~patterns:"images/base-images/* scripts/ci/build-base-images.sh" + ~stage:Stages.sanity + in let sanity = let stage = Stages.sanity in let dependencies = @@ -579,6 +585,7 @@ let jobs pipeline_type = | Schedule_extended_test -> [] in [ + job_docker_base_tag; job_sanity_ci; job_docker_hadolint; job_oc_ocaml_fmt; @@ -2084,7 +2091,9 @@ let jobs pipeline_type = in jobs_install_python @ jobs_documentation in - + (* creates a dot env file with the label to be used for the docker image. + if the base image is modified in this branch, then add a label poiting to + the local branch, otherwith use master. *) (* Manual jobs *) let manual = (* On scheduled pipelines we build and test the full packages test matrix. @@ -2099,8 +2108,9 @@ let jobs pipeline_type = trigger_job ~__POS__ ~rules:(make_rules ~manual:Yes ()) - ~dependencies:(Dependent []) + ~dependencies:(Dependent [Job job_docker_base_tag]) ~stage:Stages.manual + ~variables:[("LABEL", "$LABEL")] Debian_repository.child_pipeline_partial in let job_rpm_repository_trigger_partial : tezos_job = diff --git a/ci/bin/debian_repository.ml b/ci/bin/debian_repository.ml index 7ea1dca1b68b..61e367e997ba 100644 --- a/ci/bin/debian_repository.ml +++ b/ci/bin/debian_repository.ml @@ -112,19 +112,6 @@ let jobs pipeline_type = ) :: add in - let job_docker_base_tag = - job_docker_base_tag - ~rules: - [ - job_rule - ~changes:(Changeset.encode changeset_base_images) - ~when_:On_success - (); - job_rule ~if_:Rules.(on_branch "master") ~when_:On_success (); - job_rule ~when_:Never (); - ] - ~stage:Stages.images - in let make_job_docker_systemd_tests ~__POS__ ~name ~matrix ~distribution = job_docker_authenticated ~__POS__ @@ -558,14 +545,13 @@ let jobs pipeline_type = in match pipeline_type with | Partial -> - job_docker_base_tag :: job_docker_systemd_test_debian_dependencies - :: debian_jobs + (job_docker_systemd_test_debian_dependencies :: debian_jobs) @ test_debian_packages_jobs | Full -> - job_docker_base_tag :: job_docker_systemd_test_debian_dependencies + job_docker_systemd_test_debian_dependencies :: job_docker_systemd_test_ubuntu_dependencies :: debian_jobs @ ubuntu_jobs @ test_debian_packages_jobs @ test_ubuntu_packages_jobs - | Release -> (job_docker_base_tag :: debian_jobs) @ ubuntu_jobs + | Release -> debian_jobs @ ubuntu_jobs let register ~auto ~description pipeline_type = let pipeline_name = diff --git a/ci/lib_tezos_ci/tezos_ci.ml b/ci/lib_tezos_ci/tezos_ci.ml index da764fb154f4..bebd9db0b33e 100644 --- a/ci/lib_tezos_ci/tezos_ci.ml +++ b/ci/lib_tezos_ci/tezos_ci.ml @@ -1031,8 +1031,8 @@ let job ?arch ?after_script ?allow_failure ?artifacts ?(before_script = []) template; } -let trigger_job ?(dependencies = Staged []) ?rules ?description ~__POS__ ~stage - ?parent_pipeline_name +let trigger_job ?(dependencies = Staged []) ?rules ?description + ?(variables = []) ~__POS__ ~stage ?parent_pipeline_name Pipeline. { name = child_pipeline_name; @@ -1046,7 +1046,7 @@ let trigger_job ?(dependencies = Staged []) ?rules ?description ~__POS__ ~stage if dependencies != [] then failwith "[trigger_job] trigger job '%s' has artifact-dependencies, which is not \ - allowed by GitLab CI." + allowed by GitLab CI. Silently drop it \n" job_name ; let pipeline_type = match parent_pipeline_name with @@ -1059,7 +1059,7 @@ let trigger_job ?(dependencies = Staged []) ?rules ?description ~__POS__ ~stage ?inherit_ ?rules ~stage:(Stage.name stage) - ~variables:[("PIPELINE_TYPE", pipeline_type)] + ~variables:(("PIPELINE_TYPE", pipeline_type) :: variables) ~name:job_name (Pipeline.path ~name:child_pipeline_name) in @@ -1762,12 +1762,20 @@ let job_datadog_pipeline_trace : tezos_job = pipeline_type:$PIPELINE_TYPE --tags mr_number:$CI_MERGE_REQUEST_IID"; ] -let job_docker_base_tag ~stage ~rules = +let job_docker_base_tag ~stage ~patterns = job ~__POS__ ~stage ~name:"docker-base-tag" ~image:Images_external.docker - ~rules + ~dependencies:(Dependent []) + ~variables:[("PATTERNS", patterns)] ~artifacts:(artifacts ~reports:(reports ~dotenv:"docker-tag.env" ()) []) - ["echo \"LABEL=-${CI_COMMIT_REF_SLUG}\" > docker-tag.env"] + [ + "scripts/check_modified_files.sh $PATTERNS"; + "exit_code=$?"; + "label=\"LABEL=\""; + "[ $exit_code -ne 0 ] && label=\"LABEL=-${CI_COMMIT_REF_SLUG}\""; + "echo \"Setting label to LABEL=$label\""; + "echo \"$label\" > docker-tag.env"; + ] diff --git a/ci/lib_tezos_ci/tezos_ci.mli b/ci/lib_tezos_ci/tezos_ci.mli index 07dbbe2b0911..fe4d307483fd 100644 --- a/ci/lib_tezos_ci/tezos_ci.mli +++ b/ci/lib_tezos_ci/tezos_ci.mli @@ -478,6 +478,7 @@ val trigger_job : ?dependencies:dependencies -> ?rules:Gitlab_ci.Types.job_rule list -> ?description:string -> + ?variables:(string * string) list -> __POS__:string * int * int * int -> stage:Stage.t -> ?parent_pipeline_name:string -> @@ -733,5 +734,4 @@ end val job_datadog_pipeline_trace : tezos_job -val job_docker_base_tag : - stage:Stage.t -> rules:Gitlab_ci.Types.job_rule list -> tezos_job +val job_docker_base_tag : stage:Stage.t -> patterns:string -> tezos_job diff --git a/scripts/check_modified_files.sh b/scripts/check_modified_files.sh new file mode 100755 index 000000000000..206a081ffa62 --- /dev/null +++ b/scripts/check_modified_files.sh @@ -0,0 +1,76 @@ +#!/bin/bash + +# ----------------------------------------------------------------------------- +# check_modified_files.sh +# +# This script checks whether any files matching given file paths or glob +# patterns have been modified in the current GitLab Merge Request. +# +# Usage: +# ./check_modified_files.sh ... +# +# In GitLab CI, pass patterns as: +# variables: FILES=" src/**/*.py README.md docs/*.md" +# +# Exits with: +# 0 - if no matching files are modified +# 1 - if one or more matching files are modified +# 2 - if no patterns are passed +# ----------------------------------------------------------------------------- + +set -ue + +if [ "$#" -eq 0 ]; then + echo "āŒ Error: No file patterns provided." + echo "Usage: $0 ..." + exit 2 +fi + +echo "šŸ” Checking if any of these files were modified:" +for pattern in "$@"; do + echo " - $pattern" +done + +# Starting and max depth +DEPTH=5 +MAX_DEPTH=100 +DIFF_BASE="" + +# Try fetching deeper until we find a merge-base or hit the max depth +while [ -z "$DIFF_BASE" ] && [ "$DEPTH" -le "$MAX_DEPTH" ]; do + echo "šŸ”„ Trying fetch with depth: $DEPTH" + git fetch --deepen=5 origin "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" > /dev/null 2>&1 + + # Try to compute merge-base + DIFF_BASE=$(git merge-base HEAD origin/"$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" 2> /dev/null) + + if [ -z "$DIFF_BASE" ]; then + DEPTH=$((DEPTH + 5)) + fi +done + +# Get the list of modified files +MODIFIED_FILES=$(git diff --name-only "${DIFF_BASE}"...HEAD) + +#echo -e "\nšŸ“„ Modified files in MR:" +#echo "$MODIFIED_FILES" + +MATCH_FOUND=0 + +for pattern in "$@"; do + for tracked_file in $(git ls-files -- "$pattern"); do + if echo "$MODIFIED_FILES" | grep -qx "$tracked_file"; then + echo "āœ… Match found: $tracked_file" + MATCH_FOUND=1 + break 2 + fi + done +done + +if [ "$MATCH_FOUND" -eq 1 ]; then + echo -e "\nāœ… One or more matching files were modified." + exit 1 +else + echo -e "\nāŒ No matching files were modified." + exit 0 +fi -- GitLab