-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
77 lines (69 loc) · 1.63 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
stages:
- deps
- lint
- build
- publish
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
when: never
- if: $CI_COMMIT_BRANCH
- if: $CI_COMMIT_TAG
variables:
CI_JSONNET_IMAGE: docker.io/alikov/ci-jsonnet:0.2.7
version:
stage: deps
image: docker.io/bitnami/git:2.43.2
script:
- ci/scripts/version.sh ci/reports/version.env
artifacts:
reports:
dotenv:
- ci/reports/version.env
rules:
- if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+/
variables:
IS_TAGGED_RELEASE: "1"
- when: on_success
deps:
stage: deps
image: $CI_JSONNET_IMAGE
script:
- jb install
cache:
- key:
files:
- jsonnetfile.lock.json
paths:
- vendor
artifacts:
paths:
- vendor
expire_in: 1 day
check-style:
stage: lint
image: $CI_JSONNET_IMAGE
script:
- jsonnetfmt --test *.libsonnet
- jsonnetfmt --test *.jsonnet
needs: []
build:
stage: build
image: $CI_JSONNET_IMAGE
script:
- jsonnet -J vendor telegraf-system.jsonnet >"ci/build/telegraf-system-${VERSION_SEMVER}.json"
- jsonnet -J vendor telegraf-mdstat.jsonnet >"ci/build/telegraf-mdstat-${VERSION_SEMVER}.json"
artifacts:
paths:
- ci/build
expire_in: 1 day
publish-github:
stage: publish
image: docker.io/python:3.12-slim
script:
- ci/scripts/publish-github-assets.py "ci/build/telegraf-system-${VERSION_SEMVER}.json" "ci/build/telegraf-mdstat-${VERSION_SEMVER}.json"
rules:
- if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+/
variables:
IS_TAGGED_RELEASE: "true"