Unverified Commit 0333a61a authored by s3krit's avatar s3krit Committed by GitHub
Browse files

CI: Move publish_draft_release job to test stage, and substrate changelog subsections (#908)

* Move publish_draft_release to test stage

Also remove the alert_pending_release job since it's no longer needed

* delete alert_pending_release.sh

* Add splitting substrate changes into subsections
parent e19d50b8
Pipeline #84005 canceled with stages
in 19 seconds
......@@ -111,14 +111,14 @@ check-line-width:
interruptible: true
allow_failure: true
alert-pending-release:
publish-draft-release:
stage: test
image: parity/tools:latest
only:
- tags
- /^v[0-9]+\.[0-9]+\.[0-9]+.*$/ # i.e. v1.0.1, v2.1.0rc1
script:
- ./scripts/gitlab/alert_pending_release.sh
- ./scripts/gitlab/publish_draft_release.sh
interruptible: true
allow_failure: true
......@@ -278,21 +278,6 @@ publish-s3-release:
publish-draft-release:
stage: deploy
image: parity/tools:latest
only:
- tags
- /^v[0-9]+\.[0-9]+\.[0-9]+.*$/ # i.e. v1.0.1, v2.1.0rc1
script:
- ./scripts/gitlab/publish_draft_release.sh
interruptible: true
allow_failure: true
.deploy-template: &deploy
stage: deploy
when: manual
......
#!/usr/bin/env bash
#shellcheck source=lib.sh
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/lib.sh"
# Receive keys
# trusted_keys=(
# 27E36F4D3DB8D09946B14802EC077FBE1556877C # gavin@parity.io
# )
#
# for key in "${trusted_keys[@]}"; do
# gpg --keyserver hkps://keys.openpgp.org --recv-keys $key
# done
#
# # If the tag's not signed by any of the above keys, exit failing
# if ! git tag -v $CI_COMMIT_TAG; then
# echo "[!] FATAL: TAG NOT VERIFIED WITH A GPG SIGNATURE, QUITTING"
# exit 1
# fi
echo "[+] Tag present and verified. Alerting #polkadot and release-manager"
# Format and send message to #polkadot channel
msg_body=$(cat <<EOF
**New version of polkadot tagged:** $CI_COMMIT_TAG.
Build pipeline: $CI_PIPELINE_URL
A release will be created on completion of this pipeline.
EOF
)
# Created formatted body for clients that support it (???)
formatted_msg_body=$(cat <<EOF
<strong>New version of polkadot tagged:</strong> $CI_COMMIT_TAG.<br />
Build pipeline: $CI_PIPELINE_URL<br />
A release will be drafted upon completion of this pipeline.
EOF
)
echo "[+] Sending message to Polkadot room"
send_message "$(structure_message "$msg_body" "$formatted_msg_body")" "$MATRIX_ROOM_ID" "$MATRIX_ACCESS_TOKEN"
# Format and send message to release manager
msg_body=$(cat <<EOF
**New version of polkadot tagged:** $CI_COMMIT_TAG.
Build pipeline: $CI_PIPELINE_URL
When the build finishes, it is safe to build cleanroom binaries.
EOF
)
echo "[+] Sending message to release manager"
send_message "$(structure_message "$msg_body")" "$REL_MAN_ROOM_ID" "$MATRIX_ACCESS_TOKEN"
......@@ -7,13 +7,6 @@ source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/lib.sh
substrate_repo="https://github.com/paritytech/substrate"
substrate_dir='./substrate'
# Substrate labels for PRs we want to include in the release notes
labels=(
'B1-runtimenoteworthy'
'B1-clientnoteworthy'
'B1-apinoteworthy'
)
# Cloning repos to ensure freshness
echo "[+] Cloning substrate to generate list of changes"
git clone $substrate_repo $substrate_dir
......@@ -48,14 +41,18 @@ $(sanitised_git_logs "$last_version" "$version" | \
# Get substrate changes between last polkadot version and current
cur_substrate_commit=$(grep -A 2 'name = "sc-cli"' Cargo.lock | grep -E -o '[a-f0-9]{40}')
git checkout "$last_version" 2> /dev/null
git checkout "$last_version"
old_substrate_commit=$(grep -A 2 'name = "sc-cli"' Cargo.lock | grep -E -o '[a-f0-9]{40}')
pushd $substrate_dir || exit
git checkout polkadot-master > /dev/null
git pull > /dev/null
all_substrate_changes="$(sanitised_git_logs "$old_substrate_commit" "$cur_substrate_commit" | sed 's/(#/(paritytech\/substrate#/')"
substrate_runtime_changes=""
substrate_api_changes=""
substrate_client_changes=""
substrate_changes=""
echo "[+] Iterating through substrate changes to find labelled PRs"
while IFS= read -r line; do
pr_id=$(echo "$line" | sed -E 's/.*#([0-9]+)\)$/\1/')
......@@ -64,24 +61,57 @@ pushd $substrate_dir || exit
if has_label 'paritytech/substrate' "$pr_id" 'B0-silent'; then
continue
fi
for label in "${labels[@]}"; do
if has_label 'paritytech/substrate' "$pr_id" "$label"; then
substrate_changes="$substrate_changes
if has_label 'paritytech/substrate' "$pr_id" 'B1-runtimenoteworthy'; then
substrate_runtime_changes="$substrate_runtime_changes
$line"
fi
if has_label 'paritytech/substrate' "$pr_id" 'B1-clientnoteworthy'; then
substrate_client_changes="$substrate_client_changes
$line"
fi
if has_label 'paritytech/substrate' "$pr_id" 'B1-apinoteworthy' ; then
substrate_api_changes="$substrate_api_changes
$line"
fi
done
continue
fi
done <<< "$all_substrate_changes"
popd || exit
echo "[+] Changes generated. Removing temporary repos"
# Should be done with substrate repo now, clean it up
rm -rf $substrate_dir
if [ -n "$substrate_changes" ]; then
release_text="$release_text
# Make the substrate section if there are any substrate changes
if [ -n "$substrate_runtime_changes" ] ||
[ -n "$substrate_api_changes" ] ||
[ -n "$substrate_client_changes" ]; then
substrate_changes=$(cat << EOF
Substrate changes
-----------------
EOF
)
if [ -n "$substrate_runtime_changes" ]; then
substrate_changes="$substrate_changes
Runtime
-------
$substrate_runtime_changes"
fi
if [ -n "$substrate_client_changes" ]; then
substrate_changes="$substrate_changes
Client
------
$substrate_client_changes"
fi
if [ -n "$substrate_api_changes" ]; then
substrate_changes="$substrate_changes
API
---
$substrate_api_changes"
fi
release_text="$release_text
$substrate_changes"
fi
......@@ -120,13 +150,15 @@ fi
echo '[+] Sending draft release URL to Matrix'
msg_body=$(cat <<EOF
**Gav: Release pipeline for Polkadot $version complete.**
Draft release created: $html_url
**New version of polkadot tagged:** $CI_COMMIT_TAG.
Gav: Draft release created: $html_url
Build pipeline: $CI_PIPELINE_URL
EOF
)
formatted_msg_body=$(cat <<EOF
<strong>Gav: Release pipeline for Polkadot $version complete.</strong><br />
Draft release created: $html_url
<strong>New version of polkadot tagged:</strong> $CI_COMMIT_TAG<br />
Gav: Draft release created: $html_url <br />
Build pipeline: $CI_PIPELINE_URL
EOF
)
send_message "$(structure_message "$msg_body" "$formatted_msg_body")" "$MATRIX_ROOM_ID" "$MATRIX_ACCESS_TOKEN"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment