Release
This document describes how to start a new release from gitlab, how to generate the release artefacts and how to retrieve them.
Release git workflow
- Before starting the release, merge all the wanted features into
develop. - Update the changelog
- From
develop, execute the scriptdev-tools/start-release-branch.sh.- The script will create the release branch with the appropriate name and also update the version file.
- Bugfix still can be done in the release branch but no new features are expected.
- Create a Pull request from the
release/x.y.zbranch tomasteranddevelop- The CI will generate binaries for all supported platform and will upload them to the gitlab package registry. This process can be done manually, c.f below to learn more about it.
- When the pipeline end without error, do the merges.
- Master's pipeline will automatically push the appropriated tag.
Git Tagging
Auto-tagging is enabled. This means that when a new code is pushed into master, the CI will automatically push the app
version (present in package/version) as a new git tag.
Since the CI needs an access token to perform the push, it may be needed to renew it in the future.
Follow these steps to renew the gitlab access token:
First, you need to create another project access token:
- Go to https://gitlab.com/witekio/rnd/b0000-theembeddedkit-klas/klas/-/settings/access_tokens
- Or manually, on the left side panel
Settings > Access Token
- Or manually, on the left side panel
- Click on the button
Add new token - Enter a valid name
- Select an expiration date
- Select the role
Maintainer - Enable
write_repostioryaccess - Create the token by clicking
Create project access token - Save the token locally as you will need it in the next step
Then, you need to add this token as a CI variable:
- Go to
https://gitlab.com/witekio/rnd/b0000-theembeddedkit-klas/klas/-/settings/ci_cd#js-cicd-variables-settings- Or manually, on the left side panel
Settings > CI/CD > Variables
- Or manually, on the left side panel
- Click on the button
Add variable - Select visibility
Masked and hidden - Set the key name as
GITLAB_ACCESS_TOKEN - Paste your token value as the
value
Generate a release package manually
There are two ways to generate a release package:
- From the CI, when a new release branch is created.
- Manually, by executing the script
generate-packages.sh
generate-packages.sh --help
Usage: generate-packages.sh [options] [[platform,toolchain]...]
Compile the Kamea Linux Agent Service on release mode with the given platform and generate the installation packages.
If CI mode is enabled (with -ci), it will also push the generated archive to the package registry.
Options:
-h, --help Show this help message and exit
-v, --verbose Enable verbose mode (default: false)
-ci, --mode-ci Script executed in a CI environment (default: false)
-o, --output-dir Specify output directory (default: klas-release/)
-p, --project-dir Specify KLAS project directory (default: .)
-b, --binary-name Specify the KLAS binary name (default: KameaLinuxAgent)
-c, --cleanup Remove build directories (default: false)
Positional Arguments:
[[platform,toolchain]...] Required. Each entry provide a platform and its toolchain, separated by a comma.
Examples:
./dev-tools/generate-packages.sh "raspbian,/opt/raspbian/bullseye/klas-rpi4-sdk/environment-setup-aarch64-rpi4-linux-gnu"
Download release artefacts
There are two ways to download a previous release from Gitlab:
Directly from the browser
- Go to https://gitlab.com/witekio/rnd/b0000-theembeddedkit-klas/klas/-/packages
- or manually, on the left side panel:
Project > Deploy > Package Registry
- or manually, on the left side panel:
- Click on the wanted version and it will automatically start the download.
From command line
You can also retrieve a release with an opened terminal.
First, be sure to have a personal access token, or you will need to generate another one.
To generate your private token: 1. Go to https://gitlab.com/-/user_settings/personal_access_tokens 2. Click on
Add new token3. Write a name 4. Click on the checkbox "api" 5. Click on the buttoncreate⚠️ Warning: You need to save this token somewhere as you won't be able to see it anymore!
Then you need to set up some variables:
export ACCESS_TOKEN=<your-access-token>
export VERSION=<your-wanted-version>
Finally, you can start the download using the curl utility:
curl -sS --header "PRIVATE-TOKEN: ${ACCESS_TOKEN}" \
--output "KameaLinuxAgent-${VERSION}.tar.gz" \
"https://gitlab.com/api/v4/projects/65011523/packages/generic/klas/${VERSION}/KameaLinuxAgent-${VERSION}.tar.gz"