.gitlab-ci.yml 1.68 KB
Newer Older
Nane Kratzke's avatar
Nane Kratzke committed
1
2
3
4
5
6
7
8
9
10
11
stages:
    - build
    - deploy
    - teardown

variables:
  KUBECTL: "transit/kubectl-plus:v1.19.4"
  CLUSTER: "rig.th-luebeck.dev"

container:
  stage: build
Nane Kratzke's avatar
Nane Kratzke committed
12
13
14
  image:
      name: gcr.io/kaniko-project/executor:debug
      entrypoint: [""]
Nane Kratzke's avatar
Nane Kratzke committed
15
16
  only:
      changes:
17
      - .gitlab-ci.yml
Nane Kratzke's avatar
Nane Kratzke committed
18
19
20
21
22
      - hiphop/*
      - hiphop/*/*
  script:
      - mkdir -p /kaniko/.docker
      - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
Nane Kratzke's avatar
Nane Kratzke committed
23
      - cd hiphop
Nane Kratzke's avatar
Nane Kratzke committed
24
25
26
27
28
29
30
31
32
      - /kaniko/executor --context . --destination $CI_REGISTRY_IMAGE/hiphop:latest

secrets:
  stage: build
  image: $KUBECTL
  script:
    - kubectl delete secret gitlab-registry-credentials || true
    - "kubectl create secret docker-registry gitlab-registry-credentials \
          --docker-server=$CI_REGISTRY \
Nane Kratzke's avatar
Nane Kratzke committed
33
          --docker-username=image-registry \ 
Nane Kratzke's avatar
Nane Kratzke committed
34
35
36
37
38
39
40
          --docker-password=$REGISTRY_READ_TOKEN \ 
          "

hiphop:
  stage: deploy
  image: $KUBECTL
  script:
Nane Kratzke's avatar
Nane Kratzke committed
41
    - kubectl apply -f deploy/tracing.yaml
Nane Kratzke's avatar
rebuild    
Nane Kratzke committed
42
43
44
45
    - TIER=1 mo deploy/hiphop-deploy+svc.yaml | kubectl apply -f -
    - TIER=2 mo deploy/hiphop-deploy+svc.yaml | kubectl apply -f -
    - TIER=3 mo deploy/hiphop-deploy+svc.yaml | kubectl apply -f -
    - TIER=4 mo deploy/hiphop-deploy+svc.yaml | kubectl apply -f -
Nane Kratzke's avatar
Nane Kratzke committed
46
47
48
49
50
51

shutdown:
  stage: teardown
  image: $KUBECTL
  when: manual
  script:
Nane Kratzke's avatar
rebuild    
Nane Kratzke committed
52
53
54
55
    - TIER=1 mo deploy/hiphop-deploy+svc.yaml | kubectl delete -f -
    - TIER=2 mo deploy/hiphop-deploy+svc.yaml | kubectl delete -f -
    - TIER=3 mo deploy/hiphop-deploy+svc.yaml | kubectl delete -f -
    - TIER=4 mo deploy/hiphop-deploy+svc.yaml | kubectl delete -f -
Nane Kratzke's avatar
update    
Nane Kratzke committed
56
    - kubectl delete -f deploy/tracing.yaml