.gitlab-ci.yml 2.38 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
33
    when: manual

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
34
cBioJob build:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
35
    stage: build
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
36
    <<: *docker-login
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
37
    image: docker:latest
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
38
    script:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
39
      *docker-build-job
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
40
41
42
43
44
    when: manual


deploy to k8s:
    stage: deploy
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
45
46
    variables:
      NAMESPACE: cbio-on-demand
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
47
    <<: *kube-auth
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
48
49
    image: registry.gitlab.ics.muni.cz:443/europdx/k8s/ci:latest
    script:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
50
        - ./yaml/bash.sh
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
51
52
53
54
        - kubectl version
        - kubectl apply -f ./yaml
    when:
        manual
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113


#BETA
cBioDb build:
    stage: build
    <<: *docker-login
    image: docker:latest
    script:
        *docker-build-db
    when: manual

cBioJob build:
    stage: build
    <<: *docker-login
    image: docker:latest
    script:
      *docker-build-job
    when: manual


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

#DEV
cBioDb build:
    stage: build
    <<: *docker-login
    image: docker:latest
    script:
        *docker-build-db
    when: manual

cBioJob build:
    stage: build
    <<: *docker-login
    image: docker:latest
    script:
      *docker-build-job
    when: manual


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