diff --git a/.gitlab/ci/pipelines/base_images.yml b/.gitlab/ci/pipelines/base_images.yml index a2d11149b6b36c4b3470f206e07ed8fde811da0a..8109d231bd6d4273a1a5517b6f6dc648ba9d9727 100644 --- a/.gitlab/ci/pipelines/base_images.yml +++ b/.gitlab/ci/pipelines/base_images.yml @@ -1,6 +1,14 @@ # This file was automatically generated, do not edit. # Edit file ci/bin/main.ml instead. +default: + interruptible: true + retry: + max: 2 + when: + - stuck_or_timeout_failure + - runner_system_failure + workflow: rules: - if: $foo != "bar" || $foo == "bar" diff --git a/.gitlab/ci/pipelines/octez_monitoring.yml b/.gitlab/ci/pipelines/octez_monitoring.yml index be49b1fa83e44cd8c59c778bfe9b86f90262173a..7c8d351f071d917c9077fcfd8846f98448c81b99 100644 --- a/.gitlab/ci/pipelines/octez_monitoring.yml +++ b/.gitlab/ci/pipelines/octez_monitoring.yml @@ -1,6 +1,14 @@ # This file was automatically generated, do not edit. # Edit file ci/bin/main.ml instead. +default: + interruptible: true + retry: + max: 2 + when: + - stuck_or_timeout_failure + - runner_system_failure + workflow: rules: - if: $foo != "bar" || $foo == "bar" diff --git a/.gitlab/ci/pipelines/security-scans-master.yml b/.gitlab/ci/pipelines/security-scans-master.yml index 168399668deab0d3c03ec4c9833714a2fcafbb0e..8db6621bc066f8278c85f7def72fb7733ab3531c 100644 --- a/.gitlab/ci/pipelines/security-scans-master.yml +++ b/.gitlab/ci/pipelines/security-scans-master.yml @@ -1,6 +1,14 @@ # This file was automatically generated, do not edit. # Edit file ci/bin/main.ml instead. +default: + interruptible: true + retry: + max: 2 + when: + - stuck_or_timeout_failure + - runner_system_failure + workflow: rules: - if: $foo != "bar" || $foo == "bar" diff --git a/ci/bin/main.ml b/ci/bin/main.ml index b243c7192ddb6b3d5792ddef591d21e966b26d5f..0b91d29a6c6f9d1603d939fff5a102957b3d5063 100644 --- a/ci/bin/main.ml +++ b/ci/bin/main.ml @@ -552,7 +552,7 @@ let () = match Cli.config.action with | Write -> Pipeline.write - ~default:Common.Helpers.retry_default + ~default:Pipeline.default_config ~variables ~filename:".gitlab-ci.yml" () ; diff --git a/ci/lib_tezos_ci/tezos_ci.ml b/ci/lib_tezos_ci/tezos_ci.ml index 1a5f851a3f79e6db86409394ac16e152c2dc83c0..aa1f3196673553d20523de7acbb0296b15aaa551 100644 --- a/ci/lib_tezos_ci/tezos_ci.ml +++ b/ci/lib_tezos_ci/tezos_ci.ml @@ -169,7 +169,6 @@ module Pipeline = struct if_ : Gitlab_ci.If.t; variables : Gitlab_ci.Types.variables option; auto_cancel : Gitlab_ci.Types.auto_cancel option; - default : Gitlab_ci.Types.default option; jobs : tezos_job list; } @@ -178,7 +177,7 @@ module Pipeline = struct description : string; auto_cancel : Gitlab_ci.Types.auto_cancel option; inherit_ : Gitlab_ci.Types.inherit_ option; - default : Gitlab_ci.Types.default option; + default : Gitlab_ci.Types.default; jobs : tezos_job list; } @@ -195,8 +194,19 @@ module Pipeline = struct | Child_pipeline {jobs; _} -> jobs | Pipeline {jobs; _} -> jobs + let default_config = + Gitlab_ci.Types. + { + image = None; + interruptible = Some true; + retry = + Some + {max = 2; when_ = [Stuck_or_timeout_failure; Runner_system_failure]}; + } + let default = function - | Pipeline {default; _} | Child_pipeline {default; _} -> default + | Pipeline _ -> default_config + | Child_pipeline {default; _} -> default let set_jobs jobs = function | Child_pipeline pl -> Child_pipeline {pl with jobs} @@ -213,11 +223,12 @@ module Pipeline = struct (name pipeline) else pipelines := pipeline :: !pipelines - let register ?variables ?auto_cancel ?default ~description ~jobs name if_ = + let register ?variables ?auto_cancel ~description ~jobs name if_ = register_raw - (Pipeline {variables; if_; name; jobs; auto_cancel; default; description}) + (Pipeline {variables; if_; name; jobs; auto_cancel; description}) - let register_child ?auto_cancel ?inherit_ ?default ~description ~jobs name = + let register_child ?auto_cancel ?inherit_ ?(default = default_config) + ~description ~jobs name = let child_pipeline = {name; inherit_; jobs; auto_cancel; default; description} in @@ -444,7 +455,6 @@ module Pipeline = struct let pipeline = add_image_builders pipeline in let jobs = jobs pipeline in let name = name pipeline in - let pipeline_default = default pipeline in if not (Sys.getenv_opt "CI_DISABLE_PRECHECK" = Some "true") then precheck pipeline ; if jobs = [] then @@ -464,9 +474,9 @@ module Pipeline = struct jobs ; let prepend_config = templates_to_config (templates pipeline) - @ (match pipeline_default with - | Some default_config -> [Gitlab_ci.Types.Default default_config] - | None -> []) + @ (match pipeline with + | Pipeline _ -> [] + | Child_pipeline _ -> [Gitlab_ci.Types.Default (default pipeline)]) @ (match pipeline with | Pipeline _ -> [] | Child_pipeline _ -> diff --git a/ci/lib_tezos_ci/tezos_ci.mli b/ci/lib_tezos_ci/tezos_ci.mli index 6529c96f040a55d664ba7d8e13bbedf9a886f9ca..82ddd4633222d46376dae11cddd553a4c8905437 100644 --- a/ci/lib_tezos_ci/tezos_ci.mli +++ b/ci/lib_tezos_ci/tezos_ci.mli @@ -84,6 +84,13 @@ end (** A facility for registering pipelines. *) module Pipeline : sig + (** Default pipeline configuration. + + It is included in [.gitlab-ci.yml] and thus all pipelines inherit it, + with the exception of child pipelines. You can specify different defaults + for child pipelines, with the default defaults being [default_config]. *) + val default_config : Gitlab_ci.Types.default + (** Register a pipeline. [register ~description ?variables ?default name rule] will register a pipeline [name] @@ -104,7 +111,6 @@ module Pipeline : sig val register : ?variables:Gitlab_ci.Types.variables -> ?auto_cancel:Gitlab_ci.Types.auto_cancel -> - ?default:Gitlab_ci.Types.default -> description:string -> jobs:tezos_job list -> string -> diff --git a/ci/lib_tezos_ci_jobs/common.ml b/ci/lib_tezos_ci_jobs/common.ml index 964c770ba201135c3cda0e60a4cfec7deaf75ec8..802298f8c7ae7450c39e1e602f6357836e8af66b 100644 --- a/ci/lib_tezos_ci_jobs/common.ml +++ b/ci/lib_tezos_ci_jobs/common.ml @@ -23,14 +23,6 @@ open Tezos_ci.Cache (** {2 Shared Helpers} *) module Helpers = struct - (* Sets up the [default:] top-level configuration element. *) - let retry_default = - Gitlab_ci.Util.default - ~interruptible:true - ~retry: - {max = 2; when_ = [Stuck_or_timeout_failure; Runner_system_failure]} - () - (** The default [before_script:] section. In general, the result of this script should be used as the diff --git a/ci/lib_tezos_ci_jobs/debian_repository.ml b/ci/lib_tezos_ci_jobs/debian_repository.ml index a5306fac352027468c6567ddc121ad29bc5393fb..818d7ecd2e5c7cfee865b5a78452a205f5124de3 100644 --- a/ci/lib_tezos_ci_jobs/debian_repository.ml +++ b/ci/lib_tezos_ci_jobs/debian_repository.ml @@ -529,7 +529,6 @@ let register ~auto ~description pipeline_type = Pipeline.register_child pipeline_name ~description - ~default:Common.Helpers.retry_default ~jobs:(job_datadog_pipeline_trace :: jobs) let child_pipeline_partial = diff --git a/ci/lib_tezos_ci_jobs/homebrew.ml b/ci/lib_tezos_ci_jobs/homebrew.ml index 2a8848aa8e34e3848e25335acba8e20063ca3cb7..cd25381ed457fd05108df9857e11c95c9a0bee3b 100644 --- a/ci/lib_tezos_ci_jobs/homebrew.ml +++ b/ci/lib_tezos_ci_jobs/homebrew.ml @@ -79,7 +79,6 @@ let child_pipeline_full = ~description: "A child pipeline of 'before_merging' building and testing the homebrew \ packaging. Manually triggered." - ~default:Common.Helpers.retry_default ~jobs:(jobs Full) let child_pipeline_full_auto = @@ -89,5 +88,4 @@ let child_pipeline_full_auto = "A child pipeline of 'before_merging' (and thus 'merge_train') building \ and testing the homebrew packaging. Starts automatically on certain \ conditions." - ~default:Common.Helpers.retry_default ~jobs:(jobs Full) diff --git a/ci/lib_tezos_ci_jobs/rpm_repository.ml b/ci/lib_tezos_ci_jobs/rpm_repository.ml index 2046669f6d7de5e3104f64032034cb559348b1eb..6a1d2e420d9b0d8412e174c625613d1c4759d532 100644 --- a/ci/lib_tezos_ci_jobs/rpm_repository.ml +++ b/ci/lib_tezos_ci_jobs/rpm_repository.ml @@ -378,7 +378,6 @@ let register ~auto ~description pipeline_type = Pipeline.register_child pipeline_name ~description - ~default:Common.Helpers.retry_default ~jobs:(job_datadog_pipeline_trace :: jobs) let child_pipeline_partial =