.gitlab-ci.yml 2.78 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
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
51
    <<: *kube-auth
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
52
53
    image: registry.gitlab.ics.muni.cz:443/europdx/k8s/ci:latest
    script:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
54
        - ./yaml/bash.sh
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
55
56
57
58
        - kubectl version
        - kubectl apply -f ./yaml
    when:
        manual
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
59
60
61
    only:
      refs:
        - master
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
62
63

#BETA
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
64
cBioDb build beta:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
65
66
67
68
69
70
    stage: build
    <<: *docker-login
    image: docker:latest
    script:
        *docker-build-db
    when: manual
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
71
72
73
    only:
      refs:
        - beta
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
74
cBioJob build beta:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
75
76
77
78
79
80
    stage: build
    <<: *docker-login
    image: docker:latest
    script:
      *docker-build-job
    when: manual
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
81
82
83
    only:
      refs:
        - beta
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
84

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
85
deploy to k8s beta:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
86
87
88
89
90
91
    stage: deploy
    variables:
      NAMESPACE: cbio-on-demand-beta
    <<: *kube-auth
    image: registry.gitlab.ics.muni.cz:443/europdx/k8s/ci:latest
    script:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
92
        - ls ./yaml -al
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
93
94
95
        - ./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
#DEV
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
101
cBioDb build dev:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
102
103
104
105
106
107
    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

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
112
cBioJob build dev:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
113
114
115
116
117
118
    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

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
123
deploy to k8s dev:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
124
125
126
127
128
129
130
131
132
    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