-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
120 lines (109 loc) · 2.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
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
include:
- project: 'AgileFactory/Witboost.Mesh/witboost.Mesh.CI'
ref: 'main'
file: 'common/witboost.helm.gitlab-ci.yml'
- template: Security/SAST.gitlab-ci.yml
stages:
- setup
- checkFormatting
- test
- build
- publish
# Generic SBT job
.sbtBase:
image: sbtscala/scala-sbt:eclipse-temurin-jammy-11.0.17_8_1.8.2_2.13.10
variables:
# sets cache dirs
SBT_OPTS: >-
-Dsbt.global.base=sbt-cache/sbtboot
-Dsbt.boot.directory=sbt-cache/boot
-Dsbt.coursier.home=sbt-cache/coursier
-Dsbt.ci=true
-Dsbt.color=always
cache:
key: "$CI_COMMIT_REF_SLUG-sbt"
paths:
- sbt-cache/
- project/target/
- project/project/
setup:
stage: setup
extends: .witboost.helm.base-job
cache: []
before_script: []
script:
- !reference [.witboost.helm.clone-scripts, script]
- !reference [.witboost.helm.get-version, script]
- echo "VERSION=${VERSION}" >> vars.env
artifacts:
reports:
dotenv: vars.env
witboost.helm.checks:
stage: checkFormatting
extends: .witboost.helm.base-job
before_script: []
cache: []
script:
- !reference [.witboost.helm.clone-scripts, script]
- !reference [.witboost.helm.checks, script]
variables:
CHART_FOLDER: helm
checkFormatting:
stage: checkFormatting
extends: .sbtBase
script:
- 'sbt scalafmtSbtCheck scalafmtCheck'
test:
stage: test
extends: .sbtBase
before_script:
- wget https://releases.hashicorp.com/terraform/1.5.7/terraform_1.5.7_linux_amd64.zip
- apt-get update
- apt-get install unzip -y
- unzip terraform_1.5.7_linux_amd64.zip -d /usr/local/bin/
- chmod +x /usr/local/bin/terraform
script:
- 'sbt clean coverage test coverageAggregate'
coverage: '/Statement coverage[A-Za-z\.*]\s*:\s*([^%]+)/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: 'target/scala-2.13/coverage-report/cobertura.xml'
universal:
stage: build
extends: .sbtBase
script:
- 'sbt stage'
artifacts:
name: "$CI_COMMIT_BRANCH"
paths:
- terraform/target/universal/stage/*
jar:
stage: publish
extends: .sbtBase
needs: ["checkFormatting","test"]
script:
- 'sbt publish'
docker:
stage: publish
image: docker:20.10.16
services:
- docker:20.10.16-dind
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$VERSION
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $IMAGE_TAG .
- docker push $IMAGE_TAG
witboost.helm.deploy:
stage: publish
before_script: []
cache: []
extends: .witboost.helm.deploy
needs:
- docker
only:
- master
- tags
- /(^release\/([0-9]+)\.([0-9]+))/