Skip to content
Snippets Groups Projects
Unverified Commit cbd745c8 authored by Bastian Köcher's avatar Bastian Köcher Committed by GitHub
Browse files

Fix `node-metrics` test (#1287)

parent d81c8cba
No related merge requests found
Pipeline #385346 failed with stages
in 1 hour, 21 minutes, and 41 seconds
Showing
with 2 additions and 540 deletions
......@@ -196,6 +196,8 @@ test-node-metrics:
# but still want to have debug assertions.
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
script:
# Build the required workers.
- cargo build --bin polkadot-execute-worker --bin polkadot-prepare-worker --profile testnet --verbose --locked
- mkdir -p artifacts
- time cargo test --profile testnet
--locked
......
changelog.md
*.json
release*.md
.env
# frozen_string_literal: true
source 'https://rubygems.org'
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
gem 'octokit', '~> 4'
gem 'git_diff_parser', '~> 3'
gem 'toml', '~> 0.3.0'
gem 'rake', group: :dev
gem 'optparse', '~> 0.1.1'
gem 'logger', '~> 1.4'
gem 'changelogerator', '0.10.1'
gem 'test-unit', group: :dev
gem 'rubocop', group: :dev, require: false
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
ast (2.4.2)
changelogerator (0.10.1)
git_diff_parser (~> 3)
octokit (~> 4)
faraday (1.8.0)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0.1)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.1)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
multipart-post (>= 1.2, < 3)
ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
git_diff_parser (3.2.0)
logger (1.4.4)
multipart-post (2.1.1)
octokit (4.21.0)
faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3)
optparse (0.1.1)
parallel (1.21.0)
parser (3.0.2.0)
ast (~> 2.4.1)
parslet (2.0.0)
power_assert (2.0.1)
public_suffix (4.0.6)
rainbow (3.0.0)
rake (13.0.6)
regexp_parser (2.1.1)
rexml (3.2.5)
rubocop (1.23.0)
parallel (~> 1.10)
parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.12.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.13.0)
parser (>= 3.0.1.1)
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.5)
sawyer (0.8.2)
addressable (>= 2.3.5)
faraday (> 0.8, < 2.0)
test-unit (3.5.1)
power_assert
toml (0.3.0)
parslet (>= 1.8.0, < 3.0.0)
unicode-display_width (2.1.0)
PLATFORMS
x86_64-darwin-20
x86_64-darwin-22
DEPENDENCIES
changelogerator (= 0.10.1)
git_diff_parser (~> 3)
logger (~> 1.4)
octokit (~> 4)
optparse (~> 0.1.1)
rake
rubocop
test-unit
toml (~> 0.3.0)
BUNDLED WITH
2.4.6
# Changelog
Currently, the changelog is built locally. It will be moved to CI once labels stabilize.
For now, a bit of preparation is required before you can run the script:
- fetch the srtool digests
- store them under the `digests` folder as `<chain>-srtool-digest.json`
- ensure the `.env` file is up to date with correct information. See below for an example
The content of the release notes is generated from the template files under the `scripts/ci/changelog/templates` folder. For readability and maintenance, the template is split into several small snippets.
Run:
```
./bin/changelog <ref_until> [<ref_since>]
```
For instance:
```
./bin/changelog v0.9.18
```
A file called `release-notes.md` will be generated and can be used for the release.
## ENV
You may use the following ENV for testing:
```
RUSTC_STABLE="rustc 1.56.1 (59eed8a2a 2021-11-01)"
RUSTC_NIGHTLY="rustc 1.57.0-nightly (51e514c0f 2021-09-12)"
PRE_RELEASE=true
HIDE_SRTOOL_SHELL=true
DEBUG=1
NO_CACHE=1
```
## Considered labels
The following list will likely evolve over time and it will be hard to keep it in sync.
In any case, if you want to find all the labels that are used, search for `meta` in the templates.
Currently, the considered labels are:
- Priority: C<N> labels
- Audit: D<N> labels
- E4 => new host function
- E2 => database migration
- B0 => silent, not showing up
- B1 => noteworthy
- T0 => node
- T1 => runtime
Note that labels with the same letter are mutually exclusive.
A PR should not have both `B0` and `B5`, or both `C1` and `C9`. In case of conflicts, the template will
decide which label will be considered.
## Dev and debuggin
### Hot Reload
The following command allows **Hot Reload**:
```
fswatch templates -e ".*\.md$" | xargs -n1 -I{} ./bin/changelog v0.9.18
```
### Caching
By default, if the changelog data from Github is already present, the calls to the Github API will be skipped
and the local version of the data will be used. This is much faster.
If you know that some labels have changed in Github, you will want to refresh the data.
You can then either delete manually the `<chain>.json` file or `export NO_CACHE=1` to force refreshing the data.
## Full PR list
At times, it may be useful to get a raw full PR list.
In order to produce this list, you first need to fetch the the latest `context.json` from the `release-notes-context` artifacts you can find [here](https://github.com/paritytech/polkadot/actions/workflows/release-30_publish-draft-release.yml). You may store this `context.json` under `scripts/ci/changelog`.
Using the `full_pr_list.md.tera` template, you can generate the `raw` list of changes:
```
cd scripts/ci/changelog
tera --env --env-key env --template templates/full_pr_list.md.tera context.json
```
#!/usr/bin/env ruby
# frozen_string_literal: true
# call for instance as:
# ./bin/changelog <to> [<from>] [<output_file>]
# for instance, for the release notes of v1.2.3:
# ./bin/changelog v1.2.3
# or
# ./bin/changelog v1.2.3 v1.2.2
#
# You may set the ENV NO_CACHE to force fetching from Github
# You should also ensure you set the ENV: GITHUB_TOKEN
require_relative '../lib/changelog'
require 'logger'
logger = Logger.new($stdout)
logger.level = Logger::DEBUG
logger.debug('Starting')
changelogerator_version = `changelogerator --version`
logger.debug(changelogerator_version)
owner = 'paritytech'
repo = 'polkadot'
gh_polkadot = SubRef.new(format('%<owner>s/%<repo>s', { owner: owner, repo: repo }))
last_release_ref = gh_polkadot.get_last_ref()
polkadot_ref2 = ARGV[0] || 'HEAD'
polkadot_ref1 = ARGV[1] || last_release_ref
output = ARGV[2] || 'release-notes.md'
ENV['REF1'] = polkadot_ref1
ENV['REF2'] = polkadot_ref2
substrate_ref1 = gh_polkadot.get_dependency_reference(polkadot_ref1, 'sp-io')
substrate_ref2 = gh_polkadot.get_dependency_reference(polkadot_ref2, 'sp-io')
logger.debug("Polkadot from: #{polkadot_ref1}")
logger.debug("Polkadot to: #{polkadot_ref2}")
logger.debug("Substrate from: #{substrate_ref1}")
logger.debug("Substrate to: #{substrate_ref2}")
substrate_data = 'substrate.json'
polkadot_data = 'polkadot.json'
logger.debug("Using SUBSTRATE: #{substrate_data}")
logger.debug("Using POLKADOT: #{polkadot_data}")
logger.warn('NO_CACHE set') if ENV['NO_CACHE']
if ENV['NO_CACHE'] || !File.file?(polkadot_data)
logger.debug(format('Fetching data for Polkadot into %s', polkadot_data))
cmd = format('changelogerator %<owner>s/%<repo>s -f %<from>s -t %<to>s > %<output>s',
{ owner: owner, repo: 'polkadot', from: polkadot_ref1, to: polkadot_ref2, output: polkadot_data })
system(cmd)
else
logger.debug("Re-using:#{polkadot_data}")
end
if ENV['NO_CACHE'] || !File.file?(substrate_data)
logger.debug(format('Fetching data for Substrate into %s', substrate_data))
cmd = format('changelogerator %<owner>s/%<repo>s -f %<from>s -t %<to>s > %<output>s',
{ owner: owner, repo: 'substrate', from: substrate_ref1, to: substrate_ref2, output: substrate_data })
system(cmd)
else
logger.debug("Re-using:#{substrate_data}")
end
KUSAMA_DIGEST = ENV['KUSAMA_DIGEST'] || 'digests/kusama_srtool_output.json'
WESTEND_DIGEST = ENV['WESTEND_DIGEST'] || 'digests/westend_srtool_output.json'
ROCOCO_DIGEST = ENV['ROCOCO_DIGEST'] || 'digests/rococo_srtool_output.json'
POLKADOT_DIGEST = ENV['POLKADOT_DIGEST'] || 'digests/polkadot_srtool_output.json'
# Here we compose all the pieces together into one
# single big json file.
cmd = format('jq \
--slurpfile substrate %s \
--slurpfile polkadot %s \
--slurpfile srtool_kusama %s \
--slurpfile srtool_westend %s \
--slurpfile srtool_rococo %s \
--slurpfile srtool_polkadot %s \
-n \'{
substrate: $substrate[0],
polkadot: $polkadot[0],
srtool: [
{ name: "kusama", data: $srtool_kusama[0] },
{ name: "westend", data: $srtool_westend[0] },
{ name: "rococo", data: $srtool_rococo[0] },
{ name: "polkadot", data: $srtool_polkadot[0] }
] }\' > context.json', substrate_data, polkadot_data,
KUSAMA_DIGEST,
WESTEND_DIGEST,
ROCOCO_DIGEST,
POLKADOT_DIGEST)
system(cmd)
cmd = format('tera --env --env-key env --include-path templates \
--template templates/template.md.tera context.json > %s', output)
system(cmd)
*.json
# frozen_string_literal: true
# A Class to find Substrate references
class SubRef
require 'octokit'
require 'toml'
attr_reader :client, :repository
def initialize(github_repo)
@client = Octokit::Client.new(
access_token: ENV['GITHUB_TOKEN']
)
@repository = @client.repository(github_repo)
end
# This function checks the Cargo.lock of a given
# Rust project, for a given package, and fetches
# the dependency git ref.
def get_dependency_reference(ref, package)
cargo = TOML::Parser.new(
Base64.decode64(
@client.contents(
@repository.full_name,
path: 'Cargo.lock',
query: { ref: ref.to_s }
).content
)
).parsed
cargo['package'].find { |p| p['name'] == package }['source'].split('#').last
end
# Get the git ref of the last release for the repo.
# repo is given in the form paritytech/polkadot
def get_last_ref()
'refs/tags/' + @client.latest_release(@repository.full_name).tag_name
end
end
{# This file uses the Markdown format with additional templating such as this comment. -#}
{# Such a comment will not show up in the rendered release notes. -#}
{# The content of this file (if any) will be inserted at the top of the release notes -#}
{# and generated for each new release candidate. -#}
{# Ensure you leave an empty line at both top and bottom of this file. -#}
<!-- Such a comment will be rendered but remain invisible in the rendered markdown -->
<!-- Edit below this line -->
<!-- Edit above this line -->
{# This macro shows ONE change #}
{%- macro change(c, cml="[C]", dot="[P]", sub="[S]") -%}
{%- if c.meta.C and c.meta.C.agg.max >= 7 -%}
{%- set prio = " ‼️ HIGH" -%}
{%- elif c.meta.C and c.meta.C.agg.max >= 3 -%}
{%- set prio = " ❗️ Medium" -%}
{%- elif c.meta.C and c.meta.C.agg.max < 3 -%}
{%- set prio = " Low" -%}
{%- else -%}
{%- set prio = "" -%}
{%- endif -%}
{%- set audit = "" -%}
{%- if c.meta.D and c.meta.D.D1 -%}
{%- set audit = "✅ audited " -%}
{%- elif c.meta.D and c.meta.D.D2 -%}
{%- set audit = "✅ trivial " -%}
{%- elif c.meta.D and c.meta.D.D3 -%}
{%- set audit = "✅ trivial " -%}
{%- elif c.meta.D and c.meta.D.D5 -%}
{%- set audit = "⏳ pending non-critical audit " -%}
{%- else -%}
{%- set audit = "" -%}
{%- endif -%}
{%- if c.html_url is containing("polkadot") -%}
{%- set repo = dot -%}
{%- elif c.html_url is containing("substrate") -%}
{%- set repo = sub -%}
{%- else -%}
{%- set repo = " " -%}
{%- endif -%}
{%- if c.meta.T and c.meta.T.T6 -%}
{%- set xcm = " [✉️ XCM]" -%}
{%- else -%}
{%- set xcm = "" -%}
{%- endif -%}
{{- repo }} {{ audit }}[`#{{c.number}}`]({{c.html_url}}) {{- prio }} - {{ c.title | capitalize | truncate(length=120, end="…") }}{{xcm }}
{%- endmacro change -%}
{# This include generates the section showing the changes #}
## Changes
### Legend
- {{ DOT }} Polkadot
- {{ SUB }} Substrate
{% include "changes_client.md.tera" %}
{% include "changes_runtime.md.tera" %}
{% include "changes_api.md.tera" %}
{% include "changes_misc.md.tera" %}
{% import "change.md.tera" as m_c -%}
### API
{#- The changes are sorted by merge date #}
{%- for pr in changes | sort(attribute="merged_at") %}
{%- if pr.meta.B %}
{%- if pr.meta.B.B0 %}
{#- We skip silent ones -#}
{%- else -%}
{%- if pr.meta.T and pr.meta.T.T2 and not pr.title is containing("ompanion") %}
- {{ m_c::change(c=pr) }}
{%- endif -%}
{% endif -%}
{% endif -%}
{% endfor %}
{% import "change.md.tera" as m_c -%}
### Client
{#- The changes are sorted by merge date #}
{%- for pr in changes | sort(attribute="merged_at") %}
{%- if pr.meta.B %}
{%- if pr.meta.B.B0 %}
{#- We skip silent ones -#}
{%- else -%}
{%- if pr.meta.T and pr.meta.T.T0 and not pr.title is containing("ompanion") %}
- {{ m_c::change(c=pr) }}
{%- endif -%}
{% endif -%}
{% endif -%}
{% endfor %}
{%- import "change.md.tera" as m_c -%}
{%- set_global misc_count = 0 -%}
{#- First pass to count #}
{%- for pr in changes -%}
{%- if pr.meta.B %}
{%- if pr.meta.B.B0 -%}
{#- We skip silent ones -#}
{%- else -%}
{%- if pr.meta.T and pr.meta.T.agg.max > 2 %}
{%- set_global misc_count = misc_count + 1 -%}
{%- endif -%}
{% endif -%}
{% endif -%}
{% endfor -%}
<!-- Found {{ misc_count }} misc PRs -->
{%- if misc_count > 0 %}
### Misc
{% if misc_count > 10 %}
There are other misc. changes. You can expand the list below to view them all.
<details><summary>Other misc. changes</summary>
{% endif -%}
{#- The changes are sorted by merge date #}
{%- for pr in changes | sort(attribute="merged_at") %}
{%- if pr.meta.B and not pr.title is containing("ompanion") %}
{%- if pr.meta.B.B0 %}
{#- We skip silent ones -#}
{%- else -%}
{%- if pr.meta.T and pr.meta.T.agg.max > 2 %}
- {{ m_c::change(c=pr) }}
{%- endif -%}
{% endif -%}
{% endif -%}
{% endfor %}
{% if misc_count > 10 %}
</details>
{% endif -%}
{% endif -%}
{%- import "change.md.tera" as m_c -%}
### Runtime
{#- The changes are sorted by merge date -#}
{% for pr in changes | sort(attribute="merged_at") -%}
{%- if pr.meta.B -%}
{%- if pr.meta.B.B0 -%}
{#- We skip silent ones -#}
{%- else -%}
{%- if pr.meta.T and pr.meta.T.T1 and not pr.title is containing("ompanion") %}
- {{ m_c::change(c=pr) }}
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endfor %}
## Rust compiler versions
This release was built and tested against the following versions of `rustc`.
Other versions may work.
- Rust Stable: `{{ env.RUSTC_STABLE }}`
- Rust Nightly: `{{ env.RUSTC_NIGHTLY }}`
{%- set to_ignore = changes | filter(attribute="meta.B.B0") %}
<!--
changes:
- total: {{ changes | length }}
- silent: {{ to_ignore | length }}
- remaining: {{ changes | length - to_ignore | length }}
-->
## Docker image
The docker image for this release can be found at [Docker hub](https://hub.docker.com/r/parity/polkadot/tags?page=1&ordering=last_updated)
(It will be available a few minutes after the release has been published).
You may pull it using:
```
docker pull parity/polkadot:latest
```
{# This is a helper template to get the FULL PR list #}
{# It is not used in the release notes #}
# PR list
## substrate
{%- for change in substrate.changes %}
- [S] [`{{ change.number }}`]({{ change.html_url }}) - {{ change.title }}
{%- endfor %}
## polkadot
{%- for change in polkadot.changes %}
- [P] [`{{ change.number }}`]({{ change.html_url }}) - {{ change.title }}
{%- endfor %}
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