This repository has been archived by the owner on Jan 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
74 lines (65 loc) · 1.58 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
---
image: clojure:openjdk-16-tools-deps-slim-buster
# Due to a GitLab bug we need to extend the cache for each job
# rather than rely on a top level cache with a per job policy.
# https://gitlab.com/gitlab-org/gitlab-runner/issues/2838
.cache:
cache:
key: "${CI_COMMIT_REF_NAME}"
paths:
- .cpcache/
- /root/.m2/
policy: pull-push
stages:
- test
- package
- publish
variables:
DOCKER_TLS_CERTDIR: "/certs"
services:
- docker:19.03.12-dind
test:
extends: .cache
stage: test
script:
- clojure -Sdeps "${DEPS}" -M:test -m kaocha.runner
cache:
policy: pull
package:
extends: .cache
stage: package
script:
- clojure -X:uberjar
cache:
policy: pull
artifacts:
paths:
- app.jar
expire_in: 1 day
publish:
extends: .cache
stage: publish
dependencies:
- package
image: docker:latest
variables:
DOCKER_CONFIG: /root/.docker
IMAGE: $DOCKER_REGISTRY/$CI_PROJECT_PATH
JVM_TAG: openjdk-16-tools-deps-slim-buster
JMX_EXPORTER_VERSION: 0.15.0
before_script:
- mkdir -p $DOCKER_CONFIG
- echo "$DOCKER_AUTH_CONFIG" > $DOCKER_CONFIG/config.json
- export TAG=$(echo -en ${CI_COMMIT_REF_NAME#rel/} | tr -c '[:alnum:]_.-' '-')
script:
- docker build --pull --cache-from $IMAGE:latest --tag "$IMAGE:$TAG" --tag "$IMAGE:latest" --build-arg JVM_TAG=$JVM_TAG --build-arg JMX_EXPORTER_VERSION=$JMX_EXPORTER_VERSION -f scripts/docker/Dockerfile .
- docker push "$IMAGE:$TAG"
- docker push "$IMAGE:latest"
cache:
policy: pull
only:
- /^rel\//
except:
- branches
tags:
- docker