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

More improvements for the crate publishing pipeline #13153

Merged
merged 7 commits into from
Jan 16, 2023
12 changes: 0 additions & 12 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,16 +229,6 @@ variables:
# this job runs only on nightly pipeline with the mentioned variable, against `master` branch
- if: $CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "schedule" && $PIPELINE == "nightly"

.crate-publishing-pipeline:
rules:
- if: $CI_COMMIT_REF_NAME != "master"
when: never

.scheduled-crate-publishing-pipeline:
rules:
- !reference [.crate-publishing-pipeline, rules]
- if: $CI_PIPELINE_SOURCE == "schedule" && $PIPELINE == "automatic-crate-publishing"

.crates-publishing-template:
stage: test
extends: .docker-env
Expand All @@ -251,9 +241,7 @@ variables:
paths:
- artifacts/
variables:
CRATESIO_API: https://crates.io/api
CRATESIO_CRATES_OWNER: parity-crate-owner
GH_API: https://api.github.com
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those defaults have been moved to the publish-crates script

REPO: substrate
REPO_OWNER: paritytech
SPUB_TMP: artifacts
Expand Down
30 changes: 14 additions & 16 deletions scripts/ci/gitlab/pipeline/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,18 +189,18 @@ publish-draft-release:
# the releases of one another. Use resource_group to ensure that at most one instance of this job
# is running at any given time.
resource_group: crates-publishing
variables:
# crates.io rate limits crates publishing by 1 per minute, so a delay needs to be inserted
# slightly higher than that after publishing each crate. The value is specified in seconds.
SPUB_AFTER_PUBLISH_DELAY: 64
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This delay is part of an implementation detail and thus it has been moved to the publish-crates script itself.

# We might have to publish lots of crates at a time. Given the 1 minute delay introduced above and
# taking into account the 202 (as of Dec 07, 2022) publishable Substrate crates, that would equate
# to roughly 202 minutes of delay, or 3h and 22 minutes. As such, the job needs to have a much
# higher timeout than average.
# crates.io currently rate limits crate publishing at 1 per minute:
# https://github.com/paritytech/release-engineering/issues/123#issuecomment-1335509748
# Taking into account the 202 (as of Dec 07, 2022) publishable Substrate crates, in the worst
# case, due to the rate limits alone, we'd have to wait through at least 202 minutes of delay.
# Taking into account also the verification steps and extra synchronization delays after
# publishing the crate, the job needs to have a much higher timeout than average.
timeout: 9h
# A custom publishing environment is used for us to be able to set up protected secrets
# specifically for it
environment: publish-crates
variables:
PUBLISH_CRATES_BRANCH: master
script:
- rusty-cachier snapshot create
- git clone
Expand All @@ -211,15 +211,13 @@ publish-draft-release:
- rusty-cachier cache upload

publish-crates:
extends:
- .publish-crates-template
- .scheduled-crate-publishing-pipeline
needs:
- job: publish-crates-locally
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing this dependency is intentional so that this job relies on more checks other than publish-crates-locally working, which is the intention explained in #13088 (comment)

artifacts: false
extends: .publish-crates-template
rules:
- if: $CI_COMMIT_REF_NAME == "$PUBLISH_CRATES_BRANCH" && $CI_PIPELINE_SOURCE == "schedule" && $PIPELINE == "automatic-crate-publishing"

publish-crates-manual:
extends: .publish-crates-template
rules: !reference [.crate-publishing-pipeline, rules]
rules:
- if: $CI_COMMIT_REF_NAME == "$PUBLISH_CRATES_BRANCH"
when: manual
allow_failure: true
interruptible: false
6 changes: 5 additions & 1 deletion scripts/ci/gitlab/pipeline/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ find-fail-ci-phrase:
script:
- set +e
- rg --line-number --hidden --type rust --glob '!{.git,target}' "$ASSERT_REGEX" .; exit_status=$?
- if [ $exit_status -eq 0 ]; then
- if [ $exit_status -eq 0 ]; then
echo "$ASSERT_REGEX was found, exiting with 1";
exit 1;
else
Expand Down Expand Up @@ -420,6 +420,10 @@ publish-crates-locally:
extends:
- .test-refs
- .crates-publishing-template
# When lots of crates are taken into account (for example on master where all crates are tested)
# the job might take a long time, as evidenced by:
# https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/2269364
timeout: 4h
script:
- rusty-cachier snapshot create
- git clone
Expand Down