.gitlab-ci.yml 2.74 KB
Newer Older
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
1
2
3
stages:
  - build
  - deploy
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
4
5
6
7
8
9
10

.kube-auth: &kube-auth
  before_script:
    - mkdir $HOME/.kube
    - touch $HOME/.kube/config
    - echo "$KUBE_CONFIG" >>  $HOME/.kube/config

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
11

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
12
13
14
15
.docker-login: &docker-login
  before_script:
    - echo -n $CI_REGISTRY_PASSWORD | docker login -u "$CI_REGISTRY_USER" --password-stdin  $CI_REGISTRY

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
16
17
18
19
.docker-build-db:
  script: &docker-build-db
    - docker build --pull -t "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}-db${CI_COMMIT_SHA}" ./builds/cbiodb
    - docker push "$CI_REGISTRY_IMAGE:${CI_COMMIT_REF_NAME}-db${CI_COMMIT_SHA}"
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
20

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
21
22
23
24
25
.docker-build-job:
  script: &docker-build-job
    - docker build --pull -t "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}-job${CI_COMMIT_SHA}" ./builds/job
    - docker push "$CI_REGISTRY_IMAGE:${CI_COMMIT_REF_NAME}-job${CI_COMMIT_SHA}"
#PRODUCTION
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
26
27
28
cBioDb build:
    stage: build
    <<: *docker-login
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
29
    image: docker:latest
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
30
    script:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
31
        *docker-build-db
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
32
    when: manual
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
33
34
35
    only:
      refs:
        - master
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
36

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
37
cBioJob build:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
38
    stage: build
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
39
    <<: *docker-login
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
40
    image: docker:latest
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
41
    script:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
42
      *docker-build-job
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
43
    when: manual
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
44
45
46
    only:
      refs:
        - master
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
47
48
49

deploy to k8s:
    stage: deploy
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
50
51
    variables:
      NAMESPACE: cbio-on-demand
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
52
    <<: *kube-auth
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
53
54
    image: registry.gitlab.ics.muni.cz:443/europdx/k8s/ci:latest
    script:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
55
        - ./yaml/bash.sh
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
56
57
58
59
        - kubectl version
        - kubectl apply -f ./yaml
    when:
        manual
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
60
61
62
    only:
      refs:
        - master
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
63
64
65
66
67
68
69
70
71

#BETA
cBioDb build:
    stage: build
    <<: *docker-login
    image: docker:latest
    script:
        *docker-build-db
    when: manual
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
72
73
74
    only:
      refs:
        - beta
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
75
76
77
78
79
80
81
cBioJob build:
    stage: build
    <<: *docker-login
    image: docker:latest
    script:
      *docker-build-job
    when: manual
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
82
83
84
    only:
      refs:
        - beta
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
85
86
87
88
89
90
91
92
93
94
95

deploy to k8s:
    stage: deploy
    variables:
      NAMESPACE: cbio-on-demand-beta
    <<: *kube-auth
    image: registry.gitlab.ics.muni.cz:443/europdx/k8s/ci:latest
    script:
        - ./yaml/bash.sh
        - kubectl version
        - kubectl apply -f ./yaml
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
96
    when: manual
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
97
98
99
    only:
      refs:
        - beta
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
100
101
102
103
104
105
106
107
#DEV
cBioDb build:
    stage: build
    <<: *docker-login
    image: docker:latest
    script:
        *docker-build-db
    when: manual
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
108
109
110
    only:
      refs:
        - dev
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
111
112
113
114
115
116
117
118

cBioJob build:
    stage: build
    <<: *docker-login
    image: docker:latest
    script:
      *docker-build-job
    when: manual
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
119
120
121
    only:
      refs:
        - dev
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
122
123
124
125
126
127
128
129
130
131
132

deploy to k8s:
    stage: deploy
    variables:
      NAMESPACE: cbio-on-demand-dev
    <<: *kube-auth
    image: registry.gitlab.ics.muni.cz:443/europdx/k8s/ci:latest
    script:
        - ./yaml/bash.sh
        - kubectl version
        - kubectl apply -f ./yaml
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
133
    when: manual
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
134
135
136
    only:
      refs:
        - dev