.gitlab-ci.yml 3.35 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
.mellon template: &mellon-template
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
26
27
28
29
30
31
  stage: prepare
  image: registry.gitlab.ics.muni.cz:443/europdx/k8s/ci:latest
  before_script: 
    *kube-auth
  script:
    - cd mellon/${CI_COMMIT_REF_NAME}
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
32
33
    - kubectl -n cbio-on-demand${NAMESPACE} create configmap cert --from-file=sp_cert.pem --dry-run -o yaml | kubectl apply -f -
    - kubectl -n cbio-on-demand${NAMESPACE} create configmap xml --from-file=sp-metadata.xml --dry-run -o yaml | kubectl apply -f -
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
34
    - export foo="${CI_COMMIT_REF_NAME}_KEY"
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
35
    - foo=$(eval echo \$"$foo")
36
37
    - mv $foo ./sp_key.pem
    - kubectl -n cbio-on-demand${NAMESPACE} create secret generic key --from-file=sp_key.pem --dry-run -o yaml | kubectl apply -f -
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

.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
71
#PRODUCTION
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
72
cBioDb build:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
73
    <<: *cbio-db-build-template
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
74
    only:
Radim Peša's avatar
Radim Peša committed
75
      - master
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
76

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
77
cBioJob build:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
78
    <<: *cbio-job-build-template
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
79
    only:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
80
      - master
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
81
82

deploy to k8s:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
83
84
    variables:
      NAMESPACE: cbio-on-demand
85
      DOMAIN: cbiood
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
86
87
      DATAHUB: datahub
    <<: *deploy-to-k8s-template
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
88
    only:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
89
90
      - master
    
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
91
92

#BETA
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
93
mellon beta:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
94
  <<: *mellon-template
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
95
96
97
98
99
  variables:
    NAMESPACE: -beta
  only:
    - beta

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
100
cBioDb build beta:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
101
    <<: *cbio-db-build-template
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
102
    only:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
103
104
      - beta

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
105
cBioJob build beta:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
106
    << : *cbio-job-build-template
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
107
    only:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
108
      - beta
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
109

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
110
deploy to k8s beta:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
111
112
    variables:
      NAMESPACE: cbio-on-demand-beta
113
      DOMAIN: cbiood-beta
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
114
115
      DATAHUB: datahub-beta
    <<: *deploy-to-k8s-template
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
116
    only:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
117
118
      - beta

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
119
#DEV
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
120
121
122
123
124
125
126
mellon dev:
  <<: *mellon-template
  variables:
    NAMESPACE: -dev
  only:
    - dev

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
127
cBioDb build dev:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
128
    <<: *cbio-db-build-template
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
129
    only:
130
131
132
133
      #changes:
      #  - builds/cbiodb/*
      refs:
        - dev
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
134

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
135
cBioJob build dev:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
136
    <<: *cbio-job-build-template
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
137
    only:
138
139
140
141
      #changes:
      #  - builds/job/*
      refs:
        - dev
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
142

Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
143
deploy to k8s dev:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
144
145
    variables:
      NAMESPACE: cbio-on-demand-dev
146
      DOMAIN: cbiood-dev
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
147
148
      DATAHUB: datahub-dev
    <<: *deploy-to-k8s-template
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
149
    only:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
150
      - dev