GitLab CI/CD

Since I just used GitHub Action, I was curious about GitLab and how that compares. And it turns out it’s simple too, similar UI.

Here the .gitlab-ci.yml:

  - unittest
  - build

  stage: unittest
    name: node:14
    - npm install
    - npm test

  stage: build
    entrypoint: [""]
    - mkdir -p /kaniko/.docker
    - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
    - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG

#  rules:
#    - if: $CI_COMMIT_TAG

The last 2 lines could restrict container building to only those commits which have a tag defined:

git commit -am "test git tags"
git tag test-tag
git push --tags origin master

Functionally I found no difference to GitHub except for the container registry which is well integrated into GitLab. The CI/CD pipeline itself is functionally identical (at this level of a simple 2 stage pipeline)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create your website with
Get started
%d bloggers like this: