Closed shannonwells closed 2 years ago
I have set up various release processes with different git branch strategies in the past in (GitHub flow, GitLab flow, trunk-based development, etc.) based on Commitizen and Conventional Commits . May be helpful here.
Here is my approach here at high level. Please let me know if I am missing anything:
main
but not when the main is tagged, why so many if
s, etc.), so I'd like to map it all out in a diagram first and offer some improvements. I am removing "documentation" label because this story is not going to be documentation only. I will be proposing a new release process with some updated GitHub workflows.
@wilwade @saraswatpuneet Here is the diagram depicting the current status quo in the Frequency CI. I have intentionally skipped some minor steps (like cache action) for brevity. Please take a look and let me know if you see anything off.
Working on the new CI, I eventually need to know the following:
ubuntu-latest
and nightly-2022-07-23
@demisx
Is there anything in the current process that we do not want to carry over to the new one?
Is there anything in the current process that needs to be done differently?
@demisx
What OSs and Rust Toolchains we need to support? Currently I only see ubuntu-latest and nightly-2022-07-23
@demisx One other thing.
We should move mdbook deployments to the release tagging instead of main likely. Or deploy to two different locations.
@wilwade Thank you for the feedback. I'm keeping the wishlist in mind and there will be places in CI workflow for the new jobs to be plugged into.
In general, here are the high level principles I am sticking to:
main
.I will share the new diagram for feedback once it's ready.
One other thing. We should move mdbook deployments to the release tagging instead of main likely. Or deploy to two different locations.
@wilwade ❓ Can you please clarify what you mean here? I am not seeing any mdbook deployment in the current workflows. Unless I'm missing something.
Here is the proposed CI workflow for "commit pushed to PR branch" event. The goal is to run all necessary checks required to vet the changes. In other words, if this workflow succeeds, then we should be 100% confident that the code can be merged to main
. Please let me know if I missed anything or if you have any questions.
https://docs.google.com/drawings/d/1IcAzZbulRcntYQ5ub-zDyIkqJY1NE0iqClhkg2PE5lo/edit
One other thing. We should move mdbook deployments to the release tagging instead of main likely. Or deploy to two different locations.
@wilwade ❓ Can you please clarify what you mean here? I am not seeing any mdbook deployment in the current workflows. Unless I'm missing something.
That's on me. The Frequency generated documentation not mdbook. Sorry about that.
@wilwade Oh, I see. Yes, all artifacts will be published an uploaded at once, meaning the Frequency docs will be published during release phase.
Re: proposed CI workflow for "commit pushed to PR branch" event
@wilwade I've updated the diagram with appropriate notes per your feedback. As far as #376 goes, I've reserved a job for it for future implementation. I do not know right now what are the steps until there are examples of running runtime checks.
Moving forward with the next workflow.
@wilwade @saraswatpuneet So far, I have identified the following artifacts:
@next
latest
There are different options on how we can release:
main
is auto-released (similar to trunk based development)main
.A couple of questions:
main
. I can't think of anything except maybe "JS API Augment NPM Package published on NPM as @next
" since the @next
represents an upcoming version?@demisx I think option 2 is followed by many projects in this space
@saraswatpuneet Agreed. That's the most common option especially for new teams. Thank you for your feedback. Let's see if @wilwade has any other preference.
Here is a short comparison on release handling between these networks:
Network | Release Branch Name | Strategy | Release Tag | Ties to Polkadot or Substrate Version | |
---|---|---|---|---|---|
Polkadot | release-v[0-9]+.[0-9]+.[0-9]+* | Separate branch per each release. A release is published after each commit to each branch | v[0-9]+.[0-9]+.[0-9]+* | Polkadot | |
Acala | release-acala-[0-9]+.[0-9]+.[0-9]+ | Separate branch per each release. A release is triggered by manually running "Publish Release" GitHub workflow. | [0-9]+.[0-9]+.[0-9]+ | No | |
Moonbeam | None | Binary and runtime are released separately. Releases are triggered by manually running "Publish Binary" or "Publish Runtime" GitHub workflows. | v[0-9]+.[0-9]+.[0-9] | v[0-9]+.[0-9]+.[0-9]+ runtime-[0-9]+ |
No |
So, assuming we also create a separate release branch and tie it to the Polkadot version with modifier (i.e. release-v0.9.27-1
), the next question would be – do we want to ❓ :
Ideally we should cut a release branch with tag and a release once we are comfortable with changes with current polkadot version and expect no new releases for the same branch
Reason: we are in decentralized world we can't dictate all our possible collators everytime we make a huge change to already released version
Based on my earlier Slack conversation with @saraswatpuneet and @wilwade, so far the release process is expected to be as such (high level). This most likely will change, but is a good starting point:
vX.X.X
vX.X.X
on main
release-vX.X.X-1
from main. Perhaps this can be viewed as release candidate at this pointmain
and merged to the release branchrelease-vX.X.X-1
branch with release tag vX.X.X-1
and pushrelease-vX.X.X-1
is locked, meaning once released, there will be no more changes on this release branchrelease-vX.X.X-2
branch (with incremented modifier 2) and the process repeats from step 4Something to think about:
v0.9.29
), how about we do this on the existing release-vX.X.X
branch and only increment the modifier in the release tag, i.e. vX.X.X-2
, vX.X.X-3
, etc.? Basically, having one release branch per Polkadot version and we'll be able to release from it multiple times. Should cut down on the number of branches in remote.main
? Something like a hot fix? Or should this branch be protected?release-v0.9.30
but the bug applies to all release-v0.8.x
releases. Where would we fix that bug? On main
or directly on the existing release branches?Here is the first iteration (V2.0) of the new CI workflows. There are 3 triggering events:
Please review and let me know if you have any feedback. Especially item 2 and item 3 as they are brand new additions.
https://docs.google.com/drawings/d/1IcAzZbulRcntYQ5ub-zDyIkqJY1NE0iqClhkg2PE5lo
@demisx A few notes to think about, but I think this is 100% shipable.
@wilwade Thank you for your feedback. Highly appreciate it. 🙏🏻 Sorry, I should've emphasized that the first iteration of redesign is focused mainly on porting existing functionality to the new process. I want to get us back to status quo first with the new CI, resolve issues and polish things out. Once we feel comfortable the new CI runs smoothly, we are ready to start adding new features. Of course, if there is something of a high priority that needs to be added right away we'll make this happen.
As far as #4 goes, the sanity checks can be anything that helps us efficiently and promptly catch any code issues. I am sure we'd be adding a bunch along the way as we learn new lessons. I am also for automating peering and keeping that manual checklist as short as possible. Please feel free to create a new story and assign it to me. Or I can do it myself with the details you gave me above. Whatever helps.
@demisx Sounds great! Let's make it happen :)
I am working on implementing the first "Push PR Commit" trigger. I'll keep an eye on this issue if additional feedback is provided. I want to introduce the following naming convention that helps us quickly map any given workflow file to the corresponding process in the diagram. Since GitHub workflows don't support nested folders yet, I'd have to rely solely on the file name:
<trigger-event>.<workflow-name>.yml
Examples:
push-pr-commit.verify-binary-docker-images.yml
push-pr-commit.run-frequency-integration-tests.yml
merge-pr.publish-js-api-augment-rc.yml
create-release.publish-binaries-node-images.yml
create-release.publish-wasm.yml
What was the justification for including this step in the current CI workflows? Trying to determine if we really need to carry it over to the new CI workflows.
- name: Free space on Ubuntu
if: ${{ matrix.os }} == 'ubuntu-latest'
run: |
echo "Pre cleanup"
df -h
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
echo "Post cleanup"
df -h
@demisx it was for something I dont remember, we can remove it if we will keep os type same in matrix and hence it is just for Ubuntu cleanup
@saraswatpuneet No problem. I left it out for now. We can always add it later if such need arises.
So, I watched the Cachepot presentation and did some research on this sccache fork online. It's an interesting project, but I don't see an easy way to integrate it with GitHub Actions CI right now. At least, I couldn't find an existing GitHub action ready to be used. I am going to try other solutions and optimization techniques first.
One of the recommended optimization is to disable incremental compilation in CI. So, I am going to try to cargo build as such. Let me know if you guys see any issues with it.
CARGO_INCREMENTAL=0 cargo build --locked --release --features frequency
These are the current execution times for future reference. Though, GitHub Actions is experiencing degraded performance right now, but at least we should not see it worse. So far, there is 40% improvement in vetting PR commit.
This is the new file naming convention for the released binaries. Let me know if you'd like to change it in any way.
The Directory Structure Wiki has been updated with the new CI workflows info:
@wilwade @saraswatpuneet So I did various test runs and adjustments today. Captured some good points that I will put together in presentable format and share in am.
For now, I think I can leave v0.1.3
release as the baseline release under new CI which has all functionality ported from the previous workflows. Please take a look at the released artifacts and let me know if you see any issues.
Here is what's being released each time we push a release tag to remote:
Number | Artifact | Network | Location |
---|---|---|---|
1 | Frequency Binary (amd64) | Mainnet | GitHub Releases |
2 | Frequency Binary (arm64) | Mainnet | GitHub Releases |
3 | Frequency Binary (amd64) | Rococo | GitHub Releases |
4 | Frequency Binary (arm64) | Rococo | GitHub Releases |
5 | Frequency WASM | Mainnet | GitHub Releases |
6 | Frequency WASM | Rococo | GitHub Releases |
7 | Collator Node Dev Image | Local | DockerHub |
8 | Collator Node in Instant Seal Node | Local | DockerHub |
9 | Parachain Node | Rococo | DockerHub |
10 | Parachain Node | Mainnet | DockerHub |
11 | Rust Developer Docs | N/A | https://libertydsnp.github.io/frequency/ |
12 | JS API Augment | N/A | NPM Registry |
The CI diagram (v2) has been adjusted to reflect the latest and greatest at the time of writing.
@wilwade Here are some notes and findings from implementation of the new CI. Would you like to prioritize any of these for me to work on next? Some long-terms can be placed into icebox.
main
. Should we start working on multiple release branch Git workflow next?main
branch after merge. Developers will need to rebase their PRs onto origin/main
before a PR can be merged. amd64
and arch64
platforms, but the docker images are amd64
only. Not sure if this is an issue. latest: 0.1.3
and next: 0.0.0-[short-sha]
. Do we want to change the latter?package.json
I've been testing this approach with the release workflow doing all the builds first then releasing artifacts in parallel right after all builds have finished successfully. However, there are still 2 issues keeping it away from ideal:
cache-hit
and trigger build if false
, but I wan to avoid building multiple times.I am going to run more tests today and look for a better solution out there to make it more fail proof.
Based on our Slack discussions, these are the assumptions I am using as a starting point for the new multi-branch workflow:
origin/main
main
and whatever other branch those changes may be applicable to.vx.x.x*
release tag is pushed to the remote, regardless of the branchThese are some initial thoughts on the branch naming. Most likely will change once feedback is collected from the team.
Number | Branch Naming | Purpose |
---|---|---|
1 | release-vx.x.x* (version before last) |
Corresponds to the version the Mainnet is on (live) |
2 | release-vx.x.x* (last version) |
Corresponds to the version Rococo is on |
3 | origin/main |
Represents the next version of the chain under development |
Based on our Slack discussions, here are the refined assumptions:
v0.9.29
, v0.9.30
, etc.main
vx.x.x*
release tag is pushed to the remote, regardless of the branchmain
and whatever other release branch those changes may be applicable to.Number | Branch Naming | Purpose |
---|---|---|
1 | release-vx.x.x* |
Corresponds to a given released Polkadot version, e.g. release-v0.9.29 , release-v0.9.30 , release-v0.9.30-1 , etc. |
2 | origin/main |
Represents release candidate - the next version of the chain under development |
Here is the visual representation of Frequency Git Workflow. Covers the following use cases:
Let me know if I missed any use cases. The next step would be to document this workflow in Wiki and describe each use case in more detail, so developers can easily follow it.
I've put together the initial Wiki page describing our Frequency Git Workflow. Trying to keep it concise, straight to the point, so developers are most likely to read the whole thing.
https://github.com/LibertyDSNP/frequency/wiki/Frequency-Git-Workflow
Please let me know if you have any feedback. Also, feel free to re-word sentences directly as needed.
Polkadot uses these sort of templates to generate release notes. I like this templated approach as it's pretty flexible. Looking into something similar. Don't want to introduce a new 3-rd party dependency on Ruby like the do. Maybe we can achieve something similar with Handlebars.js
So, I’ve evaluated Mustache, HandlebarsJS and a couple other templating engines with CLI support. Though not as mature as the first two, I think it makes sense to go with Tera templating engine and tera-cli for this project. It’s written in Rust and this is what Polkadot uses too.
My plan is to set up a release notes template in Tera and then pass JSON data context into it in release workflow. This should give us a good flexibility to adjust the format of release notes in the future.
Adding this Polkadot Release Checklist to the description for future reference.
Here is the process I am thinking of following for generating binary signatures. Please feel free to comment:
(Frequency) <security@frequency.xyz>)
?) for key generationUPDATE: Moved this checklist to #594 where it belongs.
I need to know the latest release in order to generate change log during the new release CI run. I am planning to introduce the latest
tag that will always point to the latest release. This way it's consistent with GitHub and Docker Hub. Let me know if anyone has any objections or better ideas.
Per conversation with @wilwade, a release candidate will still generate a change log, but it will do it against the latest full release. A new full release will still compare against the previous full release, thus disregarding the release candidates in between.
Currently testing mainly these change log generators:
@wilwade If we update CHANGELOG.md
during release I can easily commit it to the release branch. However, I would think we'd want those changes also backported to main
. I see 3 ways to go about this:
CHANGELOG.md
and track changes in GitHub releases only. Looks like this is what Polkadot, Moonbeam, Alstar, Acala are doing.main
The first one is easier to implement, followed by the 2nd, but the 3rd one may be safer. Do you have any preference here?
We need to document how we are doing releases. Both the process of doing it, and the documentation that accompanies each release.
Ideas
Things the Release Should Have/Contain
Maybe in the future we will do an arm64 binary, but the weights did not come out good enough. #367
Notes:
Per @saraswatpuneet:
Per @wilwade:
Frequency-v0.9.28-1
for exampleNotes on the Baseline Process as of 10/11/22:
main
. Should we start working on multiple release branch Git workflow next?main
branch after merge. Developers will need to rebase their PRs ontoorigin/main
before a PR can be merged.amd64
andarch64
platforms, but the docker images areamd64
only. Not sure if this is an issue.latest: 0.1.3
andnext: 0.0.0-[short-sha]
. Do we want to change the latter?package.json
Tasks:
${{runner.os}}-cargo-${{hashFiles('**/Cargo.lock')}}
to something like${{runner.os}}-cargo-${{github.ref}}
actions-rs/cargo@v1
instead of inline command**/282-test-file.*
Add "Check extrinsic order' CI task similar to PolkadotMoved to #624