.gitlab-ci.yml 3.97 KB
Newer Older
Patrick J Cherry's avatar
Patrick J Cherry committed
1
2
stages:
  - package
Patrick J Cherry's avatar
Patrick J Cherry committed
3
  - publish
telyn's avatar
telyn committed
4
  - install
5

6
7
8
# This will run through the packages one at a time, building them into artifacts
# This uses the kelduum/sympl-build:v1 docker image, which is Debian Stretch with
#   the packages pre-installed to save build time.
Patrick J Cherry's avatar
Patrick J Cherry committed
9
10

.package: &package
11
12
  tags:
    - docker
13
  image: kelduum/sympl-build:v1
Patrick J Cherry's avatar
Patrick J Cherry committed
14
15
  stage: package
  script:
Paul Cammish's avatar
Paul Cammish committed
16
    - apt-get update && apt-get install -q -yy rake devscripts rdoc graphviz ruby-dev gem2deb txt2man dh-systemd apache2-dev libcap-dev php7.0-common dh-golang golang-go
Patrick J Cherry's avatar
Patrick J Cherry committed
17
18
19
    - export PACKAGE=${CI_BUILD_NAME##package:}
    - echo "$CI_BUILD_NAME" -  "$PACKAGE" - "${CI_BUILD_NAME##package:}"
    - cd $PACKAGE
Paul Cammish's avatar
Paul Cammish committed
20
21
    - dpkg-buildpackage --no-sign --build=full
    - cd ..
Paul Cammish's avatar
Paul Cammish committed
22
23
    - mkdir deb
    - mv $(git ls-files --others -x '*/') deb
24
25
  artifacts:
    paths:
Paul Cammish's avatar
Paul Cammish committed
26
      - deb/
27
28
29
30
    expire_in: 4 days

# List of packages to build

Paul Cammish's avatar
Paul Cammish committed
31
32
package:core:
  <<: *package
Patrick J Cherry's avatar
Patrick J Cherry committed
33
34
35
36
37
38
package:backup:
  <<: *package
package:cron:
  <<: *package
package:dns:
  <<: *package
39
package:mail:
Patrick J Cherry's avatar
Patrick J Cherry committed
40
41
42
  <<: *package
package:firewall:
  <<: *package
43
package:ftp:
Patrick J Cherry's avatar
Patrick J Cherry committed
44
  <<: *package
45
package:web:
Patrick J Cherry's avatar
Patrick J Cherry committed
46
47
48
49
50
51
52
53
54
55
56
  <<: *package
package:monit:
  <<: *package
package:mysql:
  <<: *package
package:phpmyadmin:
  <<: *package
package:updater:
  <<: *package
package:webmail:
  <<: *package
Paul Cammish's avatar
Paul Cammish committed
57
  
58
59
60
61
# This builds the debian packages and drops them in a very simple local repo
#   so they can be installed during the next (install) step.
# Again, it uses the kelduum/sympl-build docker image with the relevant tools pre-installed

Patrick J Cherry's avatar
Patrick J Cherry committed
62
publish:
63
64
  tags:
    - docker
65
  image: kelduum/sympl-build:v1
Patrick J Cherry's avatar
Patrick J Cherry committed
66
67
  stage: publish
  script:
Paul Cammish's avatar
Paul Cammish committed
68
    - apt-get update && apt-get install -q -yy dpkg-dev
Paul Cammish's avatar
Paul Cammish committed
69
70
    - dpkg-scanpackages deb > deb/Packages
    - gzip -k deb/Packages
Paul Cammish's avatar
Paul Cammish committed
71
    - echo '## Building repo...'
Paul Cammish's avatar
Paul Cammish committed
72
    - mkdir -p repo/pool/main/s repo/pool/main/l repo/dists/stretch/main/binary-amd64
Paul Cammish's avatar
Paul Cammish committed
73
74
    - cp deb/s*.deb repo/pool/main/s
    - cp deb/l*.deb repo/pool/main/l
75
76
77
    - cd repo
    - dpkg-scanpackages -m pool | gzip > dists/stretch/main/binary-amd64/Packages.gz
    - dpkg-scanpackages -m pool > dists/stretch/main/binary-amd64/Packages
Paul Cammish's avatar
Paul Cammish committed
78
79
  artifacts:
    paths:
Paul Cammish's avatar
Paul Cammish committed
80
      - deb/*
Paul Cammish's avatar
Paul Cammish committed
81
      - repo/*
82
83
84
85
86
    expire_in: 1 month


# This stage runs on a VM running VirtualBox 5, which the gitlab-runner controls.
# The vbox:stretch image is a pre-installed minimal copy of Debian Stretch.
Paul Cammish's avatar
Paul Cammish committed
87
#
Paul Cammish's avatar
Paul Cammish committed
88
89
# Clean is a minimal install, where quick has all of the pre-reqs installed,
# other than unattended-upgrades as it tries to run at reboot.
90

Paul Cammish's avatar
Paul Cammish committed
91
install:quick:
92
  tags:
Paul Cammish's avatar
Paul Cammish committed
93
    - vbox:debian9-quick
94
  stage: install
Paul Cammish's avatar
Paul Cammish committed
95
  allow_failure: false
96
  script:
Paul Cammish's avatar
Paul Cammish committed
97
98
    - hostname quick.sympl.test
    - echo "$( hostname )" > /etc/hostname ; echo "$( hostname -I | head -n 1 ) $(hostname)" >> /etc/hosts
99
100
    - cp -r repo/ /
    - chmod -R 664 /repo ; chmod -R +X /repo
Paul Cammish's avatar
Paul Cammish committed
101
    - echo "deb file:/repo stretch main" > /etc/apt/sources.list.d/local.list
Paul Cammish's avatar
Paul Cammish committed
102
    - apt-get -qq update
103
    - echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
Paul Cammish's avatar
Paul Cammish committed
104
    - apt-get -y --allow-unauthenticated install --install-recommends sympl-core
Paul Cammish's avatar
Paul Cammish committed
105
    - run-parts --verbose --exit-on-error autotest/test.d
Paul Cammish's avatar
Paul Cammish committed
106
    - dpkg -l 'sympl*'
Paul Cammish's avatar
Paul Cammish committed
107
    - chmod -x $( which gitlab-runner )
Paul Cammish's avatar
Paul Cammish committed
108
  variables: &installvars
109
    CI_DEBUG_TRACE: "false"
110
111
  artifacts:
    paths:
Paul Cammish's avatar
Paul Cammish committed
112
      - repo/*
113
    expire_in: 4 days
114

115
install:clean:
Paul Cammish's avatar
Paul Cammish committed
116
117
118
  tags:
    - vbox:stretch
  stage: install
119
  allow_failure: false
Paul Cammish's avatar
Paul Cammish committed
120
  script:
Paul Cammish's avatar
Paul Cammish committed
121
122
    - hostname clean.sympl.test
    - echo "$( hostname )" > /etc/hostname ; echo "$( hostname -I | head -n 1 ) $(hostname)" >> /etc/hosts
Paul Cammish's avatar
Paul Cammish committed
123
124
    - cp -r repo/ /
    - chmod -R 664 /repo ; chmod -R +X /repo
Paul Cammish's avatar
Paul Cammish committed
125
    - echo "deb file:/repo stretch main" > /etc/apt/sources.list.d/local.list
Paul Cammish's avatar
Paul Cammish committed
126
127
    - apt-get -qq update
    - echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
Paul Cammish's avatar
Paul Cammish committed
128
    - apt-get -y --allow-unauthenticated install --install-recommends sympl-core
Paul Cammish's avatar
Paul Cammish committed
129
    - run-parts --verbose --exit-on-error autotest/test.d
Paul Cammish's avatar
Paul Cammish committed
130
    - dpkg -l 'sympl*'
Paul Cammish's avatar
Paul Cammish committed
131
    - chmod -x $( which gitlab-runner )
telyn's avatar
telyn committed
132
  variables:
Paul Cammish's avatar
Paul Cammish committed
133
134
135
136
137
138
    CI_DEBUG_TRACE: "false"
  artifacts:
    paths:
      - repo/*
    expire_in: 4 days

Patrick J Cherry's avatar
Patrick J Cherry committed
139