Commit 1c5fd4c0 authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

doc: new release design

parent 193e579c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -267,7 +267,7 @@

    ---

    Automate your versionning and release management with [semantic-release](https://github.com/semantic-release/semantic-release)
    Automate your versioning and release management with [semantic-release](https://github.com/semantic-release/semantic-release)

    Version: `3.2`
+55 −20
Original line number Diff line number Diff line
@@ -68,26 +68,6 @@ environment.

Acceptance templates provide acceptance test tools (functional testing, performance testing, [DAST](https://en.wikipedia.org/wiki/Dynamic_application_security_testing)).

## Deployment environments

All our Deploy & Run templates support 4 kinds of environments (each being optional):

| Environment Type | Description                                       | Associated branch(es)                  |
| ---------------- | ------------------------------------------------- | -------------------------------------- |
| **Review**       | Those are dynamic and ephemeral environments to deploy your ongoing developments.<br/> It is a strict equivalent of GitLab's [Review Apps](https://docs.gitlab.com/ee/ci/review_apps/) feature. | All **development branches** (non-integration, non-production) |
| **Integration**  | A single environment to continuously deploy your integration branch. | The **integration branch** (`develop` by default) |
| **Staging**      | A single environment to continuously deploy your production branch.<br/> It is an iso-prod environment, meant for running the automated acceptance tests prior to deploying to the production env. | The **production branch** (`main` or `master`  by default) |
| **Production**   | _Well.. the prod!_ | The **production branch** (`main` or `master`  by default) |

A few remarks:

* All our Acceptance templates support those environments and cooperate gracefully with whichever deployment technology you're using to test the right
  server depending on the branch it's running on.
* Transition from **Staging** to **Production** can be either automatic (if you feel confident enough with your automated acceptance tests) or _one-click_ (this is the default). This is configurable.
* If you're working in an organization where development and deployment are managed by separate teams, you may perfectly not declare any **Production** 
  environment in the development project, but instead trigger a pipeline in the project owned by the deployment team.
* [More info about deployment environments on Wikipedia](https://en.wikipedia.org/wiki/Deployment_environment).

## Generic pipeline stages

Our GitLab templates keep using a coherent set of generic GitLab CI [stages](https://docs.gitlab.com/ee/ci/yaml/#stages),
@@ -137,6 +117,61 @@ Your `.gitlab-ci.yml` file will have to declare **all stages required by include
    least one active job is mapped to it. Therefore - for e.g. - if you're not using any packaging template, the 
    `package-xxx` stages will never show up in your pipelines.

## Publish & Release

Many templates offer the possibility to package the code and **publish** it to an appropriate registry (ex: PyPI for Python, Maven repository for Java, npm for Node.js, Container registry for container images...).

In addition, _to be continuous_ also support triggering a **release**.
A release is the action - from the current development branch - to freeze a stable version of the code, determine
the next version, publish the versioned code packages possibly with additional release specific artifacts (changelog).

As stated above, a **release** should trigger one or several **publish** actions. 
But a **publish** is not necessarily related to a **release**. Depending on the related technology, you may also want to publish _unstable_ package versions (ex: _snapshot_ in Maven terminology).

### Release

Functionally, a **release** involves the following steps:

1. `[mandatory]` determine the next release **version** (either manually or automatically),
2. `[optional]` **bump version**
    1. update files with the new version (ex: `pom.xml`, `setup.py`, `.bumpversion.cfg`...)
    2. update other files related with the release (ex: `README.md`, `CHANGELOG.md` ...)
    3. commit the changes
3. `[mandatory]` create a **Git tag** named after the version,
4. `[optional]` create a [GitLab release](https://docs.gitlab.com/ee/user/project/releases/),
5. `[mandatory]` **package** the code (language-dependent format) & **publish** the versioned package to an appropriate repository.

Some _to be continuous_ templates provide their own release job when supported by the build tool (ex: Maven with the [Maven Release Plugin](https://maven.apache.org/maven-release/maven-release-plugin/), Python with [Bumpversion](https://pypi.org/project/bumpversion/) or with the [Poetry Version](https://python-poetry.org/docs/cli/#version) command), but the release action can also be implemented by a separate tool/template such as [semantic-release](https://semantic-release.gitbook.io/semantic-release/) that can gracefully automates the release process (automatically determines the next version number based on Git commit messages, enforces [semantic versioning](https://semver.org/), generates the release notes, creates the tag and the GitLab release).

### Publish

As explained before, publishing a code package is not necessarily related to a release process (as some technologies - such as Maven - allow publishing _unstable_ package versions) but a release should always end by publishing the versioned packages.

As a result, all publish-capable templates are fully compatible with `semantic-release` or any alternative implementing the release process.

That means that - for instance - you may perfectly choose to use `semantic-release` to perform the release of a multi-modude project containing Maven and Docker code:
the publish of released versions will be implemented by each template in the pipeline triggered by the Git tag created during the release process.

## Deployment environments

All our Deploy & Run templates support 4 kinds of environments (each being optional):

| Environment Type | Description                                       | Associated branch(es)                  |
| ---------------- | ------------------------------------------------- | -------------------------------------- |
| **Review**       | Those are dynamic and ephemeral environments to deploy your ongoing developments.<br/> It is a strict equivalent of GitLab's [Review Apps](https://docs.gitlab.com/ee/ci/review_apps/) feature. | All **development branches** (non-integration, non-production) |
| **Integration**  | A single environment to continuously deploy your integration branch. | The **integration branch** (`develop` by default) |
| **Staging**      | A single environment to continuously deploy your production branch.<br/> It is an iso-prod environment, meant for running the automated acceptance tests prior to deploying to the production env. | The **production branch** (`main` or `master`  by default) |
| **Production**   | _Well.. the prod!_ | The **production branch** (`main` or `master`  by default) |

A few remarks:

* All our Acceptance templates support those environments and cooperate gracefully with whichever deployment technology you're using to test the right
  server depending on the branch it's running on.
* Transition from **Staging** to **Production** can be either automatic (if you feel confident enough with your automated acceptance tests) or _one-click_ (this is the default). This is configurable.
* If you're working in an organization where development and deployment are managed by separate teams, you may perfectly not declare any **Production** 
  environment in the development project, but instead trigger a pipeline in the project owned by the deployment team.
* [More info about deployment environments on Wikipedia](https://en.wikipedia.org/wiki/Deployment_environment).

## Development workflow

So far, we've presented a quite _static_ vision of what a CI/CD pipeline should be, but there will be differences
+15 −1
Original line number Diff line number Diff line
@@ -245,7 +245,9 @@ Again, you may perfectly set `CUSTOM_CA_CERTS` in your project:
* either locally in specific jobs,
* or for all jobs from one single template ([see below](#the-templates-base-job)).

## Production and integration branches
## Configurable Git references

### Production and integration branches

As explained earlier, _to be continuous_ [supports various Git workflows](./understand.md#supported-git-workflows) 
with at least one **production branch** (`main` or `master` by default), 
@@ -263,6 +265,18 @@ variables:

Those variables are used internally thoughout all _to be continuous_ templates.

### Release tag pattern

Some _to be continuous_ templates also support [publish & release](./understand.md#publish--release).
Those templates trigger the publication of released packages only on Git tags matching a predefined pattern.
By default the pattern enforces [semantic versioning](https://semver.org/) but can be overridden.

```yaml
variables:
  # default release tag name (pattern)
  RELEASE_REF: '/^v?[0-9]+\.[0-9]+\.[0-9]+$/'
```

## Extended `[skip ci]` feature

GitLab skips triggering the CI/CD pipeline when `[skip ci]` or `[ci skip]` is present in the Git commit message.
+1 −1
Original line number Diff line number Diff line
@@ -5518,7 +5518,7 @@
    },
    {
      "name": "semantic-release",
      "description": "Automate your versionning and release management with [semantic-release](https://github.com/semantic-release/semantic-release)",
      "description": "Automate your versioning and release management with [semantic-release](https://github.com/semantic-release/semantic-release)",
      "template_path": "templates/gitlab-ci-semrel.yml",
      "kind": "publish",
      "variables": [