.gitlab-ci.yml 2.85 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
    only:
Radim Peša's avatar
Radim Peša committed
34
      - master
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
35

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

deploy to k8s:
    stage: deploy
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
49
50
    variables:
      NAMESPACE: cbio-on-demand
51
      DOMAIN: cbiood
Ľ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

#BETA
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
65
cBioDb build beta:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
66
67
68
69
70
71
    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
cBioJob build beta:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
76
77
78
79
80
81
    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

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
86
deploy to k8s beta:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
87
88
89
    stage: deploy
    variables:
      NAMESPACE: cbio-on-demand-beta
90
      DOMAIN: cbiood-beta
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
91
92
93
    <<: *kube-auth
    image: registry.gitlab.ics.muni.cz:443/europdx/k8s/ci:latest
    script:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
94
        - ls ./yaml -al
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
95
96
97
        - ./yaml/bash.sh
        - kubectl version
        - kubectl apply -f ./yaml
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
98
    when: manual
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
99
100
101
    only:
      refs:
        - beta
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
102
#DEV
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
103
cBioDb build dev:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
104
105
106
107
108
109
    stage: build
    <<: *docker-login
    image: docker:latest
    script:
        *docker-build-db
    when: manual
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
110
111
112
    only:
      refs:
        - dev
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
113

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
114
cBioJob build dev:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
115
116
117
118
119
120
    stage: build
    <<: *docker-login
    image: docker:latest
    script:
      *docker-build-job
    when: manual
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
121
122
123
    only:
      refs:
        - dev
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
124

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
125
deploy to k8s dev:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
126
127
128
    stage: deploy
    variables:
      NAMESPACE: cbio-on-demand-dev
129
      DOMAIN: cbiood-dev
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
130
131
132
133
134
135
    <<: *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
136
    when: manual
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
137
138
139
    only:
      refs:
        - dev