Skip to content
Snippets Groups Projects
Commit e76c5236 authored by Cédric Moreau's avatar Cédric Moreau Committed by Hugo Trentesaux
Browse files

#239: fix: create_client_release must not depend on runtime milestone

parent 880f0fb3
No related branches found
No related tags found
1 merge request!297Resolve "Create a release from master"
...@@ -188,8 +188,8 @@ tests: ...@@ -188,8 +188,8 @@ tests:
- echo $CLIENT_VERSION - echo $CLIENT_VERSION
- export RUNTIME_VERSION=$(cat runtime/gdev/src/lib.rs | grep "spec_version:" | sed "s/ *spec_version. //g" | sed "s/,//g") - export RUNTIME_VERSION=$(cat runtime/gdev/src/lib.rs | grep "spec_version:" | sed "s/ *spec_version. //g" | sed "s/,//g")
- echo $RUNTIME_VERSION - echo $RUNTIME_VERSION
- export RUNTIME_MILESTONE="runtime-$RUNTIME_VERSION" - export CLIENT_MILESTONE="client-$CLIENT_VERSION"
- echo $RUNTIME_MILESTONE - echo $CLIENT_MILESTONE
- export NETWORK_RELEASE="$NETWORK" - export NETWORK_RELEASE="$NETWORK"
- echo $NETWORK_RELEASE - echo $NETWORK_RELEASE
- export DOCKER_TAG="$RUNTIME_VERSION-$CLIENT_VERSION" - export DOCKER_TAG="$RUNTIME_VERSION-$CLIENT_VERSION"
...@@ -260,11 +260,10 @@ docker_deploy: ...@@ -260,11 +260,10 @@ docker_deploy:
############## SRTOOL ############## ############## SRTOOL ##############
# We always build the runtime on a network/ branch, either it is for: # The Network Runtime is only built when creating a network release (i.e.: genesis)
# - creating a network release (i.e.: genesis) build_network_runtime:
# - creating a client release (i.e.: which also includes the runtime)
build_runtime:
stage: build stage: build
needs: ["trigger_network_release"]
rules: rules:
- <<: *is_network_branch - <<: *is_network_branch
image: paritytech/srtool:1.77.0-0.15.0 image: paritytech/srtool:1.77.0-0.15.0
...@@ -340,7 +339,7 @@ g1_data: ...@@ -340,7 +339,7 @@ g1_data:
build_specs: build_specs:
stage: build stage: build
needs: ["build_runtime", "g1_data"] needs: ["build_network_runtime", "g1_data"]
rules: rules:
- <<: *is_network_branch - <<: *is_network_branch
extends: .env extends: .env
...@@ -425,17 +424,15 @@ create_network_release: ...@@ -425,17 +424,15 @@ create_network_release:
create_client_release: create_client_release:
stage: release stage: release
needs: ["build_runtime", "build_raw_specs"] needs: ["build_raw_specs"]
rules: rules:
- <<: *is_network_branch - <<: *is_network_branch
image: rust:1-bullseye image: rust:1-bullseye
variables:
# Used by `release-runtime` command
SRTOOL_OUTPUT: $CI_PROJECT_DIR/release/srtool_output.json
script: script:
- *define_network_branch_vars - *define_network_branch_vars
- cargo xtask release-runtime $CLIENT_RELEASE_NAME $NETWORK_RELEASE $CI_COMMIT_BRANCH $RUNTIME_MILESTONE # Create the GitLab release page + tag and associate the milestone
- cargo xtask create-asset-link $CLIENT_RELEASE_NAME ${RUNTIME}_runtime.compact.compressed.wasm https://nodes.pages.duniter.org/-/rust/duniter-v2s/-/jobs/$CI_JOB_ID/artifacts/$RELEASE_FILE_WASM - cargo xtask release-client $CLIENT_RELEASE_NAME $CI_COMMIT_BRANCH $CLIENT_MILESTONE
# Add the client assets
- cargo xtask create-asset-link $CLIENT_RELEASE_NAME ${RUNTIME}_client-specs.yaml https://nodes.pages.duniter.org/-/rust/duniter-v2s/-/jobs/$CI_JOB_ID/artifacts/$RELEASE_FILE_CLIENT_SPEC - cargo xtask create-asset-link $CLIENT_RELEASE_NAME ${RUNTIME}_client-specs.yaml https://nodes.pages.duniter.org/-/rust/duniter-v2s/-/jobs/$CI_JOB_ID/artifacts/$RELEASE_FILE_CLIENT_SPEC
- cargo xtask create-asset-link $CLIENT_RELEASE_NAME ${RUNTIME}-raw.json https://nodes.pages.duniter.org/-/rust/duniter-v2s/-/jobs/$CI_JOB_ID/artifacts/$RELEASE_FILE_RAW_SPEC - cargo xtask create-asset-link $CLIENT_RELEASE_NAME ${RUNTIME}-raw.json https://nodes.pages.duniter.org/-/rust/duniter-v2s/-/jobs/$CI_JOB_ID/artifacts/$RELEASE_FILE_RAW_SPEC
artifacts: artifacts:
......
...@@ -91,14 +91,37 @@ pub(super) async fn release_runtime( ...@@ -91,14 +91,37 @@ pub(super) async fn release_runtime(
branch: String, branch: String,
milestone: String, milestone: String,
) -> Result<()> { ) -> Result<()> {
let mut release_notes = String::from( release(
"Runtime".to_string(),
name,
Some(network),
branch,
milestone,
)
.await
}
pub(super) async fn release_client(name: String, branch: String, milestone: String) -> Result<()> {
release("Client".to_string(), name, None, branch, milestone).await
}
async fn release(
title: String,
name: String,
network: Option<String>,
branch: String,
milestone: String,
) -> Result<()> {
let mut release_notes = String::from(format!(
" "
# Runtime # {title}
", "
); ));
add_srtool_notes(network, &mut release_notes)?; if let Some(network) = network {
add_srtool_notes(network.clone(), &mut release_notes)?;
}
// Get changes (list of MRs) from gitlab API // Get changes (list of MRs) from gitlab API
let changes = get_changes::get_changes(milestone.clone()).await?; let changes = get_changes::get_changes(milestone.clone()).await?;
......
...@@ -57,9 +57,22 @@ enum DuniterXTaskCommand { ...@@ -57,9 +57,22 @@ enum DuniterXTaskCommand {
ReleaseNetwork { network: String, branch: String }, ReleaseNetwork { network: String, branch: String },
/// Release a new runtime /// Release a new runtime
ReleaseRuntime { ReleaseRuntime {
/// Name of the release + tag to be applied
name: String, name: String,
/// Name of the network to be put in the release notes title of the srtool part
network: String, network: String,
/// Branch on which the tag `name` will be created during the release
branch: String, branch: String,
/// Name of the milestone to add this release to
milestone: String,
},
/// Release a new client for a network
ReleaseClient {
/// Name of the release + tag to be applied
name: String,
/// Branch on which the tag `name` will be created during the release
branch: String,
/// Name of the milestone to add this release to
milestone: String, milestone: String,
}, },
/// Print the chainSpec published on given Network Release /// Print the chainSpec published on given Network Release
...@@ -112,6 +125,11 @@ async fn main() -> Result<()> { ...@@ -112,6 +125,11 @@ async fn main() -> Result<()> {
branch, branch,
milestone, milestone,
} => gitlab::release_runtime(name, network, branch, milestone).await, } => gitlab::release_runtime(name, network, branch, milestone).await,
DuniterXTaskCommand::ReleaseClient {
name,
branch,
milestone,
} => gitlab::release_client(name, branch, milestone).await,
DuniterXTaskCommand::PrintSpec { network } => gitlab::print_spec(network).await, DuniterXTaskCommand::PrintSpec { network } => gitlab::print_spec(network).await,
DuniterXTaskCommand::CreateAssetLink { DuniterXTaskCommand::CreateAssetLink {
tag, tag,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment