Skip to content
This repository was archived by the owner on May 3, 2022. It is now read-only.

Commit 72958d9

Browse files
committed
feat(release): prepare release notes
Signed-off-by: Paul Pietkiewicz <[email protected]>
1 parent 0d365ba commit 72958d9

File tree

2 files changed

+288
-1
lines changed

2 files changed

+288
-1
lines changed

docs/Contributing/Release.md

+287
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,287 @@
1+
# Release Process
2+
3+
## Pre-work:
4+
- [create crates.io account](https://doc.rust-lang.org/cargo/reference/publishing.html#before-your-first-publish)
5+
- Make sure you are a member of the [enarx/owners](https://github.com/orgs/enarx/teams/owners) GitHub team
6+
- Get a crates.io token and set it to .
7+
- get a clean enarx repo from here: `git clone https://github.com/enarx/enarx.git`
8+
- > export UPSTREAM="upstream"
9+
> git remote rename origin upstream
10+
> ```
11+
> * `origin` points to the user's fork
12+
> ```bash
13+
> export FORK="origin"
14+
> git remote add origin https://github.com/<username>/enarx.git
15+
- ensure you have git credentials available to push to origin
16+
- make sure you have write permissions to `enarx/enarx` or other repositories
17+
18+
## Versioning
19+
- Breaking changes require a major version number increase, assuming a stable >0 major release
20+
- Features require a minor number increase
21+
- Bugfixes require a patch number increase
22+
23+
## Remotes
24+
> **NOTE:** Regarding git remotes:
25+
> * `upstream` points to core repository location
26+
> ```bash
27+
> export UPSTREAM="upstream"
28+
> git remote rename origin upstream
29+
> ```
30+
> * `origin` points to the user's fork
31+
> ```bash
32+
> export FORK="origin"
33+
> git remote add origin https://github.com/<username>/enarx.git
34+
> ```
35+
36+
37+
## Prerequisites:
38+
- Prepare release notes
39+
- `cargo` credentials are cached
40+
- `git` credentials are available on host to allow pushing code
41+
- `gh` installed and configured
42+
- You are running the build process on a X86_64 host
43+
- Freeze all merges until release process complete
44+
45+
46+
## Weekly chores
47+
* [Update Rust toolchain](https://github.com/enarx/enarx/actions/workflows/rust-toolchain-update.yml)
48+
* [Update Cargo dependencies](https://github.com/enarx/enarx/actions/workflows/cargo-update.yml)
49+
50+
51+
### Update and release prerequiste crates
52+
> **NOTE:** The list of crates that need to be updated for a release can be seen by running this following command:
53+
> ```bash
54+
> grep -R 'git+https' *.lock | sort | uniq
55+
> ```
56+
57+
------
58+
TODO: we need a better way to determine this. JSONpath? better grep?
59+
if the enarx repo
60+
if there is a git hash specified in in the Cargo.toml
61+
then we need to ensure that for that crate that there exists a published version which includes that revision/commit
62+
63+
if there is a git or path dependency then there is a published version that there is a most recent verison of the crate/HEAD
64+
65+
HASH or head.
66+
67+
if not a publish that contains a published release, then make that release for that crate
68+
and update Cargo.toml with that crate version (removing the hash/head)
69+
70+
# tag all of the individual commits for each one of the bindeps and push
71+
72+
73+
------
74+
75+
> This may be an optional step dependant on whether there are relevant changes in the prerequisite crates, including:
76+
> * [crt0stack](https://github.com/enarx/crt0stack)
77+
> * [flagset](https://github.com/enarx/flagset)
78+
> * [iocuddle](https://github.com/enarx/iocuddle)
79+
> * [lset](https://github.com/enarx/lset)
80+
> * [mmarinus](https://github.com/enarx/mmarinus)
81+
> * [mmledger](https://github.com/enarx/mmledger)
82+
> * [nbytes](https://github.com/enarx/nbytes)
83+
> * [noted](https://github.com/enarx/noted)
84+
> * [primordial](https://github.com/enarx/primordial)
85+
> * [rcrt1](https://github.com/enarx/rcrt1)
86+
> * [sallyport](https://github.com/enarx/sallyport)
87+
> * [sgx](https://github.com/enarx/sgx)
88+
> * [snp](https://github.com/enarx/snp)
89+
> * [vdso](https://github.com/enarx/vdso)
90+
> * [xsave](https://github.com/enarx/xsave)
91+
92+
#### Assumptions:
93+
- All approved PRs are merged
94+
- Rust toolchain (if using snapshot) and `cargo update` has been run
95+
96+
#### Steps:
97+
- Determine expected version by reviewing output of `git log`
98+
- Set new version
99+
```bash
100+
export MAJOR=0
101+
export MINOR=2
102+
export PATCH=2
103+
export NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}"
104+
```
105+
- Set REPO variable, assuming GitHub repository matches directory name
106+
```bash
107+
export REPO="$(basename ${PWD})"
108+
```
109+
- Get latest updates and checkout branch
110+
> **NOTE:** The following assumes a new release
111+
```bash
112+
git fetch ${UPSTREAM}
113+
git checkout -b "b${MAJOR}.${MINOR}.z" ${UPSTREAM}/main
114+
```
115+
- Determine if crate builds and if it works
116+
```bash
117+
cargo clean
118+
cargo build --release
119+
cargo test
120+
```
121+
- Update version in `Cargo.toml`
122+
```bash
123+
sed -i 's/^version = .*/version = \"'${NEW_VERSION}'\"/' Cargo.toml
124+
cargo update -p $(grep name Cargo.toml | cut -d'"' -f2)
125+
```
126+
- Run `cargo test` again
127+
```bash
128+
cargo clean
129+
cargo build --release
130+
cargo test
131+
```
132+
- Check if cargo successfully builds with dry run
133+
```bash
134+
cargo publish --allow-dirty -v --dry-run
135+
```
136+
- Commit change and push to repo
137+
```bash
138+
git commit -asS -m "chore(release): release v${NEW_VERSION}"
139+
git push ${FORK} b${MAJOR}.${MINOR}.z
140+
```
141+
- Create a PR
142+
```bash
143+
gh pr create -t "chore(release): release v${NEW_VERSION}" \
144+
-b "chore(release): release v${NEW_VERSION}" \
145+
-R enarx/${REPO}
146+
```
147+
- Confirm that changes passed on CI and merge PR
148+
- Checkout merged release branch
149+
```bash
150+
git fetch ${UPSTREAM}
151+
git checkout ${UPSTREAM}/main
152+
```
153+
- Tag the new release on upstream
154+
```bash
155+
git tag --sign -m "chore(release): Release v${NEW_VERSION}" v${NEW_VERSION}
156+
git push ${UPSTREAM} v${NEW_VERSION}
157+
```
158+
- Cargo publish
159+
> **NOTE:** Assuming cargo credentials are cached
160+
```bash
161+
cargo publish -v
162+
```
163+
164+
### The Enarx release itself
165+
- Determine expected version by reviewing output of `git log`
166+
- Set new version
167+
```bash
168+
export MAJOR=0
169+
export MINOR=2
170+
export PATCH=2
171+
export NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}"
172+
```
173+
- Get latest updates and checkout branch
174+
```bash
175+
git fetch ${UPSTREAM}
176+
git checkout -b "b${MAJOR}.${MINOR}.z" ${UPSTREAM}/main
177+
```
178+
- Bump version inside sub-crate `src/bin/{shim-kvm,shim-sgx,exec-wasmtime}/Cargo.toml` files
179+
```bash
180+
for d in src/bin/*/ ; do ( cd "$d"
181+
sed -i 's/^version = .*/version = \"'${NEW_VERSION}'\"/' Cargo.toml
182+
cargo update -p enarx-$(basename ${d}) )
183+
done
184+
sed -i 's/^version = .*/version = \"'${NEW_VERSION}'\"/' Cargo.toml
185+
cargo update -p $(grep name Cargo.toml | cut -d'"' -f2)
186+
```
187+
- _POTENTIALLY OPTIONAL STEP: If there are any changes in the prerequisite crates (e.g. `xsave`, `sallyport`, etc) then it will be required to manually update the crates now_
188+
```bash
189+
export UPDATED_PREREQUISTES=(xsave sallyport)
190+
for d in src/bin/*/ ; do ( cd "$d"
191+
for p in ${UPDATED_PREREQUISTES[@]]}; do
192+
cargo update -p "${p}"
193+
done
194+
done
195+
for p in ${UPDATED_PREREQUISTES[@]]}; do cargo update -p ${p}; done
196+
```
197+
- Run unit tests
198+
```bash
199+
cargo clean
200+
cargo build --release
201+
cargo test
202+
```
203+
- Check cargo manifest
204+
```bash
205+
cargo package --allow-dirty -l
206+
```
207+
- Check if cargo successfully builds with dry run
208+
```bash
209+
cd src/bin/shim-kvm; cargo publish --allow-dirty --dry-run -v --target x86_64-unknown-none; cd ..
210+
cd shim-sgx; cargo publish --allow-dirty --dry-run -v --target x86_64-unknown-none; cd ..
211+
cd exec-wasmtime; cargo publish --allow-dirty --dry-run -v ; cd ../..
212+
```
213+
- Commit change and push to repo
214+
```bash
215+
git commit -asS -m "chore(release): Release v${NEW_VERSION}"
216+
git push ${FORK} "release/${NEW_VERSION}"
217+
```
218+
- Packaging binary dependency crates
219+
> **NOTE:** Assuming cargo credentials are cached
220+
```bash
221+
cd src/bin/shim-kvm; cargo publish -v --target x86_64-unknown-none; cd ..
222+
cd shim-sgx; cargo publish -v --target x86_64-unknown-none; cd ..
223+
cd exec-wasmtime; cargo publish -v ; cd ../..
224+
```
225+
- Update enarx dependencies
226+
```bash
227+
export UPDATED_BINDEPS=(enarx-exec-wasmtime enarx-shim-kvm enarx-shim-sgx)
228+
for p in ${UPDATED_PREREQUISTES[@]]}; do
229+
cargo update -p "${p}"
230+
done
231+
```
232+
- Run unit tests
233+
```bash
234+
cargo clean
235+
cargo build --release
236+
cargo test
237+
```
238+
- Cargo dry-run publish
239+
```bash
240+
cargo publish --allow-dirty --dry-run -v
241+
```
242+
- Commit change and push to repo
243+
```bash
244+
git commit -asS --amend
245+
git push --force ${FORK} "release/${NEW_VERSION}"
246+
```
247+
- Create a PR
248+
```bash
249+
gh pr create -t "chore(release): release v${NEW_VERSION}" \
250+
-b "chore(release): release v${NEW_VERSION}" \
251+
-R enarx/${REPO}
252+
```
253+
- Confirm that changes passed on CI and merge PR
254+
- Checkout merged release branch
255+
```bash
256+
git fetch ${UPSTREAM}
257+
git checkout ${UPSTREAM}/main
258+
```
259+
- Tag the new release on upstream
260+
```bash
261+
git tag --sign -m "chore(release): release v${NEW_VERSION}" v${NEW_VERSION}
262+
git push ${UPSTREAM} v${NEW_VERSION}
263+
```
264+
- Create a release PR
265+
```bash
266+
gh pr create -t "release v${NEW_VERSION}" \
267+
-b ""
268+
-B main \
269+
-R enarx/enarx
270+
```
271+
- Merge release PR
272+
- Get list of files we plan on uploading to `cargo`
273+
```bash
274+
cargo package --list
275+
```
276+
- Cargo publish
277+
```bash
278+
cargo publish -v
279+
```
280+
- Create draft GitHub release
281+
```bash
282+
gh release create -d --generate-notes "v${NEW_VERSION}"
283+
```
284+
- Update release notes on draft GitHub release
285+
- Publish GitHub release
286+
- Send notification to RocketChat #annoucements & #general channels
287+
- Assign issue to post release to social media channels

sidebars.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const sidebars = {
4141
{
4242
type: 'category',
4343
label: 'Contributing Guide',
44-
items: ['Contributing/Introduction','Contributing/Onboarding','Contributing/Code','Contributing/Coding-Style','Contributing/Git-hook','Contributing/PRs','Contributing/Issues','Contributing/RFCs','Contributing/Docs','Contributing/Outreach','Contributing/Lab'],
44+
items: ['Contributing/Introduction','Contributing/Onboarding','Contributing/Code','Contributing/Coding-Style','Contributing/Git-hook','Contributing/PRs','Contributing/Issues','Contributing/RFCs','Contributing/Docs','Contributing/Outreach','Contributing/Lab', 'Contributing/Release'],
4545
},
4646
{
4747
type: 'category',

0 commit comments

Comments
 (0)