-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
80 lines (70 loc) · 1.81 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
73
74
75
76
77
78
79
80
image:
name: gcr.io/bazel-public/ubuntu2004-java11:latest
variables:
GOPROXY: http://goproxy.golang:8080
GO111MODULE: "on"
before_script:
- chmod -R +x build
- mkdir $HOME/.docker
- export HTTP_PROXY=$CI_PROXY HTTPS_PROXY=$CI_PROXY NO_PROXY=goproxy.golang,nexus3.nexus3,new-page.xyz
- echo $DOCKER_AUTH_CONFIG > $HOME/.docker/config.json
stages:
- build
- push images
- deploy
lint-golang:
stage: build
image: golangci/golangci-lint:latest-alpine
script:
- golangci-lint run -v --timeout 5m
allow_failure: true
lint-helm:
stage: build
image: alpine/helm:3.2.3
script:
- helm lint ./chart
allow_failure: true
build:
stage: build
script:
- bazel version
- bazel build --config=ci //app/... //pkg/...
- bazel test --config=ci //app/... //pkg/...
build-merged:
stage: build
script:
- git config --global user.email "runner@gitlab.com"
- git config --global user.name "Runner"
- git pull origin master
- bazel version
- bazel build --config=ci //app/... //pkg/...
- bazel test --config=ci //app/... //pkg/...
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
push changed images:
stage: push images
script:
- build/push-images.sh changed
rules:
- if: $CI_COMMIT_BRANCH == "master"
force push all images:
stage: push images
script:
- build/push-images.sh
rules:
- if: $CI_COMMIT_BRANCH == "master"
allow_failure: true
when: manual
- when: never
deploy-ins:
stage: deploy
image: alpine/helm:3.2.3
script:
- mkdir ~/.kube && echo -n $KUBE_CONFIG | base64 -d > ~/.kube/config
- helm upgrade --install --namespace ncs -f ./chart/ins.yaml ncs ./chart
rules:
- if: $CI_COMMIT_BRANCH == "master"
allow_failure: true
when: manual
- when: never
needs: ["push changed images"]