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

.kube-auth: &kube-auth
  before_script:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
7
    - echo "$KUBE_CONFIG" > /usr/local/bin/kubectl
Ľuboslav Pivarč's avatar
CI  
Ľuboslav Pivarč committed
8
9
10

.docker-login: &docker-login
  before_script:
Radim Peša's avatar
Radim Peša committed
11
12
#    - echo -n $CI_REGISTRY_PASSWORD | docker login -u "$CI_REGISTRY_USER" --password-stdin  $CI_REGISTRY
    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
Ľuboslav Pivarč's avatar
CI  
Ľuboslav Pivarč committed
13
14
15
16
17
18

API docker image build:
  stage: build
  <<: *docker-login
  image: docker:latest
  script:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
19
    - docker build --pull -t "${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}" ./cbioondemandK8S
Ľuboslav Pivarč's avatar
CI  
Ľuboslav Pivarč committed
20
21
22
23
24
25
26
27
28
29
30
31
    - docker push "$CI_REGISTRY_IMAGE:${CI_COMMIT_REF_NAME}"
  only:
    refs:
      - master

API Kube deploy:
  stage: deploy
  <<: *kube-auth
  image: registry.gitlab.ics.muni.cz:443/europdx/k8s/ci:latest
  variables:
    NAMESPACE: cbio-on-demand
  script:
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
32
33
    - sed -i "s^__IMAGE__^${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}^" ./k8s/deployment.yml
    - sed -i "s^__NAMESPACE__^${NAMESPACE}^" ./k8s/deployment.yml ./k8s/identifier.yml ./k8s/service.yml
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
34
    - kubectl version
Ľuboslav Pivarč's avatar
CI  
Ľuboslav Pivarč committed
35
36
    - kubectl get pods -n cbio-on-demand
    - kubectl apply -f ./k8s
Ľuboslav Pivarč's avatar
Ľuboslav Pivarč committed
37
    - kubectl rollout status -f ./k8s/deployment.yml
Ľuboslav Pivarč's avatar
CI  
Ľuboslav Pivarč committed
38
39
40
  only:
    refs:
      - master