diff --git a/.gitlab/ci/pipelines/before_merging.yml b/.gitlab/ci/pipelines/before_merging.yml index a01cd0cd231f3f347709707d9d1211065fe92ddc..ef6519bd5b3973767922e89fa09038089b7c8b53 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 @@ -3920,7 +3943,7 @@ oc.unified_coverage: coverage: '/Coverage: ([^%]+%)/' documentation:install_python_bookworm: - image: debian:bookworm + image: ${GCP_REGISTRY}/tezos/tezos/debian:bookworm${LABEL} stage: test tags: - gcp @@ -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 bc307e504a8e49f2a1caf7cf9c55a7ce06e230bf..ff6aa8a03c493ba257756a739c9870d071b37ac0 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${LABEL} 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${LABEL} 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${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 649d3fda47b5cf7c0af503471bd31b6399890d27..7253652e9d180b7d7c6499288e1e197df9eeda1c 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${LABEL} 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${LABEL} 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${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 649d3fda47b5cf7c0af503471bd31b6399890d27..7253652e9d180b7d7c6499288e1e197df9eeda1c 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${LABEL} 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${LABEL} 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${LABEL} stage: publishing_tests tags: - gcp diff --git a/.gitlab/ci/pipelines/homebrew.yml b/.gitlab/ci/pipelines/homebrew.yml index 614d9161d930246ee531aeb894f74f9f12ded783..c83d8739f3c9674f8a2eeb06a64c1882641afd67 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${LABEL} 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${LABEL} stage: build tags: - gcp diff --git a/.gitlab/ci/pipelines/homebrew_auto.yml b/.gitlab/ci/pipelines/homebrew_auto.yml index 614d9161d930246ee531aeb894f74f9f12ded783..c83d8739f3c9674f8a2eeb06a64c1882641afd67 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${LABEL} 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${LABEL} stage: build tags: - gcp diff --git a/.gitlab/ci/pipelines/merge_train.yml b/.gitlab/ci/pipelines/merge_train.yml index f0939aecabf256181853512b65c8b2521799999a..5673bc49dfc2294f547977b3c4c3341dc53c90a3 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 @@ -3919,7 +3942,7 @@ oc.unified_coverage: coverage: '/Coverage: ([^%]+%)/' documentation:install_python_bookworm: - image: 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 cb4e02527224d87a09767575e869d3fde8ba7fcc..5630e1a744b9bcc1e7163b0bf14519fdd7eeefd9 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${LABEL} 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${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 c018129e4da8f6b4dd676f6bbb77411959b457fe..a9311be611b0652feeab82ea44752a16344d9d26 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${LABEL} 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${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 9b5cbf2597bd2737fab07d811a399c1f1b995327..98ad1e645d1c8f94dcd3c5a8a2d739568f832c35 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${LABEL} 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${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 de1e997d7df48ef1f175a0a609bcaf9e37035902..1b21bf650612c734c52569e3bc1d7d64e185f17a 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${LABEL} 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${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 8f420b3221ad321ee48332c0a9f3584642565de7..0fa9b2d7f345e9454c9cea34467ae4a42953f9c7 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${LABEL} 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${LABEL} stage: publish tags: - gcp diff --git a/.gitlab/ci/pipelines/octez_release_tag.yml b/.gitlab/ci/pipelines/octez_release_tag.yml index 1f66baaf04a99422a728d57c4a060e083d8ca92f..b0e6fc1f349ab94c7b053031e47d00282f5c6d32 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${LABEL} 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${LABEL} stage: publish tags: - gcp diff --git a/.gitlab/ci/pipelines/schedule_extended_test.yml b/.gitlab/ci/pipelines/schedule_extended_test.yml index 3363be2668b26d2bb582068735594069d822d0f5..789a95fe3f5a6d2ad45180c92718c3d00269e01c 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 @@ -3519,7 +3543,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${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 1732edbd3bccd7530a45f6bea3c0d9350d752a86..167e9d389bb5a24ada6f0083cf3e1a33bdfec008 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${LABEL} 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${LABEL} stage: publish tags: - gcp diff --git a/ci/bin/code_verification.ml b/ci/bin/code_verification.ml index f504082fbac312e668c216726c7d6113e4767e47..8c61ec1ed22bdebf2891e01b61b5923bd48bd019 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/lib_tezos_ci/tezos_ci.ml b/ci/lib_tezos_ci/tezos_ci.ml index 555be1fce9f2f5f0dc3a9bc1dbd98cdeb285f5b0..bebd9db0b33e8bd1fe99184a01e67ee45ecb441d 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 @@ -1364,7 +1364,9 @@ 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${LABEL}" let ubuntu_noble = Image.mk_external ~image_path:"public.ecr.aws/lts/ubuntu:24.04_stable" @@ -1759,3 +1761,21 @@ 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 ~patterns = + job + ~__POS__ + ~stage + ~name:"docker-base-tag" + ~image:Images_external.docker + ~dependencies:(Dependent []) + ~variables:[("PATTERNS", patterns)] + ~artifacts:(artifacts ~reports:(reports ~dotenv:"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 a983cac13a5fc6458f434f205a4e4b26446d47e8..fe4d307483fd5ccd089e27c80fa38b121a4c3d2b 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 -> @@ -732,3 +733,5 @@ module Hooks : sig end val job_datadog_pipeline_trace : tezos_job + +val job_docker_base_tag : stage:Stage.t -> patterns:string -> tezos_job diff --git a/images/base-images/Dockerfile.debian b/images/base-images/Dockerfile.debian index 5490ee914f3407a6df575fc0f2e4844174242dd0..8d835607fc4bd83e26ecabf1b9113e5ab5e8e409 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 diff --git a/images/packages/debian-deps-build.Dockerfile b/images/packages/debian-deps-build.Dockerfile index 19dc6ed61602fcc336095e1e77c1bce90be99f23..963ea3c62ee0a0f3e6aff83d1ca1b0f2a20dc6b7 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/ diff --git a/scripts/check_modified_files.sh b/scripts/check_modified_files.sh new file mode 100755 index 0000000000000000000000000000000000000000..206a081ffa626229718772938249773f82b348a8 --- /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 diff --git a/scripts/ci/build-packages-dependencies.sh b/scripts/ci/build-packages-dependencies.sh index e655bb7f532f12fd0e5cd7de6aa65071f29d9689..c09ba6ca55a58f0512769c47d093ef769fbcd7ad 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 \ @@ -38,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="$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" \