-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
61 lines (56 loc) · 1.38 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
stages:
- lint
- quality
- build
- deploy
.all_branches: &all_branches
only:
- /^feature\/+[0-9](-[a-zA-Z0-9_]+)*/
- /^bugfix\/+[0-9](-[a-zA-Z0-9_]+)*/
- master
- develop
- tags
.protected_branches: &protected_branches
only:
- master
- develop
linting:
stage: lint
image: node:11
before_script:
- npm install @vue/cli
- npm install
script:
- npm run lint
<<: *all_branches
build image:
stage: build
image: docker:stable
services:
- docker:stable-dind
variables:
VERSION: $CI_COMMIT_SHORT_SHA
before_script:
- docker login -u $DOCKER_USER -p $DOCKER_PASS
- |
if [ "$CI_COMMIT_REF_NAME" = "master" ];
then
export VERSION=stable
elif [ "$CI_COMMIT_REF_NAME" = "develop" ];
then
export VERSION=hm
fi
script:
- export IMAGE=$DOCKER_USER/$CI_PROJECT_NAME:$VERSION
- docker build -t $IMAGE .
- docker push $IMAGE
<<: *protected_branches
deploy image:
stage: deploy
image: diemscott/rancher-cli-k8s:v2.0.2
script:
- echo 1 | rancher login -t "$RANCHER_API_TOKEN" "$RANCHER_SERVER_URL"
- rancher context switch "$CONTEXT_HOMOLOG"
- rancher kubectl -n homolog scale --current-replicas=1 --replicas=0 deployment/qrcomer-front
- rancher kubectl -n homolog scale --current-replicas=0 --replicas=1 deployment/qrcomer-front
<<: *protected_branches