Best New Features in GitLab 14.2 and 14.3 ⛲
Tags: news, tooling, programming, git
Published: 2021-10-29 13:18:08

---
title: Best New Features in GitLab 14.2 and 14.3 ⛲
published: true
date: 2021-09-30 23:15:00 UTC
tags: news, tooling, programming, git
canonical_url: https://www.benjaminrancourt.ca/best-new-features-in-gitlab-14-2-and-14-3
cover_image: https://www.benjaminrancourt.ca/images/pexels-will-kirk-4199930.jpg
---
Last month, on September 22, [**GitLab 14.3**](https://about.gitlab.com/releases/2021/09/22/gitlab-14-3-released) was released. It made me realize that I forgot to check the releases notes for the previous version, [14.2](https://about.gitlab.com/releases/2021/08/22/gitlab-14-2-released/). 😅

So, in this post, I'm going to address that by highlighting some of the new features and improvements that you might be interested in. 😬

## **GitLab 14.2**

### [Use CI/CD variables in include statements in .gitlab-ci.yml](https://about.gitlab.com/releases/2021/08/22/gitlab-14-2-released/#use-cicd-variables-in-include-statements-in-gitlab-ciyml)

By allowing the use of variables inside the [include](https://docs.gitlab.com/ee/ci/yaml/index.html#include) keyword, it will open new ways to define CI/CD pipelines. An example is to allow updating of the template in multiple projects through the use of a variable as below.

```yaml
include:
  project: 'my-group/ci-pipelines'
  ref: $PIPELINE_TEMPLATE_REF
  file: 'templates/main.yml'
```
<figcaption>An example of a variable inside the include keyword.</figcaption>

A DevOps engineer could just update the `$PIPELINE_TEMPLATE_REF` variable in the group CI variables and all projects would use the new version of the template. Incredible, right? 🤩

### [Stageless pipelines](https://about.gitlab.com/releases/2021/08/22/gitlab-14-2-released/#stageless-pipelines)

One of the main features of this version is the ability to define a pipeline **without stages**. For some pipelines, this will also add clarity as the **relationships** between each job will be **explicit** , instead of being **implicit**. It should be easier now to introduce GitLab pipelines to newcomers. 🌚

![](https://www.benjaminrancourt.ca/images/stack-example-gitlab-14-2.jpg)<figcaption>For some pipelines, it doesn't make sense to define stages. In this one, all jobs are independent of each other. </figcaption>

This feature should make to way to remove completely [stages](https://docs.gitlab.com/ee/ci/yaml/#stages)in GitLab CI. Long live to [directed acyclic graphs](https://en.wikipedia.org/wiki/Directed_acyclic_graph)!😀

### [Add pronunciation to GitLab profile page](https://about.gitlab.com/releases/2021/08/22/gitlab-14-2-released/#add-pronunciation-to-gitlab-profile-page)

![](https://www.benjaminrancourt.ca/images/gitlab-pronouced-as.jpg)<figcaption>I'm still don't know how to write the pronunciation, but at least I tried. 🤓 </figcaption>

I don't know about you, but the number of people who mispronouncing my name is too high for my liking. 😅

This feature will be especially useful in helping us learn how to pronounce the names of newcomers. It's the least we can do, right? 👍

### [Display local time on user’s profile](https://about.gitlab.com/releases/2021/08/22/gitlab-14-2-released/#display-local-time-on-users-profile)

![](https://www.benjaminrancourt.ca/images/gitlab-local-time.jpg)<figcaption>I still have two hours before my bedtime and I'm currently writing this post. 😉</figcaption>

If you working with people in different time zones, it could help you not to wait for someone else to answer if it's late where they are. If it is past my bedtime at 10 PM, don't expect an answer from me, I should be sleeping. 😴

## **GitLab 14.3**

### [Include GitLab CI/CD configuration based on conditions](https://about.gitlab.com/releases/2021/09/22/gitlab-14-3-released/#include-gitlab-cicd-configuration-based-on-conditions)

By adding rules to the include keyword, we can now only  define one `.gitlab-ci.yml` and include some of its parts if certain conditions are met.

```yaml
# file: /templates/common.gitlab-ci.yml
variables:
  __TEMPLATES_COMMON_YML__ : true

# file: /templates/docker/build.gitlab-ci.yml"
include:
  - local: "/templates/common.gitlab-ci.yml"
    rules:
      - if: $ __TEMPLATES_COMMON_YML__
```
<figcaption>The build.gitlab-ci.yml file will include the other file only if the <code>$ __TEMPLATES_COMMON_YML__ </code> variable is evaluated to true.</figcaption>

I hope this will also allow us to include another template if the project contains some files.

Imagine, instead of manually updating each `.gitlab-ci.yml` file to add [hadolint](https://github.com/hadolint/hadolint) when a repository contains a Docker file, you could simply add your common pipeline and the repository pipeline would build itself! 😲

This is definitively something that I will be trying soon! ⌛

### [Use variables in other variables](https://about.gitlab.com/releases/2021/09/22/gitlab-14-3-released/#use-variables-in-other-variables)

Everyone loves inception, right? I'm sure this new functionality will also help us develop and maintain our pipelines as well. ♾️

```yaml
job:
  variables:
    FLAGS: '-al'
    LS_CMD: 'ls "$FLAGS"'
  script:
    - 'eval "$LS_CMD"' # Executes 'ls -al'
```
<figcaption>An example from the <a href="https://docs.gitlab.com/ee/ci/variables/#use-variables-in-other-variables">documentation</a>.</figcaption>
### [Support merging CI/CD rules arrays with !reference](https://about.gitlab.com/releases/2021/09/22/gitlab-14-3-released/#support-merging-cicd-rules-arrays-with-reference)

I started to use the new [!reference](https://docs.gitlab.com/ee/ci/yaml/#reference-tags) keyword after it was introduced, but I remember that I quickly ran into one of its limitations: we couldn't use it with the rules keyword. It is now a thing of the past! 🌟

```yaml
.no_schedule:
  rules:
    - if: $CI_PIPELINE_SOURCE == "schedule"
      when: never
    - when: on_success

job1:
  image: alpine:latest
  rules:
    - !reference [.no_schedule, rules]
  script:
      - echo "run except schedules and tags"
```
<figcaption>An example that reported a syntax error in previous versions of GitLab.</figcaption>

So, that's it, the latest versions of GitLab have revealed us the new improvements. I look forward to trying them. 🤗