summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: d9b79c8e2e57026888ddb68f0c720ee6ad408fd0 (plain)
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
---
image: 0xacab.org:4567/leap/docker/ruby:latest

cache:
  untracked: true
  paths:
    # Cache gems
    - tests/platform-ci/vendor/

before_script:
  - cd tests/platform-ci
  - su -c 'time ./setup.sh' cirunner

stages:
  - syntax
  - deploy

lint:
  stage: syntax
  script:
    - su -c '/usr/local/bin/bundle exec rake lint' cirunner

syntax:
  stage: syntax
  script:
    - su -c '/usr/local/bin/bundle exec rake syntax' cirunner

validate:
  stage: syntax
  script:
    - su -c '/usr/local/bin/bundle exec rake validate' cirunner

templates:
  stage: syntax
  script:
    - su -c '/usr/local/bin/bundle exec rake templates' cirunner

catalog:
  stage: syntax
  script:
    - su -c '/usr/local/bin/bundle exec rake catalog' cirunner

deploy_test:jessie:master:
  stage: deploy
  except:
    - master
    - stretch
  script:
    - su -c 'set -o pipefail; stdbuf -oL -eL ./ci-build.sh | ts' cirunner

deploy_test:jessie:staging:
  stage: deploy
  except:
    - stretch
  variables:
    COMPONENT: "staging"
  script:
    - su -c 'set -o pipefail; stdbuf -oL -eL ./ci-build.sh | ts' cirunner

deploy_test:stretch:master:
  image: 0xacab.org:4567/leap/docker/ruby:stretch_amd64
  stage: deploy
  only:
    - stretch
  allow_failure: true
  script:
    - su -c 'set -o pipefail; stdbuf -oL -eL ./ci-build.sh | ts' cirunner

deploy_test:stretch:staging:
  image: 0xacab.org:4567/leap/docker/ruby:stretch_amd64
  stage: deploy
  only:
    - stretch
  allow_failure: true
  variables:
    COMPONENT: "staging"
  script:
    - su -c 'set -o pipefail; stdbuf -oL -eL ./ci-build.sh | ts' cirunner

# However, sometimes it's important to have a way of triggering a deploy
# from scratch manually even from the master branch, when i.e. new packages
# got uploaded to the master component of the platform deb repo.
deploy_test:manual:
  stage: deploy
  only:
    - master
  when: manual
  allow_failure: false
  script:
    - su -c 'set -o pipefail; stdbuf -oL -eL ./ci-build.sh | ts' cirunner

# Test upgrades from the latetest release to latest HEAD
upgrade_test:
  stage: deploy
  script:
    # Allow unpriviledged user to checkout last release of leap_platform
    - chown cirunner:cirunner -R ../..
    - su -c 'set -o pipefail; stdbuf -oL -eL ./ci-build.sh | ts' cirunner

# Latest job will only run on the master branch, which means all merge requests
# that are created from branches don't get to deploy to the latest-ci server.
# When a merge request is merged, then the latest job will deploy the code to
# the latest provider, and the deployment will be recorded in an environment
# named 'latest'
ci.leap.se:
  stage: deploy
  environment:
    name: staging
  only:
    - master@leap/platform
  script:
    - >
      su -c '/usr/bin/unbuffer /bin/bash -o pipefail ./ci-build.sh |
      /usr/bin/ts' cirunner

demo.bitmask.net:
  stage: deploy
  environment:
    name: production/demo/vpn
  only:
    - master
  when: manual
  script:
    - >
      su -c '/usr/bin/unbuffer /bin/bash -o pipefail ./ci-build.sh |
      /usr/bin/ts' cirunner

mail.bitmask.net:
  stage: deploy
  environment:
    name: production/demo/mail
  only:
    - master
  when: manual
  script:
    - >
      su -c '/usr/bin/unbuffer /bin/bash -o pipefail ./ci-build.sh |
      /usr/bin/ts' cirunner