2025-03-21 04:15:26 +00:00
|
|
|
|
# Version Bump
|
|
|
|
|
|
|
|
|
|
|
|
## Version Numbers
|
|
|
|
|
|
|
|
|
|
|
|
Currently, Asterinas regularly releases two main artifacts
|
|
|
|
|
|
for the Rust OS developer community:
|
|
|
|
|
|
the [OSDK](https://crates.io/crates/cargo-osdk) and [OSTD](https://crates.io/crates/ostd).
|
|
|
|
|
|
To support development with these tools,
|
|
|
|
|
|
we also publish companion Docker images on DockerHub,
|
|
|
|
|
|
(i.e., [`asterinas/osdk`](https://hub.docker.com/r/asterinas/osdk)).
|
|
|
|
|
|
While the Asterinas kernel is not yet ready for public binary release,
|
|
|
|
|
|
its development Docker images
|
|
|
|
|
|
(i.e., [`asterinas/asterinas`](https://hub.docker.com/r/asterinas/asterinas))
|
|
|
|
|
|
are released regularly.
|
|
|
|
|
|
|
|
|
|
|
|
All released crates for OSDK and OSTD share the same version number,
|
|
|
|
|
|
which is stored in the `VERSION` file at the project root.
|
|
|
|
|
|
The current content of this file is shown below.
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
{{#include ../../../VERSION}}
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
Similarly,
|
|
|
|
|
|
the Docker images’ version number is stored in the `DOCKER_IMAGE_VERSION` file,
|
|
|
|
|
|
as shown below.
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
{{#include ../../../DOCKER_IMAGE_VERSION}}
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
We use a custom format for Docker image versions: `MAJOR.MINOR.PATCH-DATE`.
|
|
|
|
|
|
The `MAJOR.MINOR.PATCH` component aligns with the target version of published crates,
|
|
|
|
|
|
while the `DATE` component allows us to introduce non-breaking updates to the Docker images
|
|
|
|
|
|
without publishing a new crate version.
|
|
|
|
|
|
Normally,
|
|
|
|
|
|
the version in `VERSION` and the version in `DOCKER_IMAGE_VERSION`
|
|
|
|
|
|
(ignoring the `DATE` part) are identical,
|
|
|
|
|
|
except during the version bump process.
|
|
|
|
|
|
|
|
|
|
|
|
## How to Bump Versions
|
|
|
|
|
|
|
2025-03-21 07:39:44 +00:00
|
|
|
|
We recommend a three-commit procedure to bump versions:
|
|
|
|
|
|
1. **Commit 1 "Bump the Docker image version"** triggers the generation of a new Docker image.
|
|
|
|
|
|
2. **Commit 2 "Switch to a new Docker image"** makes the codebase use the new Docker image.
|
|
|
|
|
|
3. **Commit 3 "Bump the project version"** triggers the release of new crates.
|
2025-03-21 04:15:26 +00:00
|
|
|
|
|
2025-03-21 07:58:56 +00:00
|
|
|
|
Depending on your exact purpose,
|
2025-03-21 07:39:44 +00:00
|
|
|
|
you may complete the version bump process with at most three commits within two PRs.
|
|
|
|
|
|
* **To make non-breaking changes to the Docker images**,
|
|
|
|
|
|
submit Commit 1 in a PR, then Commit 2 in another.
|
|
|
|
|
|
* **To make breaking changes to the Docker images and the crates' APIs**,
|
|
|
|
|
|
submit Commit 1 in a PR, then Commit 2 and 3 in another.
|
2025-03-21 04:15:26 +00:00
|
|
|
|
|
2025-03-21 07:39:44 +00:00
|
|
|
|
Across the three commits,
|
|
|
|
|
|
you will be assisted with a convenient utility script, `tools/bump_version.sh`,
|
2025-03-21 04:15:26 +00:00
|
|
|
|
|
2025-03-21 07:39:44 +00:00
|
|
|
|
### Commit 1: "Bump the Docker image version"
|
2025-03-21 04:15:26 +00:00
|
|
|
|
|
|
|
|
|
|
After updating the Docker image content
|
|
|
|
|
|
(specified by the `tools/docker/Dockerfile.jinja` file),
|
|
|
|
|
|
increment the Docker image version using the following command:
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
bump_version.sh --docker_version_file [major | minor | patch | date]
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
The second argument specifies which part of the Docker image version to increment.
|
|
|
|
|
|
Use `date` for non-breaking Docker image changes.
|
2025-03-21 07:39:44 +00:00
|
|
|
|
If the changes affect the crates intended to publish,
|
2025-03-21 04:15:26 +00:00
|
|
|
|
select `major`, `minor`, or `patch` in line with semantic versioning.
|
|
|
|
|
|
|
|
|
|
|
|
This command updates the `DOCKER_IMAGE_VERSION` file.
|
|
|
|
|
|
Submit these changes as a pull request.
|
|
|
|
|
|
Once merged, the CI will automatically trigger the creation of new Docker images.
|
|
|
|
|
|
|
2025-03-21 07:39:44 +00:00
|
|
|
|
### Commit 2: "Switch to a new Docker image"
|
2025-03-21 04:15:26 +00:00
|
|
|
|
|
|
|
|
|
|
Creating new Docker images can be time-consuming.
|
|
|
|
|
|
Once the images have been pushed to DockerHub,
|
2025-03-21 07:39:44 +00:00
|
|
|
|
write a follow-up commit to
|
2025-03-21 04:15:26 +00:00
|
|
|
|
update all Docker image version references across the codebase.
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
bump_version.sh --docker_version_refs
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2025-03-21 07:39:44 +00:00
|
|
|
|
If your purpose is to publish non-breaking changes to the Docker images,
|
|
|
|
|
|
then submit this commit in a PR and then your job is finished.
|
|
|
|
|
|
Otherwise, go on with Commit 3.
|
2025-03-21 04:15:26 +00:00
|
|
|
|
|
2025-03-21 07:39:44 +00:00
|
|
|
|
### Commit 3: "Bump the project version"
|
2025-03-21 04:15:26 +00:00
|
|
|
|
|
2025-03-21 07:39:44 +00:00
|
|
|
|
In this commit,
|
|
|
|
|
|
synchronize the version number in `VERSION` with
|
2025-03-21 04:15:26 +00:00
|
|
|
|
that in `DOCKER_IMAGE_VERSION` by running:
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
bump_version.sh --version_file
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
This command also updates all version numbers
|
|
|
|
|
|
in the `Cargo.toml` files of all crates scheduled for release.
|
2025-03-21 07:39:44 +00:00
|
|
|
|
Pack these changes into a third commit and
|
|
|
|
|
|
submit the last two commits in a single PR.
|
|
|
|
|
|
After the PR is merged into the `main` branch,
|
2025-03-21 04:15:26 +00:00
|
|
|
|
the CI will automatically publish the new crate versions.
|