#Gitlab CI

#Repo Setup

You'll need to update in your .gitlab-ci.yml.

Here is an example for updating Npm dependencies:

stages:
  - update
  - test
  # must be the last stage !
  - notify

update:
  stage: update
  image: pmbot/bot
  # run the update job only when variable environment $PMBOT is "true"
  only:
    variables:
      - $PMBOT == "true"
  script:
    # install your dependencies
    - npm ci
    # run the update
    - pmbot update --disable-host-key-verification

# your existing build/test jobs
test:
  stage: test
  image: node:12-alpine
  # skip this job when running the update job
  except:
    variables:
      - $PMBOT == "true"
  script:
    - npm ci
    - npm test

# notify pmbot of pipeline success
on-success:
  stage: notify
  image: pmbot/bot
  when: on_success
  script:
    - pmbot notify --success

# notify pmbot of pipeline success
on-failure:
  stage: notify
  image: pmbot/bot
  when: on_failure
  script:
    - pmbot notify

on-success and on-failure are separate jobs because Gitlab CI does not provide a pipeline status variable in the predefined environment variables.

#Self signed certificates

See here.

We recommend setting a CI/CD variable of type file at the group level or the instance level with the path to your CA certificate.

#Untracked files errors or removed commits appearing again

If you forced push to the update source branch, for example master, you may experience issues where Git throws an error as the bot tries to checkout the update branch. You can work around this problem as follows:

  1. Go to your Gitlab project CI/CD settings
  2. In the General section, under Git strategy for pipelines, select Git clone and then save the form.

This will ensure that the workspace is clean for each run.

gitlab clone