Getting Started with GitLab CI

Monteur strives to be integration friendly interfacing with GitLab CI while maintaining vendor locked-in protection. Here are the guide to integrate them.

GitLab CI Integration

Monteur is integrated with GitLab CI via its famous .gitlab-ci.yml config file. The difference is that GitLab CI is used for triggering the necessary Monteur's actions to operate your project autonomously. In summary, you should treat GitLab CI as a virtual autonomous robot working for you.

A full Debian-based operating system template is shown as follows:

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
image:
  name: debian:latest
  entrypoint: [ "" ]

variables:
  MONTEUR_CONFIG: ".monteurFS/config/main"

stages:
  - setup
  - test
  - build
  - docs

cache:
  - key: "MonteurFS"
    paths:
      - ".monteurFS/"

before_script:
  - apt-get update -y
  - apt-get upgrade -y
  - |
    apt-get --no-install-recommends install \
      curl \
      gnupg2 \
      ca-certificates \
      -y    
  - |
    curl https://www.zoralab.com/pubkey.gpg \
      | gpg --yes --dearmor --output /usr/share/keyrings/zoralab-keyring.gpg    
  - |
    echo 'deb [signed-by=/usr/share/keyrings/zoralab-keyring.gpg] https://monteur.zoralab.com/releases/deb next experimental' \
        >  /etc/apt/sources.list.d/zoralab-monteur.list    
  - apt-get update -y
  - apt-get install monteur -y


test:
  stage: test
  tags:
    - linux
  environment:
    name: production
  except:
    refs:
      - gh-pages
  interruptible: true
  coverage: '/TOTAL\s*TEST\s*COVERAGE:\s*(\d+.?\d*%?)/'
  script:
    - source "$MONTEUR_CONFIG"
    - monteur test


build:
  stage: build
  tags:
    - linux
  environment:
    name: production
  except:
    refs:
      - gh-pages
  environment:
    name: production
  script:
    - source "$MONTEUR_CONFIG"
    - monteur prepare
    - monteur build


compose:
  stage: docs
  tags:
    - linux
  environment:
    name: production
  except:
    refs:
      - gh-pages
  script:
    - source "$MONTEUR_CONFIG"
    - monteur compose


pages:
  stage: docs
  tags:
    - linux
  environment:
    name: production
  only:
    refs:
      - gh-pages
  cache: []
  artifacts:
    paths:
      - public
    expire_in: 1 day
  before_script:
    - mkdir -p public
    - shopt -s extglob
    - mv !(public|.*) public
  script:
    - printf "[ DONE ] Nothing to implement.\n"

This design allows you to operate Monteur in a way independent of operating system and without requiring Monteur to build all Docker opreating system's specific images. Since CI is specific to your project/app, please use the above only as reference.

We DO NOT recommend you to run Package and Relase CI Job on GitLab CI mainly because of the secret GPG key involvement for package integrity checking. Since there is an obligation to protect those key files, you can operate those CI Jobs on a trusted compute system privately and solely on your side.

GitLab Runner

In the past, Monteur team tried to setup Rasberry Pi 3B as the cross operating system's GitLab Runner and faced numerous unknown errors to the point that we don't recommend you repeating our mistake. If possible, please use compute system closer to your development system.

We tested both Docker and Shell Executors. Both works well especially with the latter.

Epilogue

That's all for integrating Monteur with GitLab. If you have any question, please feel free to raise your question at our Issues Section.