-
Notifications
You must be signed in to change notification settings - Fork 57
/
.gitlab-ci.yml
70 lines (64 loc) · 1.85 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
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
# include:
# - project: 'louzhijian/devops'
# ref: master
# file: 'devops/sonar-scanner.yml'
stages:
# - sonarqube
# - docker-dev
# - deploy-dev
- docker-prd
- deploy-prd
variables:
# DOCKER_HOST: tcp://localhost:2375/
IMAGE: $CI_ALI_REGISTRY_DOMAIN/masa/masa-blazor-pro:0.0.$CI_PIPELINE_ID
IMAGE_PRD: $CI_ALI_REGISTRY_DOMAIN/masa/masa-blazor-pro:$CI_COMMIT_TAG
# docker:
# stage: docker-dev
# tags:
# - linux-shell
# before_script:
# - docker login -u $CI_ALI_REGISTRY_USER -p $CI_ALI_REGISTRY_PASSWD $CI_ALI_REGISTRY_DOMAIN
# only:
# - main
# script:
# - docker build --force-rm -f ./Masa.Blazor.Pro/Dockerfile -t $IMAGE .
# - docker push $IMAGE
# retry: 2
# deploy-dev:
# image: portainer/kubectl-shell
# stage: deploy-dev
# only:
# - main
# script:
# - echo $KUBE_CONFIG_DEV_YDY | base64 -d > ./config
# - kubectl --kubeconfig ./config set image deployment/masa-blazor-pro masa-blazor-pro=$IMAGE -n masa-blazor
# retry: 2
docker-prd:
# image: docker:17.05.0
stage: docker-prd
tags:
- linux-shell
only:
- tags
before_script:
- docker login -u $CI_ALI_REGISTRY_USER -p $CI_ALI_REGISTRY_PASSWD $CI_ALI_REGISTRY_DOMAIN
# services:
# - name: $CI_ALI_REGISTRY_DOMAIN/masa/library:docker-17.05.01-dind
script:
# - docker login -u $CI_ALI_REGISTRY_USER -p $CI_ALI_REGISTRY_PASSWD $CI_ALI_REGISTRY_DOMAIN
- docker build --force-rm -f ./Masa.Blazor.Pro/Dockerfile -t $IMAGE_PRD .
- docker push $IMAGE_PRD
after_script:
- docker rmi $IMAGE_PRD
retry: 2
deploy-prd:
# image: portainer/kubectl-shell
tags:
- linux-shell
stage: deploy-prd
only:
- tags
script:
- echo $KUBE_CONFIG_LSD_PRD_YDY | base64 -d > ./config
- kubectl --kubeconfig ./config set image deployment/masa-blazor-pro masa-blazor-pro=$IMAGE_PRD -n masa-blazor
retry: 2