.gitlab-ci.yml 2.75 KB
Newer Older
Radim Peša's avatar
Radim Peša committed
1
2
image: docker:latest

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
3
4
5
stages:
  - build
  - deploy
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
6
7
8
9
10
11
12

.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
13

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
14
15
16
17
.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
18
19
20
21
.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
22

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
23
24
25
26
27
.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
28
29
30
cBioDb build:
    stage: build
    <<: *docker-login
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
31
    image: docker:latest
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
32
    script:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
33
        *docker-build-db
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
34
    when: manual
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
35
    only:
Radim Peša's avatar
Radim Peša committed
36
      - master
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
37

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

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

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

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
97
    when: manual
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
98
99
100
    only:
      refs:
        - beta
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
101
102
103
104
105
106
107
108
#DEV
cBioDb build:
    stage: build
    <<: *docker-login
    image: docker:latest
    script:
        *docker-build-db
    when: manual
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
109
110
111
    only:
      refs:
        - dev
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
112
113
114
115
116
117
118
119

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

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
134
    when: manual
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
135
136
137
    only:
      refs:
        - dev