.gitlab-ci.yml 8.69 KB
Newer Older
1
stages:
Julien Leduc's avatar
Julien Leduc committed
2
3
  - build:srpm
  - build:rpm
4
  - build:dockerimage
5
  - rename:dockerimage
6
  - test
7
  - regressions
8
  - shouldfail
9
  - publish_rpm
10

11
before_script:
12
  - export CTA_BUILD_ID=${CI_PIPELINE_ID}git${CI_COMMIT_SHA:0:8}
13
  - echo "Exporting CTA_BUILD_ID=${CTA_BUILD_ID}"
14
15
  - test -n "${CI_COMMIT_TAG}" && export TAG_VERSION=$(echo ${CI_COMMIT_TAG} | sed -e 's/^v//;s/-.*$//')
  - test -n "${CI_COMMIT_TAG}" && export TAG_RELEASE=$(echo ${CI_COMMIT_TAG} | sed -e 's/^[^-]*-//')
16
17
  - echo "Removing protectbase from all repos (same as Puppet)"
  - sed -i '/^protect=/d' /etc/yum.repos.d/* 
18

19
20
cta_srpm:
  stage: build:srpm
21
  retry: 1
Julien Leduc's avatar
Julien Leduc committed
22
23
24
  image: gitlab-registry.cern.ch/linuxsupport/cc7-base
  script:
    - yum install -y gcc-c++ cmake make rpm-build
Julien Leduc's avatar
Julien Leduc committed
25
26
    - mkdir build_srpm
    - cd build_srpm
27
    - cmake -DPackageOnly:Bool=true -DVCS_VERSION=${CTA_BUILD_ID} ..
Julien Leduc's avatar
Julien Leduc committed
28
    - make cta_srpm
29

Julien Leduc's avatar
Julien Leduc committed
30
  artifacts:
31
    expire_in: 30 days
Julien Leduc's avatar
Julien Leduc committed
32
    paths:
Julien Leduc's avatar
Julien Leduc committed
33
34
    - build_srpm/RPM/SRPMS/

35
  tags:
Julien Leduc's avatar
Julien Leduc committed
36
37
    - docker

38
cta_rpm:
39
40
  except:
    - tags
41
  stage: build:rpm
42
  retry: 1
Julien Leduc's avatar
Julien Leduc committed
43
44
  image: gitlab-registry.cern.ch/linuxsupport/cc7-base
  script:
45
    - cp -f continuousintegration/docker/ctafrontend/cc7/etc/yum.repos.d/*.repo /etc/yum.repos.d/
Julien Leduc's avatar
Julien Leduc committed
46
    - yum install -y gcc-c++ cmake make rpm-build
47
    - yum -y install yum-plugin-priorities yum-plugin-versionlock
Michael Davis's avatar
Michael Davis committed
48
49
    - yum install -y git
    - git submodule update --init --recursive
50
    - cp -f continuousintegration/docker/ctafrontend/cc7/etc/yum/pluginconf.d/versionlock.list /etc/yum/pluginconf.d/
Julien Leduc's avatar
Julien Leduc committed
51
52
53
    - yum-builddep --nogpgcheck -y build_srpm/RPM/SRPMS/*
    - mkdir build_rpm
    - cd build_rpm
54
    - cmake -DVCS_VERSION=${CTA_BUILD_ID} ..
Julien Leduc's avatar
Julien Leduc committed
55
56
57
    - make cta_rpm

  artifacts:
58
    expire_in: 30 days
Julien Leduc's avatar
Julien Leduc committed
59
60
    paths:
    - build_rpm/RPM/RPMS
61
62
63

  tags:
    - docker
Julien Leduc's avatar
Julien Leduc committed
64

65
cta_tagged_rpm:
66
67
  only:
    - tags
68
  stage: build:rpm
69
  retry: 1
70
71
72
  image: gitlab-registry.cern.ch/linuxsupport/cc7-base
  script:
    - if [ -z "${CI_COMMIT_TAG}" ]; then echo "This is not a tagged commit, exiting"; exit 0; fi
Julien Leduc's avatar
Julien Leduc committed
73
    - echo "Building package for tag ${CI_COMMIT_TAG}. CTA_VERSION=${TAG_VERSION} - CTA_RELEASE=${TAG_RELEASE}"
74
75
    - cp -f continuousintegration/docker/ctafrontend/cc7/etc/yum.repos.d/*.repo /etc/yum.repos.d/
    - yum install -y gcc-c++ cmake make rpm-build
76
    - yum -y install yum-plugin-priorities yum-plugin-versionlock
Michael Davis's avatar
Michael Davis committed
77
78
    - yum install -y git
    - git submodule update --init --recursive
79
    - cp -f continuousintegration/docker/ctafrontend/cc7/etc/yum/pluginconf.d/versionlock.list /etc/yum/pluginconf.d/
80
81
82
83
84
85
86
87
88
89
90
91
92
93
    - yum-builddep --nogpgcheck -y build_srpm/RPM/SRPMS/*
    - mkdir build_tagged_rpm
    - cd build_tagged_rpm
    - CTA_VERSION=${TAG_VERSION} cmake -DVCS_VERSION=${TAG_RELEASE} ..
    - make cta_rpm

  artifacts:
    expire_in: 30 days
    paths:
    - build_tagged_rpm/RPM/RPMS

  tags:
    - docker

Julien Leduc's avatar
Julien Leduc committed
94
publish_tagged_rpm:
95
  stage: publish_rpm
96
97
  only:
    - tags
98
99
100
  image: gitlab-registry.cern.ch/linuxsupport/cc7-base
  script:
    - if [ -z "${CI_COMMIT_TAG}" ]; then echo "This is not a tagged commit, exiting"; exit 0; fi
Julien Leduc's avatar
Julien Leduc committed
101
    - EOS_ACCOUNT_USERNAME=${DOCKER_LOGIN_USERNAME} EOS_ACCOUNT_PASSWORD=${DOCKER_LOGIN_PASSWORD} CI_OUTPUT_DIR=build_tagged_rpm/RPM/RPMS EOS_PATH=/eos/user/c/ctareg/www/cta-repo HOOK=/eos/user/c/ctareg/www/cta-repo/update_repos.sh continuousintegration/ci_helpers/deploy-eos.sh
102
103
104
  tags:
    - docker

105
cta_valgrind:
106
107
  except:
    - tags
108
  stage: test
109
  retry: 1
110
111
  variables:
    CTAREPODIR: /tmp/repo
112
113
114
  image: gitlab-registry.cern.ch/linuxsupport/cc7-base
  script:
    - cp -f continuousintegration/docker/ctafrontend/cc7/etc/yum.repos.d/* /etc/yum.repos.d/
115
    - yum -y install yum-plugin-priorities createrepo
116
    - cp -f continuousintegration/docker/ctafrontend/cc7/etc/yum/pluginconf.d/versionlock.list /etc/yum/pluginconf.d/
117
118
119
    - mkdir -p ${CTAREPODIR}; cp -r build_rpm/RPM ${CTAREPODIR}
    - createrepo ${CTAREPODIR}; echo -e "[cta-artifacts]\nname=CTA artifacts\nbaseurl=file://${CTAREPODIR}\ngpgcheck=0\nenabled=1\npriority=2" > /etc/yum.repos.d/cta-artifacts.repo
    - yum -y --nogpgcheck install cta-systemtests cta-debuginfo sqlite-debuginfo --enablerepo=debug
120
121
122
123
124
    - /usr/bin/cta-unitPlusSystemTests.sh

  tags:
    - docker

125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
cta_rdbms_unit_tests_postgresql:
  except:
    - tags
  stage: test
  variables:
    CTAREPODIR: /tmp/repo
  image: gitlab-registry.cern.ch/linuxsupport/cc7-base
  script:
    - cp -f continuousintegration/docker/ctafrontend/cc7/etc/yum.repos.d/* /etc/yum.repos.d/
    - yum -y install yum-plugin-priorities createrepo
    - cp -f continuousintegration/docker/ctafrontend/cc7/etc/yum/pluginconf.d/versionlock.list /etc/yum/pluginconf.d/
    - mkdir -p ${CTAREPODIR}; cp -r build_rpm/RPM ${CTAREPODIR}
    - createrepo ${CTAREPODIR}; echo -e "[cta-artifacts]\nname=CTA artifacts\nbaseurl=file://${CTAREPODIR}\ngpgcheck=0\nenabled=1\npriority=2" > /etc/yum.repos.d/cta-artifacts.repo
    - yum -y --nogpgcheck install cta-systemtests cta-debuginfo sqlite-debuginfo --enablerepo=debug
    - yum -y install cta-catalogueutils
    - yum -y install rh-postgresql96-postgresql-server
    - POSTGRESQL_DATA_DIR=/usr/local/cta_test_pgsql_data
    - POSTGRESQL_LOG_DIR=/var/log/postgres
    - echo POSTGRESQL_DATA_DIR=${POSTGRESQL_DATA_DIR}
    - echo POSTGRESQL_LOG_DIR=${POSTGRESQL_LOG_DIR}
    - mkdir -p ${POSTGRESQL_DATA_DIR}
    - chown -R postgres:postgres ${POSTGRESQL_DATA_DIR}
    - mkdir -p ${POSTGRESQL_LOG_DIR}
    - chown -R postgres:postgres ${POSTGRESQL_LOG_DIR}
    - export LD_LIBRARY_PATH=/opt/rh/rh-postgresql96/root/usr/lib64
    - POSTGRES_BIN=/opt/rh/rh-postgresql96/root/usr/bin
    - echo POSTGRES_BIN=${POSTGRES_BIN}
    - runuser -u postgres -- ${POSTGRES_BIN}/initdb -D ${POSTGRESQL_DATA_DIR}
    - runuser -u postgres -- ${POSTGRES_BIN}/pg_ctl start -w -t 10 -D ${POSTGRESQL_DATA_DIR} -l ${POSTGRESQL_LOG_DIR}/cta_test_postgres.log
    - runuser -u postgres -- ${POSTGRES_BIN}/createdb cta
    - runuser -u postgres -- ${POSTGRES_BIN}/createuser -E cta
    - CTA_CATALOGUE_CONF=/etc/cta/cta-catalogue.conf
    - echo CTA_CATALOGUE_CONF=${CTA_CATALOGUE_CONF}
    - echo 'postgresql:postgresql://cta@localhost/cta' > ${CTA_CATALOGUE_CONF}
    - /usr/bin/cta-catalogue-schema-create ${CTA_CATALOGUE_CONF}
    - /usr/bin/cta-rdbmsUnitTests ${CTA_CATALOGUE_CONF}
    - runuser -u postgres -- ${POSTGRES_BIN}/pg_ctl stop -D ${POSTGRESQL_DATA_DIR}

  tags:
    - docker

166
ctageneric_docker:
167
168
  except:
    - tags
Julien Leduc's avatar
Julien Leduc committed
169
  stage: build:dockerimage
170
  retry: 1
Julien Leduc's avatar
Julien Leduc committed
171
172
  tags:
    - docker-image-build
173
  script:
174
    - ""
Julien Leduc's avatar
Julien Leduc committed
175
  variables:
176
    TO: gitlab-registry.cern.ch/cta/ctageneric:${CI_PIPELINE_ID}
177
    DOCKER_FILE: continuousintegration/docker/ctafrontend/cc7/ci_runner/Dockerfile
178

179
ctageneric_docker_rename:
180
181
  except:
    - tags
182
183
  stage: rename:dockerimage
  variables:
184
185
    TO: gitlab-registry.cern.ch/cta/ctageneric
    REPOSITORY: cta/ctageneric
186
187
    GITLAB_HOST: gitlab.cern.ch
  script:
188
189
190
191
    - export OLDTAG=${CI_PIPELINE_ID}
    - export NEWTAG=${CTA_BUILD_ID}
    - cd continuousintegration/ci_helpers/
    - ./rename_tag.sh
192
193

archiveretrieve:
194
195
  except:
    - tags
196
  stage: test
197
  retry: 1
198
  script:
199
    - export NAMESPACE="archiveretrieve-${CTA_BUILD_ID}-$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 4 | head -n 1)"
200
    - cd continuousintegration/orchestration/; ./run_systemtest.sh -n ${NAMESPACE} -p ${CI_PIPELINE_ID} -s tests/archive_retrieve.sh -O -D -t 2400
201
  artifacts:
202
    when: always
203
    expire_in: 30 days
204
205
    paths:
    - pod_logs
206
207
208
  tags:
    - kubernetes
    - mhvtl
Cedric CAFFY's avatar
Cedric CAFFY committed
209
210
211
212
213
214
215
216
    
repack:
  except:
    - tags
  stage: test
  retry: 1
  script:
    - export NAMESPACE="repack-${CTA_BUILD_ID}-$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 4 | head -n 1)"
217
    - cd continuousintegration/orchestration/; ./run_systemtest.sh -n ${NAMESPACE} -p ${CI_PIPELINE_ID} -s tests/repack_systemtest_wrapper.sh -O -D -t 2400
Cedric CAFFY's avatar
Cedric CAFFY committed
218
219
220
221
222
223
224
225
  artifacts:
    when: always
    expire_in: 30 days
    paths:
    - pod_logs
  tags:
    - kubernetes
    - mhvtl
226

227
nightly1:
228
  stage: shouldfail
229
  only:
230
    - triggers
231
  script:
232
    - echo "Running nightly tests"
233
    - export NAMESPACE="archiveretrieve-${CTA_BUILD_ID}-$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 4 | head -n 1)"
234
    - cd continuousintegration/orchestration/; ./run_systemtest.sh -n ${NAMESPACE} -p ${CI_PIPELINE_ID} -s tests/test_nightly1.sh -O -D
235
236
237
238
239
240
241
242
  artifacts:
    when: always
    expire_in: 30 days
    paths:
    - pod_logs
  tags:
    - kubernetes
    - mhvtl
243
    - xlarge
244
245

regressioneos:
246
  stage: regressions
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
  only:
    - triggers
    - schedules
  script:
    - echo "Running nightly eos regression tests"
    - export NAMESPACE="archiveretrieve-${CTA_BUILD_ID}-$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 4 | head -n 1)"
    - cd continuousintegration/orchestration/; ./run_systemtest.sh -n ${NAMESPACE} -p ${CI_PIPELINE_ID} -s tests/upgrade-eos.sh -O -D -S
  artifacts:
    when: always
    expire_in: 30 days
    paths:
    - pod_logs
  tags:
    - kubernetes
    - mhvtl
    - xlarge