-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
106 lines (96 loc) · 2.89 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
stages:
- build
- test
- container
- helm chart
- deploy
variables:
# `showDateTime` will show the passed time in milliseconds. You need to specify `--batch-mode` to make this work.
MAVEN_OPTS: >-
-Dhttps.protocols=TLSv1.2
-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository
-Dorg.slf4j.simpleLogger.showDateTime=true
-Djava.awt.headless=true
# As of Maven 3.3.0 instead of this you MAY define these options in `.mvn/maven.config` so the same config is used
# when running from the command line.
# As of Maven 3.6.1, the use of `--no-tranfer-progress` (or `-ntp`) suppresses download and upload messages. The use
# of the `Slf4jMavenTransferListener` is no longer necessary.
# `installAtEnd` and `deployAtEnd` are only effective with recent version of the corresponding plugins.
MAVEN_CLI_OPTS: >-
--batch-mode
--errors
--fail-at-end
--show-version
--no-transfer-progress
-DinstallAtEnd=true
-DdeployAtEnd=true
image: maven:3-openjdk-17
# Cache downloaded dependencies and plugins between builds.
# To keep cache across branches add 'key: "$CI_JOB_NAME"'
# Be aware that `mvn deploy` will install the built jar into this repository. If you notice your cache size
# increasing, consider adding `-Dmaven.install.skip=true` to `MAVEN_OPTS` or in `.mvn/maven.config`
cache:
paths:
- .m2/repository
build:
tags:
- argus
stage: build
script:
- mvn compile
test:
tags:
- argus
stage: test
script:
- mvn test
build and publish docker image:
tags:
- argus
- docker-image
stage: container
image:
name: gcr.io/diamond-privreg/container-tools/kaniko-executor:v1.9.1-debug
entrypoint: [ "" ]
script:
- echo 'Building image...'
- env | grep "CI_"
- /bin/sh ./kanikobuild.sh
- echo "Done!"
only:
refs:
- tags
publish helm chart:
stage: helm chart
tags:
- argus
image:
name: gcr.io/diamond-pubreg/gda-core/nexus-helm-utils:latest
script:
- env | grep "CI_"
- nexus-push helm/${CI_PROJECT_NAME} ${CI_COMMIT_TAG} ${CI_CHART_REGISTRY}
only:
refs:
- tags
deploy:
variables:
INSTALLATION_NAME: subscriptions
NAMESPACE: fri44821
CHART: nexus/subscriptions
SECRET_NAME: fri44821-gitlab-runner-secret
tags:
- daq-cd
image:
name: gcr.io/diamond-pubreg/gda-core/nexus-helm-utils:latest
entrypoint: ["/bin/sh", "-c"]
before_script:
- export TOKEN=`kubectl -n=daq-gitlab-ci get secret ${SECRET_NAME} -o jsonpath='{.data.token}' | base64 -d`
- helm repo add nexus ${CI_CHART_REGISTRY}
script:
- env | grep "CI_"
- helm -n ${NAMESPACE} --kube-token ${TOKEN} upgrade --install --version ${CI_COMMIT_TAG} --set image.tag=latest ${INSTALLATION_NAME} ${CHART}
- kubectl -n ${NAMESPACE} --token ${TOKEN} rollout restart `kubectl -n ${NAMESPACE} --token ${TOKEN} get -o name deployment`
stage: deploy
only:
refs:
- tags