Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Use a new approach to make automatic-crate-publishing uninterruptible
Browse files Browse the repository at this point in the history
It's not neccessary to dynamically change the `interruptible` setting
for *all* jobs as the old approach does; gitlab already considers a
pipeline uninterruptible as soon as a single uninterruptible job has
started (cf https://docs.gitlab.com/ee/ci/yaml/#interruptible).

IMO this approach is more readable, as it avoids dynamically loading the
.defaults section from different files based on import conditions; the
logic is now shorter and entirely contained in the main .gitlab-ci.yml.
  • Loading branch information
Mira Ressel committed Apr 13, 2023
1 parent be58e48 commit f406b47
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 25 deletions.
40 changes: 17 additions & 23 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,29 +58,15 @@ variables:
NEXTEST_SUCCESS_OUTPUT: final
ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.3.43"

.shared-default: &shared-default
default:
retry:
max: 2
when:
- runner_system_failure
- unknown_failure
- api_failure
cache: {}

.default-pipeline-definitions:
default:
<<: *shared-default
interruptible: true

.crate-publishing-pipeline-definitions:
default:
<<: *shared-default
# The crate-publishing pipeline defaults to `interruptible: false` so that we'll be able to
# reach and run the publishing jobs despite the "Auto-cancel redundant pipelines" CI setting.
# The setting is relevant because the crate-publishing pipeline runs on `master`, thus future
# pipelines on `master` (e.g. created for new commits or other schedules) might unintendedly
# cancel the publishing jobs or its dependencies before we get to actually publish the crates.
interruptible: false
interruptible: true

.collect-artifacts:
artifacts:
Expand Down Expand Up @@ -288,6 +274,21 @@ check-crates-publishing-pipeline:
https://github.com/paritytech/releng-scripts.git
- ONLY_CHECK_PIPELINE=true ./releng-scripts/publish-crates

# By default our pipelines are interruptible, but some special pipelines shouldn't be interrupted:
# * the scheduled automatic-crate-publishing pipeline
#
# In those cases, we add an interruptible .pre job; once that one has started,
# the entire pipeline becomes uninterruptible
uninterruptible-pipeline:
extends: .kubernetes-env
variables:
CI_IMAGE: "paritytech/tools:latest"
stage: .pre
interruptible: false
rules:
- if: $CI_PIPELINE_SOURCE == "schedule" && $PIPELINE == "automatic-crate-publishing"
script: "true"

include:
# check jobs
- scripts/ci/gitlab/pipeline/check.yml
Expand All @@ -308,13 +309,6 @@ include:
# pipeline is made uninterruptible to ensure that test jobs also get a chance to run to
# completion, because the publishing jobs depends on them AS INTENDED: crates should not be
# published before their source code is checked.
- local: scripts/ci/gitlab/crate-publishing-pipeline.yml
rules:
- if: $PIPELINE == "automatic-crate-publishing"
# For normal pipelines: run it with defaults + `interruptible: true`
- local: scripts/ci/gitlab/default-pipeline.yml
rules:
- if: $PIPELINE != "automatic-crate-publishing"
- project: parity/infrastructure/ci_cd/shared
ref: v0.2
file: /common/timestamp.yml
Expand Down
1 change: 0 additions & 1 deletion scripts/ci/gitlab/crate-publishing-pipeline.yml

This file was deleted.

1 change: 0 additions & 1 deletion scripts/ci/gitlab/default-pipeline.yml

This file was deleted.

0 comments on commit f406b47

Please sign in to comment.