Follow GitLab CI best practices

This commit changes few things, implementing some of the GitLab CI known
best practices:

1. Explicitly pointing the `docker:git` image to a specific version.

    Leaving the floating one we're risking that a buggy release of new
    Docker image will be randomly introduced to our pipelines. It's also
    best to make the Docker Client (used by the job from within the
    `docker:git` image) to be at the same version as the Docker Engine
    (running in the `docker:dind` service container).

2. Replacing `ci-job-token` with `CI_REGISTRY_USER` and `CI_JOB_TOKEN`
   with `CI_REGISTRY_PASSWORD` makes the script more bulletproff. Yes,
   at this moment these variables contain the same values. But they are
   dedicated for such usage and if GitLab CI will ever decide to switch
   how Registry access should be done, the dedicated variables will
   folow the proper way.
This commit is contained in:
Tomasz Maczukin 2019-08-13 08:59:26 +02:00
parent 9ce844b7f4
commit 026e9fa6ef
No known key found for this signature in database
GPG key ID: 7E9EB2E4B0F625CD

View file

@ -3,11 +3,11 @@ include:
- template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'
default:
image: docker:git
image: docker:20.10.3-git
services:
- docker:20.10.3-dind
before_script:
- docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" "$CI_REGISTRY"
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
- source scripts/build-helpers.sh
- apk add -U bash
tags: