.gitlab-ci.yml 2.99 KB
Newer Older
Nane Kratzke's avatar
Nane Kratzke committed
1
2
image: "transit/kubectl-plus:v1.19.4"

Nane Kratzke's avatar
Nane Kratzke committed
3
4
5
6
7
stages:
    - build
    - deploy
    - teardown

Nane Kratzke's avatar
Nane Kratzke committed
8
hiphop-container:
Nane Kratzke's avatar
Nane Kratzke committed
9
  stage: build
Nane Kratzke's avatar
Nane Kratzke committed
10
11
12
  image:
      name: gcr.io/kaniko-project/executor:debug
      entrypoint: [""]
Nane Kratzke's avatar
Nane Kratzke committed
13
14
  only:
      changes:
15
      - .gitlab-ci.yml
Nane Kratzke's avatar
Nane Kratzke committed
16
17
18
19
20
      - 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
21
      - cd hiphop
Nane Kratzke's avatar
Nane Kratzke committed
22
23
      - /kaniko/executor --context . --destination $CI_REGISTRY_IMAGE/hiphop:latest

Nane Kratzke's avatar
Nane Kratzke committed
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
space-container:
  stage: build
  image:
      name: gcr.io/kaniko-project/executor:debug
      entrypoint: [""]
  only:
      changes:
      - .gitlab-ci.yml
      - space/*
      - space/*/*
  script:
      - mkdir -p /kaniko/.docker
      - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
      - cd space
      - /kaniko/executor --context . --destination $CI_REGISTRY_IMAGE/space:latest

Nane Kratzke's avatar
Nane Kratzke committed
40
41
42
43
44
45
secrets:
  stage: build
  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
46
          --docker-username=image-registry \ 
Nane Kratzke's avatar
Nane Kratzke committed
47
48
49
          --docker-password=$REGISTRY_READ_TOKEN \ 
          "

Nane Kratzke's avatar
Nane Kratzke committed
50
51
space:
  stage: deploy
Nane Kratzke's avatar
Nane Kratzke committed
52
  when: manual
Nane Kratzke's avatar
Nane Kratzke committed
53
54
55
56
57
58
59
  script:
    - kubectl apply -f deploy/tracing.yaml
    - NS=$(kubectl config view -o jsonpath="{..namespace}")
    - kubectl label ns $NS istio-injection=disabled --overwrite
    - kubectl delete -f deploy/space-deploy+svc.yaml || true
    - kubectl apply -f deploy/space-deploy+svc.yaml

Nane Kratzke's avatar
Nane Kratzke committed
60
61
hiphop:
  stage: deploy
Nane Kratzke's avatar
Nane Kratzke committed
62
  when: manual
Nane Kratzke's avatar
Nane Kratzke committed
63
  script:
Nane Kratzke's avatar
Nane Kratzke committed
64
    - kubectl apply -f deploy/tracing.yaml
Nane Kratzke's avatar
Nane Kratzke committed
65
    - NS=$(kubectl config view -o jsonpath="{..namespace}")
Nane Kratzke's avatar
Nane Kratzke committed
66
    - kubectl label ns $NS istio-injection=disabled --overwrite
Nane Kratzke's avatar
Nane Kratzke committed
67
68
69
70
    - TIER=1 mo deploy/hiphop-deploy+svc.yaml | kubectl delete -f - || true
    - TIER=2 mo deploy/hiphop-deploy+svc.yaml | kubectl delete -f - || true
    - TIER=3 mo deploy/hiphop-deploy+svc.yaml | kubectl delete -f - || true
    - TIER=4 mo deploy/hiphop-deploy+svc.yaml | kubectl delete -f - || true
Nane Kratzke's avatar
rebuild    
Nane Kratzke committed
71
72
73
74
    - 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
75
76
77
78
79

shutdown:
  stage: teardown
  when: manual
  script:
Nane Kratzke's avatar
Nane Kratzke committed
80
    - NS=$(kubectl config view -o jsonpath="{..namespace}")
Nane Kratzke's avatar
rebuild    
Nane Kratzke committed
81
82
83
84
    - 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
Nane Kratzke committed
85
    - kubectl delete -f deploy/space-deploy+svc.yaml
Nane Kratzke's avatar
update    
Nane Kratzke committed
86
    - kubectl delete -f deploy/tracing.yaml
Nane Kratzke's avatar
Nane Kratzke committed
87
    - kubectl label ns $NS istio-injection=disabled --overwrite
Nane Kratzke's avatar
Nane Kratzke committed
88