forked from kerberos-io/documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
72 lines (65 loc) · 2.06 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
71
72
image: monachus/hugo
variables:
GIT_SUBMODULE_STRATEGY: recursive
ARTIFACT_NAME: documentation
REPO_NAME: kerberos-io/${ARTIFACT_NAME}
REPO_DIR: gitlab.com/${REPO_NAME}
CI_VERSION: "1.0.${CI_PIPELINE_ID}"
DOCKER_HOST: tcp://localhost:2375
NAMESPACE: kerberos
REGISTRY: registry.gitlab.com/kerberos-io/${ARTIFACT_NAME}
stages:
- build-staging # Staging environment -> develop
- build-production # Production environment -> master
- docker # All branches
- kubernetes-staging # Staging environment -> develop
- kubernetes-production # Production environment -> master
build-staging:
image: node:10.22.1
stage: build-staging
script:
- yarn
- yarn run build-staging
artifacts:
paths:
- public
except:
- master
build-production:
image: node:10.22.1
stage: build-production
script:
- yarn
- yarn run build
artifacts:
paths:
- public
only:
- master
docker:
image: docker:stable
stage: docker
services:
- docker:18.09.7-dind
script:
- docker login -u ${gitlab_id} -p ${gitlab_token} $CI_REGISTRY
- docker build --build-arg gitlab_id=${gitlab_id} --build-arg gitlab_token=${gitlab_token} -t $CI_REGISTRY/$REPO_NAME:$CI_VERSION .
- docker push $CI_REGISTRY/$REPO_NAME:$CI_VERSION
kubernetes-staging:
image: registry.cn-hangzhou.aliyuncs.com/haoshuwei24/kubectl:1.16.6
stage: kubernetes-staging
environment:
name: staging
script:
- kubectl patch deployment kerberos-documentation --patch="{\"spec\":{\"template\":{\"spec\":{\"containers\":[{\"name\":\"kerberos-documentation\",\"image\":\"${REGISTRY}:${CI_VERSION}\"}]}}}}" -n kerberos-ecosystem
except:
- master
kubernetes-production:
image: registry.cn-hangzhou.aliyuncs.com/haoshuwei24/kubectl:1.16.6
stage: kubernetes-production
environment:
name: production
script:
- kubectl patch deployment kerberos-documentation --patch="{\"spec\":{\"template\":{\"spec\":{\"containers\":[{\"name\":\"kerberos-documentation\",\"image\":\"${REGISTRY}:${CI_VERSION}\"}]}}}}" -n kerberos-ecosystem
only:
- master