.gitlab-ci.yml 10.1 KB
Newer Older
Mattias Ellert's avatar
Mattias Ellert committed
1 2
## Please do not change this file.
## Doing so will unfortunately create unnesseccary merge conflicts between branches and the fork, and nordugrid/arc version of this file.
Maiken's avatar
Maiken committed
3
## To have the automatic builds work on your fork, check that the runner is enabled in your fork: Settings->CI/CD->Runner settings
Maiken's avatar
Maiken committed
4

Maiken's avatar
Maiken committed
5
stages:
6
  - static_ana
Maiken's avatar
Maiken committed
7
  - build
8
  - packages
9
  - deploy_and_test
Mattias Ellert's avatar
Mattias Ellert committed
10 11


12
fork_packages_el6:
Maiken's avatar
Maiken committed
13 14
  stage: build
  image: maikenp/arc-build-centos6
Mattias Ellert's avatar
Mattias Ellert committed
15
  script:
16
    - echo "$(date +%Y%m%dT%H%M%S)_${CI_COMMIT_SHA:0:8}_master" > VERSION
17 18 19 20 21
    - yum update -y
    - ./autogen.sh
    - ./configure
    - yum-builddep nordugrid-arc.spec -y
    - echo "Preparing and running rpmbuild"
Mattias Ellert's avatar
Mattias Ellert committed
22
    - mkdir -p rpmbuild/{SOURCES,BUILD,RPMS,SRPMS}
23
    - make dist
Mattias Ellert's avatar
Mattias Ellert committed
24 25
    - VERSION=`cat VERSION`
    - mv nordugrid-arc-${VERSION}.tar.gz rpmbuild/SOURCES
26
    - rpmbuild -D "_topdir $CI_PROJECT_DIR/rpmbuild" -ba nordugrid-arc.spec
27 28
  tags:
      - build
Mattias Ellert's avatar
Mattias Ellert committed
29
  except:
30 31 32 33
    refs:
      - master
      - next-major
      - dev-ARC6
34 35
      - branches@nordugrid/arc
      - tags@nordugrid/arc
36 37 38 39 40 41 42
  artifacts:
    when: on_success
    expire_in: 3 days
    paths:
    - $CI_PROJECT_DIR/rpmbuild/SRPMS/
    - $CI_PROJECT_DIR/rpmbuild/RPMS/noarch/
    - $CI_PROJECT_DIR/rpmbuild/RPMS/x86_64/
43
  allow_failure: false
Mattias Ellert's avatar
Mattias Ellert committed
44 45


46
fork_packages_el7:
47 48
  stage: build
  image: maikenp/arc-build-centos7
Mattias Ellert's avatar
Mattias Ellert committed
49
  script:
50
    - echo "$(date +%Y%m%dT%H%M%S)_${CI_COMMIT_SHA:0:8}_master" > VERSION
51 52
    - yum update -y
    - ./autogen.sh
Mattias Ellert's avatar
Mattias Ellert committed
53
    - ./configure
54 55
    - yum-builddep nordugrid-arc.spec -y
    - echo "Preparing and running rpmbuild"
Mattias Ellert's avatar
Mattias Ellert committed
56
    - mkdir -p rpmbuild/{SOURCES,BUILD,RPMS,SRPMS}
57
    - make dist
Mattias Ellert's avatar
Mattias Ellert committed
58 59
    - VERSION=`cat VERSION`
    - mv nordugrid-arc-${VERSION}.tar.gz rpmbuild/SOURCES
60
    - rpmbuild -D "_topdir $CI_PROJECT_DIR/rpmbuild" -ba nordugrid-arc.spec
61 62 63 64 65 66 67 68
  artifacts:
    when: on_success
    expire_in: 3 days
    paths:
    - $CI_PROJECT_DIR/rpmbuild/SRPMS/
    - $CI_PROJECT_DIR/rpmbuild/RPMS/noarch/
    - $CI_PROJECT_DIR/rpmbuild/RPMS/x86_64/
  allow_failure: false
69 70
  tags:
      - build
Mattias Ellert's avatar
Mattias Ellert committed
71
  except:
72 73
    refs:
      - master
74
      - next
75 76
      - branches@nordugrid/arc
      - tags@nordugrid/arc
Maiken's avatar
Maiken committed
77
  allow_failure: false
Mattias Ellert's avatar
Mattias Ellert committed
78 79


80
fork_packages_deb9:
81 82
  stage: build
  image: maikenp/arc-build-debian9
Mattias Ellert's avatar
Mattias Ellert committed
83 84 85 86 87 88 89 90 91 92 93 94 95
  script:
    - apt-get update -y
    - echo "6.0.0" > VERSION
    - ./autogen.sh
    - ./configure
    - make dist
    - VERSION=`cat VERSION`
    - mv nordugrid-arc-${VERSION}.tar.gz nordugrid-arc_${VERSION}.orig.tar.gz
    - tar -z -x -f nordugrid-arc_${VERSION}.orig.tar.gz
    - cd nordugrid-arc-${VERSION}
    - dpkg-buildpackage -S -us -uc -d
    - apt-get build-dep ../nordugrid-arc_${VERSION}-1.dsc -y
    - dpkg-buildpackage -b -us -uc
96 97
    - echo Delete dbgsym debs to save space
    - rm -f ../*-dbgsym_*.deb
98 99
  tags:
      - build
Mattias Ellert's avatar
Mattias Ellert committed
100
  except:
101 102
    refs:
      - master
103
      - next
104 105
      - branches@nordugrid/arc
      - tags@nordugrid/arc
106 107 108 109 110 111 112 113
  artifacts:
    when: on_success
    expire_in: 3 days
    paths:
    - $CI_PROJECT_DIR/*.orig.tar.gz
    - $CI_PROJECT_DIR/*.debian.tar.*
    - $CI_PROJECT_DIR/*.dsc
    - $CI_PROJECT_DIR/*.deb
114
  allow_failure: false
Mattias Ellert's avatar
Mattias Ellert committed
115

Maiken's avatar
Maiken committed
116

117
packages_deb9:
118
  stage: packages
119
  image: maikenp/arc-build-debian9
Mattias Ellert's avatar
Mattias Ellert committed
120
  script:
121
    - echo "6.0.0" > VERSION
Mattias Ellert's avatar
Mattias Ellert committed
122 123 124 125 126 127 128 129 130 131 132
    - apt-get update -y
    - ./autogen.sh
    - ./configure
    - make dist
    - VERSION=`cat VERSION`
    - mv nordugrid-arc-${VERSION}.tar.gz nordugrid-arc_${VERSION}.orig.tar.gz
    - tar -z -x -f nordugrid-arc_${VERSION}.orig.tar.gz
    - cd nordugrid-arc-${VERSION}
    - dpkg-buildpackage -S -us -uc -d
    - apt-get build-dep ../nordugrid-arc_${VERSION}-1.dsc -y
    - dpkg-buildpackage -b -us -uc
133 134
    - echo Delete dbgsym debs to save space
    - rm -f ../*-dbgsym_*.deb
135 136
  tags:
    - build
Mattias Ellert's avatar
Mattias Ellert committed
137
  only:
138 139 140 141 142 143
    - branches@nordugrid/arc
    - tags@nordugrid/arc
  artifacts:
    when: on_success
    expire_in: 30 days
    paths:
Mattias Ellert's avatar
Mattias Ellert committed
144 145 146 147
    - $CI_PROJECT_DIR/*.orig.tar.gz
    - $CI_PROJECT_DIR/*.debian.tar.*
    - $CI_PROJECT_DIR/*.dsc
    - $CI_PROJECT_DIR/*.deb
148
  allow_failure: true
Mattias Ellert's avatar
Mattias Ellert committed
149

Maiken's avatar
Maiken committed
150

151
packages_el6:
152
  stage: packages
Maiken's avatar
Maiken committed
153
  image: maikenp/arc-build-centos6
Mattias Ellert's avatar
Mattias Ellert committed
154
  script:
155
    - echo "$(date +%Y%m%dT%H%M%S)_${CI_COMMIT_SHA:0:8}_master" > VERSION
Mattias Ellert's avatar
Mattias Ellert committed
156 157 158 159 160 161 162 163 164 165
    - yum update -y
    - ./autogen.sh
    - ./configure
    - yum-builddep nordugrid-arc.spec -y
    - echo "Preparing and running rpmbuild"
    - mkdir -p rpmbuild/{SOURCES,BUILD,RPMS,SRPMS}
    - make dist
    - VERSION=`cat VERSION`
    - mv nordugrid-arc-${VERSION}.tar.gz rpmbuild/SOURCES
    - rpmbuild -D "_topdir $CI_PROJECT_DIR/rpmbuild" -ba nordugrid-arc.spec
166 167
  tags:
    - build
Mattias Ellert's avatar
Mattias Ellert committed
168
  only:
Maiken's avatar
Maiken committed
169 170
    - branches@nordugrid/arc
    - tags@nordugrid/arc
Maiken's avatar
Maiken committed
171
  artifacts:
172
    when: on_success
Maiken's avatar
Maiken committed
173
    expire_in: 30 days
Maiken's avatar
Maiken committed
174 175 176 177
    paths:
    - $CI_PROJECT_DIR/rpmbuild/SRPMS/
    - $CI_PROJECT_DIR/rpmbuild/RPMS/noarch/
    - $CI_PROJECT_DIR/rpmbuild/RPMS/x86_64/
Maiken's avatar
Maiken committed
178
  allow_failure: false
Mattias Ellert's avatar
Mattias Ellert committed
179 180


181
packages_el7:
182
  stage: packages
183
  image: maikenp/arc-build-centos7
Mattias Ellert's avatar
Mattias Ellert committed
184
  script:
185
    - echo "$(date +%Y%m%dT%H%M%S)_${CI_COMMIT_SHA:0:8}_master" > VERSION
Mattias Ellert's avatar
Mattias Ellert committed
186 187 188 189 190 191 192
    - yum update -y
    - ./autogen.sh
    - ./configure
    - yum-builddep nordugrid-arc.spec -y
    - echo "Preparing and running rpmbuild"
    - mkdir -p rpmbuild/{SOURCES,BUILD,RPMS,SRPMS}
    - make dist
193
    - VERSION=`cat VERSION`
Mattias Ellert's avatar
Mattias Ellert committed
194 195
    - mv nordugrid-arc-${VERSION}.tar.gz rpmbuild/SOURCES
    - rpmbuild -D "_topdir $CI_PROJECT_DIR/rpmbuild" -ba nordugrid-arc.spec
196 197
  tags:
    - build
Mattias Ellert's avatar
Mattias Ellert committed
198
  only:
Maiken's avatar
Maiken committed
199 200
    - branches@nordugrid/arc
    - tags@nordugrid/arc
201 202
  artifacts:
    when: on_success
Maiken's avatar
Maiken committed
203
    expire_in: 30 days
204 205 206 207 208
    paths:
    - $CI_PROJECT_DIR/rpmbuild/SRPMS/
    - $CI_PROJECT_DIR/rpmbuild/RPMS/noarch/
    - $CI_PROJECT_DIR/rpmbuild/RPMS/x86_64/
  allow_failure: false
Mattias Ellert's avatar
Mattias Ellert committed
209

210
run_static_analysis_el6:
211
  stage: static_ana
212 213 214 215
  image: maikenp/arc-sca-centos6
  script:
    - set +e
    - echo "Enabling python27 for running the cppcheck-htmlreport"
216 217 218 219 220 221 222 223 224 225 226 227 228
    #- export PYTHONPATH="/opt/rh/python27/root/usr/lib/python2.7/site-packages/":$PYTHONPATH
    #- export PATH="/opt/rh/python27/root/usr/bin/":$PATH
    #- export LD_LIBRARY_PATH="/opt/rh/python27/root/usr/lib64/":$LD_LIBRARY_PATH
    #- python --version
    - mkdir $CI_PROJECT_DIR/arc-tests
    - mkdir $CI_PROJECT_DIR/arc-tests/sloccount
    - mkdir $CI_PROJECT_DIR/arc-tests/cppcheck_html
    - mkdir $CI_PROJECT_DIR/arc-tests/rats
    - mkdir $CI_PROJECT_DIR/arc-tests/flawfinder
    - mkdir $CI_PROJECT_DIR/arc-tests/cpplint
    - ls 
    - ls /
    - echo "Enabling python27 for running the cppcheck-htmlreport"
229 230 231 232
    - export PYTHONPATH="/opt/rh/python27/root/usr/lib/python2.7/site-packages/":$PYTHONPATH
    - export PATH="/opt/rh/python27/root/usr/bin/":$PATH
    - export LD_LIBRARY_PATH="/opt/rh/python27/root/usr/lib64/":$LD_LIBRARY_PATH
    - python --version
233 234 235
    - rats  --html -w 3 ./ > $CI_PROJECT_DIR/arc-tests/rats/rats.html 2>&1
    - /flawfinder-1.31/flawfinder -m 2 --html --dataonly ./ > $CI_PROJECT_DIR/arc-tests/flawfinder/flawfinder.html 2>&1
    - scl enable python27 'cpplint --recursive counting=detailed --output=junit ./ > $CI_PROJECT_DIR/arc-tests/cpplint/cpplint.xml 2>&1'
236
    - cppcheck --enable=all --inconclusive --xml --xml-version=2 . 2> $CI_PROJECT_DIR/arc-tests/cppcheck.xml
237
    - scl enable python27 '$CP_PROJECT_DIR/cppcheck/htmlreport/cppcheck-htmlreport --file=$CI_PROJECT_DIR/arc-tests/cppcheck.xml --report-dir=$CI_PROJECT_DIR/arc-tests/cppcheck_html --source-dir=.'
238 239 240
    - ls $CI_PROJECT_DIR/arc-tests/
  tags:
    - 158.39.77.235
241 242 243
  only:
    - branches@nordugrid/arc
    - tags@nordugrid/arc
244 245 246 247 248 249 250
  artifacts:
    when: always
    expire_in: 1 days
    paths:
      - $CI_PROJECT_DIR/arc-tests/
  allow_failure: false

251 252 253 254
deploy_staging_deb9:
  stage: deploy_and_test
  image: docker:stable
  script:
255
    - docker run -v "/arc-testfiles:/arc-testfiles:rw" -v "/arc-testlogs:/arc-testlogs:rw" -v "/arc-logs:/arc-logs:rw" --publish  443:443  --publish 2811:2811 --publish 9000-9100:9000-9100 --publish 9000-9100:9000-9100/udp --rm  maikenp/arc-deploy-debian9
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
    - echo "*************>>  Done - back from inner container"
    - ls -lhrt /arc-logs
    - cp -r /arc-logs $CI_PROJECT_DIR
    - ls -lhrt $CI_PROJECT_DIR/arc-logs
  environment:
    name: staging
  artifacts:
    when: always
    paths:
     - $CI_PROJECT_DIR/arc-logs/
     #- $CI_PROJECT_DIR/arc-tests/
  dependencies:
    - packages_deb9
  tags:
    - docker-socket-runner1
271 272 273
  only:
    - branches@nordugrid/arc
    - tags@nordugrid/arc
274
  allow_failure: true
Maiken's avatar
Maiken committed
275

276 277
deploy_staging_el6:
  stage: deploy_and_test
278
  image: docker:stable
279
  script:
280 281
    - ls -lhrt /arc-testfiles
    - ls -lhrt /arc-logs
282
    - docker run -v "/arc-testfiles:/arc-testfiles:rw" -v "/arc-testlogs:/arc-testlogs:rw" -v "/arc-logs:/arc-logs:rw" --publish  443:443  --publish 2811:2811 --publish 9000-9100:9000-9100 --publish 9000-9100:9000-9100/udp --rm  maikenp/arc-deploy-centos6
283 284 285 286
    - echo "*************>>  Done - back from inner container"
    - ls -lhrt /arc-logs
    - cp -r /arc-logs $CI_PROJECT_DIR
    - ls -lhrt $CI_PROJECT_DIR/arc-logs
287 288 289 290 291
  environment:
    name: staging
  artifacts:
    when: always
    paths:
292 293
     - $CI_PROJECT_DIR/arc-logs/
     #- $CI_PROJECT_DIR/arc-tests/
Maiken's avatar
Maiken committed
294
  dependencies:
295
    - packages_el6
Maiken's avatar
Maiken committed
296
  tags:
297
    - docker-socket-runner-bgo4 
Mattias Ellert's avatar
Mattias Ellert committed
298
  only:
Maiken's avatar
Maiken committed
299 300 301
    - branches@nordugrid/arc
    - tags@nordugrid/arc
  allow_failure: true
Mattias Ellert's avatar
Mattias Ellert committed
302

Maiken's avatar
Maiken committed
303

304
deploy_staging_centos7:
305
  stage: deploy_and_test
306
  image: docker:stable
307
  script:
308 309 310
    - export DOCKER_API_VERSION=1.19
    - docker pull maikenp/arc-deploy-centos7
    - docker run -v "/arc-testfiles:/arc-testfiles:rw" -v "/arc-testlogs:/arc-testlogs:rw" -v "/arc-logs:/arc-logs:rw" --publish  443:443  --publish 2811:2811 --publish 9000-9100:9000-9100 --publish 9000-9100:9000-9100/udp --rm  maikenp/arc-deploy-centos7
311 312 313 314
    - echo "*************>>  Done - back from inner container"
    - ls -lhrt /arc-logs
    - cp -r /arc-logs $CI_PROJECT_DIR
    - ls -lhrt $CI_PROJECT_DIR/arc-logs
315 316 317 318 319
  environment:
    name: staging
  artifacts:
    when: always
    paths:
320 321
     - $CI_PROJECT_DIR/arc-logs/
     #- $CI_PROJECT_DIR/arc-tests/
322
  dependencies:
323
    - packages_el7
324
  tags:
325
    - docker-socket-runner1
Mattias Ellert's avatar
Mattias Ellert committed
326
  only:
327 328 329 330
    - branches@nordugrid/arc
    - tags@nordugrid/arc
  allow_failure: true

331 332


333
## note-to-self: can also download the rpms from latest job with (example for el7):
334
    ## wget 'https://source.coderefinery.org/nordugrid/arc/-/jobs/artifacts/master/download?job=packages_el7' -O artifacts.zip