.gitlab-ci.yml 3.11 KB
Newer Older
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
1
stages:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
2
  - prepare
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
3
4
  - build
  - deploy
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
5

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
6
7
8
9
.kube-auth: &kube-auth 
  - mkdir $HOME/.kube
  - touch $HOME/.kube/config
  - echo "$KUBE_CONFIG" >>  $HOME/.kube/config
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
10

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

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

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

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
20
21
22
23
.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}"
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57


.cbio-db-build-template: &cbio-db-build-template
  stage: build
  image: docker:latest
  before_script:
    *docker-login
  script:
    *docker-build-db
  when: manual
  allow_failure: false

.cbio-job-build-template: &cbio-job-build-template
  stage: build
  image: docker:latest
  before_script: *docker-login
  script:
    *docker-build-job
  when: manual
  allow_failure: false

.deploy-to-k8s-template: &deploy-to-k8s-template
  stage: deploy
  before_script: 
    *kube-auth
  image: registry.gitlab.ics.muni.cz:443/europdx/k8s/ci:latest
  script:
      - ./yaml/bash.sh
      - kubectl version
      - kubectl apply -f ./yaml
  when:
      manual
  allow_failure: false
  
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
58
#PRODUCTION
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
59
cBioDb build:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
60
    <<: *cbio-db-build-template
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
61
    only:
Radim Peša's avatar
Radim Peša committed
62
      - master
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
63

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
64
cBioJob build:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
65
    <<: *cbio-job-build-template
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
66
    only:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
67
      - master
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
68
69

deploy to k8s:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
70
71
    variables:
      NAMESPACE: cbio-on-demand
72
      DOMAIN: cbiood
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
73
74
      DATAHUB: datahub
    <<: *deploy-to-k8s-template
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
75
    only:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
76
77
      - master
    
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
78
79

#BETA
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
80
81
mellon beta:
  stage: prepare
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
82
  image: registry.gitlab.ics.muni.cz:443/europdx/k8s/ci:latest
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
83
84
  variables:
    NAMESPACE: -beta
85
86
  before_script: 
    *kube-auth
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
87
88
  script:
    - cd mellon/${CI_COMMIT_REF_NAME}
89
90
    - kubectl get -n cbio-on-demand${NAMESPACE} configmaps cert || kubectl -n cbio-on-demand${NAMESPACE} create configmap cert --from-file=http_cbiood_${CI_COMMIT_REF_NAME}.edirex.ics.muni.cz.cert
    - kubectl get -n cbio-on-demand${NAMESPACE} configmaps xml || kubectl -n cbio-on-demand${NAMESPACE} create configmap xml --from-file=http_cbiood_${CI_COMMIT_REF_NAME}.edirex.ics.muni.cz.xml
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
91
92
93
  only:
    - beta

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
94
cBioDb build beta:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
95
    <<: *cbio-db-build-template
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
96
    only:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
97
98
      - beta

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
99
cBioJob build beta:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
100
    << : *cbio-job-build-template
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
101
    only:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
102
      - beta
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
103

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
104
deploy to k8s beta:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
105
106
    variables:
      NAMESPACE: cbio-on-demand-beta
107
      DOMAIN: cbiood-beta
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
108
109
      DATAHUB: datahub-beta
    <<: *deploy-to-k8s-template
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
110
    only:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
111
112
      - beta

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
113
#DEV
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
114
cBioDb build dev:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
115
    <<: *cbio-db-build-template
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
116
    only:
117
118
119
120
      #changes:
      #  - builds/cbiodb/*
      refs:
        - dev
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
121

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
122
cBioJob build dev:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
123
    <<: *cbio-job-build-template
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
124
    only:
125
126
127
128
      #changes:
      #  - builds/job/*
      refs:
        - dev
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
129

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
130
deploy to k8s dev:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
131
132
    variables:
      NAMESPACE: cbio-on-demand-dev
133
      DOMAIN: cbiood-dev
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
134
135
      DATAHUB: datahub-dev
    <<: *deploy-to-k8s-template
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
136
    only:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
137
      - dev