<commit_before># release_tool.py

This tool is for internal consumption only, and should not be used outside of
Mender development.

The `release_tool.py` script has three main modes of operation:

* Querying the version of a component in the docker-compose environment.

* Setting the version of a component in the docker-compose environment.

* Tagging, building, and releasing.


## Querying docker-compose versions

To query for a version, use the `--version-of` option, and then specify the name
of a component to check. The name can be given as either Git repository name,
Docker image name, or Docker container name.

For example:

```
$ ./release_tool.py --version-of mender-client
1.0.1
$
```


## Setting docker-compose versions

Setting a docker-compose component version means that either
`docker-compose.yml` or one of its companion files will be changed. This can be
used to change and thereby launch, a different version of a Docker component
than is programmed in the file when checked out from the repository.

To do this, use the `--set-version-of` and `--version` options together. For
example:

```
$ ./release_tool.py --set-version-of mender-client --version 1.2.0
$ git diff
diff --git a/docker-compose.client.yml b/docker-compose.client.yml
index 717848a..a80d963 100644
--- a/docker-compose.client.yml
+++ b/docker-compose.client.yml
@@ -5,6 +5,6 @@ services:
     # mender-client
     #
     mender-client:
-        image: mendersoftware/mender-client-qemu:master
+        image: mendersoftware/mender-client-qemu:1.2.0
         networks:
             - mender
$
```


## Building

The `--build` argument can be used to build a version of Mender, including
correct versions of all the micro services, without having to specify all of
them. Before the build starts, you'll also be given the chance to alter build
parameters.


## Releasing

Releasing is an interactive part of the tool. Below is a tutorial to get into
the workflow, and afterwards a more comprehensive reference to understand some
of the advanced options.

### Tutorial: Release workflow

In this tutorial we go through the typical work flow when doing a release.

#### Preparing for a release

1. The first thing you need to do is to verify that the script has knowledge of
   all the repositories it needs to for a given release. Check the `REPOS`
   variable inside the script, and add or remove repositories as needed. Make
   sure you read the comments above it, since some changes may require
   additional sections to be changed.

2. Before you can use the release mode of the tool, one prerequisite is
   required: All repositories mentioned in the `REPOS` variable inside the
   script source must be available inside a single directory (having them as
   symlinks pointing somewhere else is ok). The script will ask about the<commit_msg>Fix minor typo on the release tool documentation<commit_after># release_tool.py

This tool is for internal consumption only, and should not be used outside of
Mender development.

The `release_tool.py` script has three main modes of operation:

* Querying the version of a component in the docker-compose environment.

* Setting the version of a component in the docker-compose environment.

* Tagging, building, and releasing.


## Querying docker-compose versions

To query for a version, use the `--version-of` option, and then specify the name
of a component to check. The name can be given as either Git repository name,
Docker image name, or Docker container name.

For example:

```
$ ./release_tool.py --version-of mender-client
1.0.1
$
```


## Setting docker-compose versions

Setting a docker-compose component version means that either
`docker-compose.yml` or one of its companion files will be changed. This can be
used to change and thereby launch, a different version of a Docker component
than is programmed in the file when checked out from the repository.

To do this, use the `--set-version-of` and `--version` options together. For
example:

```
$ ./release_tool.py --set-version-of mender-client --version 1.2.0
$ git diff
diff --git a/docker-compose.client.yml b/docker-compose.client.yml
index 717848a..a80d963 100644
--- a/docker-compose.client.yml
+++ b/docker-compose.client.yml
@@ -5,6 +5,6 @@ services:
     # mender-client
     #
     mender-client:
-        image: mendersoftware/mender-client-qemu:master
+        image: mendersoftware/mender-client-qemu:1.2.0
         networks:
             - mender
$
```


## Building

The `--build` argument can be used to build a version of Mender, including
correct versions of all the micro services, without having to specify all of
them. Before the build starts, you'll also be given the chance to alter build
parameters.


## Releasing

Releasing is an interactive part of the tool. Below is a tutorial to get into
the workflow, and afterwards a more comprehensive reference to understand some
of the advanced options.

### Tutorial: Release workflow

In this tutorial we go through the typical work flow when doing a release.

#### Preparing for a release

1. The first thing you need to do is to verify that the script has knowledge of
   all the repositories it needs to for a given release. Check `COMPONENT_MAPS`
   variable inside the script, and add or remove repositories as needed. Make
   sure you read the comments above it, since some changes may require
   additional sections to be changed.

2. Before you can use the release mode of the tool, one prerequisite is
   required: All repositories mentioned in `COMPONENT_MAPS` variable inside the
   script source must be available inside a single directory (having them as
   symlinks pointing somewhere else is ok). The script will ask about the
{'fraction_non_alphanumeric': 0.06851948959972033, 'fraction_numerical': 0.011186855444852298, 'mean_word_length': 3.6978653530377668, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7363369', 'n_tokens_mistral': 1637, 'n_tokens_neox': 1526, 'n_words': 774}