-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
43 lines (41 loc) · 1.45 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
stages:
- build
- deploy
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
services:
- docker:23.0.6-dind
build:
stage: build
tags:
- docker
image: docker:stable
before_script:
- apk add --no-cache docker-compose
- docker info
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker-compose build
- docker tag kldemo-web:latest $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker tag kldemo-web:latest $CI_REGISTRY_IMAGE:latest
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker push $CI_REGISTRY_IMAGE:latest
deploy:
stage: deploy
tags:
- docker
image:
name: bitnami/kubectl:1.29
entrypoint: [""]
environment:
name: staging
script:
- kubectl config get-contexts
- kubectl config use-context ezlab/kubernetes-agent:leo
- kubectl apply -f deploy/kl-demo-service-namespace.yaml
- kubectl delete secret docker-registry registry-credentials --ignore-not-found --namespace=ezlab-load-balancing-demo
- kubectl create secret docker-registry registry-credentials --docker-server=$CI_REGISTRY --docker-username=$EZLAB_DEPLOY_USER --docker-password=$EZLAB_DEPLOY_PWD --namespace=ezlab-load-balancing-demo
- kubectl apply -f deploy
- kubectl rollout restart deployment kldemo-web-deployment --namespace=ezlab-load-balancing-demo
- kubectl rollout restart deployment kldemo-nginx-deployment --namespace=ezlab-load-balancing-demo