.gitlab-ci.yml 3.09 KB
Newer Older
Timm Fitschen's avatar
Timm Fitschen committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#
# ** header v3.0
# This file is a part of the CaosDB Project.
#
# Copyright (C) 2018 Research Group Biomedical Physics,
# Max-Planck-Institute for Dynamics and Self-Organization Göttingen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# ** end header
#
Henrik tom Wörden's avatar
ci    
Henrik tom Wörden committed
23

Henrik tom Woerden's avatar
F ci    
Henrik tom Woerden committed
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
variables:
   CI_REGISTRY_IMAGE: $CI_REGISTRY/caosdb-webui-testenv
   # When using dind service we need to instruct docker, to talk with the
   # daemon started inside of the service. The daemon is available with
   # a network connection instead of the default /var/run/docker.sock socket.
   #
   # The 'docker' hostname is the alias of the service container as described at
   # https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#accessing-the-services
   #
   # Note that if you're using the Kubernetes executor, the variable should be set to
   # tcp://localhost:2375/ because of how the Kubernetes executor connects services
   # to the job container
   # DOCKER_HOST: tcp://localhost:2375/
   #
   # For non-Kubernetes executors, we use tcp://docker:2375/
   DOCKER_HOST: tcp://docker:2375/
   # When using dind, it's wise to use the overlayfs driver for
   # improved performance.
   DOCKER_DRIVER: overlay2

services:
   - docker:dind

image: $CI_REGISTRY_IMAGE:latest


Timm Fitschen's avatar
Timm Fitschen committed
50
51
52
53
stages:
    - setup
    - linting
    - test
Henrik tom Wörden's avatar
ci    
Henrik tom Wörden committed
54
    - deploy
Timm Fitschen's avatar
Timm Fitschen committed
55
56
57
58
59

#######
# setup
#######

Henrik tom Woerden's avatar
F ci    
Henrik tom Woerden committed
60
###  TODO !!! use respective docker image
Timm Fitschen's avatar
Timm Fitschen committed
61
62
63
64
65
66
67
######
# test
######

# run qunit tests
test:qunit:
    stage: test
Henrik tom Woerden's avatar
F ci    
Henrik tom Woerden committed
68
    #tags: [ py36 ]
Timm Fitschen's avatar
Timm Fitschen committed
69
70
    artifacts:
        paths:
71
            - public/qunit.log
Timm Fitschen's avatar
Timm Fitschen committed
72
73
            - screenlog.*
    script:
Henrik tom Woerden's avatar
F ci    
Henrik tom Woerden committed
74
75
76
        - make pylint
# TODO fix the following
#        - make run-qunit
Henrik tom Wörden's avatar
ci    
Henrik tom Wörden committed
77
78
79
80
          
trigger_build:
  stage: deploy
  script:
Henrik tom Woerden's avatar
F ci    
Henrik tom Woerden committed
81
    - echo $TOKEN     
Henrik tom Wörden's avatar
ci    
Henrik tom Wörden committed
82
83
    - /usr/bin/curl -X POST
       -F token=$TOKEN
Henrik tom Woerden's avatar
F ci    
Henrik tom Woerden committed
84
       -F "variables[WEBUI]=$CI_COMMIT_REF_NAME"
Henrik tom Wörden's avatar
ci    
Henrik tom Wörden committed
85
       -F ref=master https://gitlab.indiscale.com/api/v4/projects/14/trigger/pipeline
Henrik tom Woerden's avatar
F ci    
Henrik tom Woerden committed
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105

build-testenv:
    image: docker:latest
    stage: setup
    script: 
        - echo $TRIGGERED_BY
        - echo $MYSQLBACKEND
        - ping -4 -c 3 registry.indiscale.com
        - echo $PYLIB
        - cd test/docker
        - echo $CI_REGISTRY_PASSWORD 
        - echo $CI_REGISTRY
        - docker login -u testuser -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
          # use here general latest or specific branch latest...
        - docker pull $CI_REGISTRY_IMAGE:latest || true
        - docker build 
          --pull
          --cache-from $CI_REGISTRY_IMAGE:latest 
          -t $CI_REGISTRY_IMAGE:latest .
        - docker push $CI_REGISTRY_IMAGE:latest