-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
56 lines (50 loc) · 1.6 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
image: node:16
variables:
GIT_SUBMODULE_STRATEGY: recursive
ARTIFACT_NAME: ui
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
- docker
- kubernetes-staging
- kubernetes-production
build:
stage: build
script:
- yarn install
- yarn build-storybook
artifacts:
paths:
- docs-build
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-ui --patch="{\"spec\":{\"template\":{\"spec\":{\"containers\":[{\"name\":\"kerberos-ui\",\"image\":\"${REGISTRY}:${CI_VERSION}\"}]}}}}" -n kerberos-ecosystem
except:
- main
kubernetes-production:
image: registry.cn-hangzhou.aliyuncs.com/haoshuwei24/kubectl:1.16.6
stage: kubernetes-production
environment:
name: production
script:
- kubectl patch deployment kerberos-ui --patch="{\"spec\":{\"template\":{\"spec\":{\"containers\":[{\"name\":\"kerberos-ui\",\"image\":\"${REGISTRY}:${CI_VERSION}\"}]}}}}" -n kerberos-ecosystem
only:
- main