-
Notifications
You must be signed in to change notification settings - Fork 6
/
.gitlab-ci.yml
79 lines (73 loc) · 1.66 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
stages:
- build
- lint
- build_images
- publish
variables:
GO_VERSION: "1.15"
GO_IMAGE: golang:$GO_VERSION
GOPATH: $CI_PROJECT_DIR/.go
CI_IMAGE_TAG: $CI_COMMIT_SHA
HELM_IMAGE: registry.gitlab.com/edgetic/ci/helm:v3.3.3
PDU_SENSORS_CHART: deploy/charts/pdu-sensors
build:
image: $GO_IMAGE
stage: build
script:
- make build
artifacts:
paths:
- deploy/
cache:
paths:
- $GOPATH/pkg/mod/
key: ${CI_COMMIT_REF_SLUG}-gomodules
only:
- master
- branches
- tags
- merge_requests
helm lint:
image: $HELM_IMAGE
stage: lint
script:
- yq w -i $PDU_SENSORS_CHART/values.yaml image.tag $CI_IMAGE_TAG
- helm lint $PDU_SENSORS_CHART
- helm dep update $PDU_SENSORS_CHART
variables:
GIT_STRATEGY: none
artifacts:
paths:
- deploy/
only:
- master
- branches
- tags
- merge_requests
.build_image:
image:
name: registry.gitlab.com/edgetic/ci/makisu:v0.1.12
stage: build_images
variables:
BUILD_ARG: --build-arg GO_VERSION=$GO_VERSION
only:
- master
- tags
- merge_requests
build exporter image:
extends: .build_image
script:
- build -f build/exporter/Dockerfile $BUILD_ARG -p $CI_PROJECT_PATH/exporter .
helm publish:
image: $HELM_IMAGE
stage: publish
script:
- echo $GOOGLE_APPLICATION_CREDENTIALS > helm-bucket.json
- export GOOGLE_APPLICATION_CREDENTIALS=helm-bucket.json
- helm repo add edgetic-stable gs://edgetic-helm/stable
- helm package --app-version $CI_COMMIT_TAG --version $CI_COMMIT_TAG $PDU_SENSORS_CHART
- helm gcs push pdu-sensors-$CI_COMMIT_TAG.tgz edgetic-stable
variables:
GIT_STRATEGY: none
only:
- tags