-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
82 lines (77 loc) · 2.06 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
workflow:
rules:
- if: '$CI_COMMIT_BRANCH == "main"'
when: always
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/'
when: always
- when: never
default:
tags:
- docker
stages:
- build
- publish
build_job:
stage: build
image: registry.esss.lu.se/ecdc/ess-dmsc/build-nodes/ubuntu2204:1.0
script:
- mkdir -p build
- cd build
- conan remote add --insert 0 --force ecdc-conan-external https://artifactory.esss.lu.se/artifactory/api/conan/ecdc-conan-external
- conan install ..
- cmake ..
- make
artifacts:
paths:
- build/bin
- build/lib
- build/licenses
expire_in: 1 week
publish_docker_job:
stage: publish
image: "docker:20.10"
dependencies:
- build_job
services:
- docker:dind
before_script:
- |
docker login \
-u "$CI_REGISTRY_USER" \
-p "$CI_REGISTRY_PASSWORD" \
"$CI_REGISTRY"
script:
# Determine the Docker tag based on the branch or tag
- |
if [[ "$CI_COMMIT_BRANCH" == "main" ]]; then
DOCKER_TAG="latest"
elif [[ -n "$CI_COMMIT_TAG" ]]; then
DOCKER_TAG="$CI_COMMIT_TAG"
else
echo "Not on master or tag, skipping Docker publish."
exit 1
fi
- |
docker build \
--build-arg https_proxy="http://172.20.72.11:8888" \
--build-arg http_proxy="http://172.20.72.11:8888" \
-t registry.esss.lu.se/ecdc/ess-dmsc/daqlite:$DOCKER_TAG \
-f .ci/docker/Dockerfile.deploy .
- docker push registry.esss.lu.se/ecdc/ess-dmsc/daqlite:$DOCKER_TAG
publish_tar_job:
stage: publish
image: alpine:latest
dependencies:
- build_job
artifacts:
paths:
- daqlite-ubuntu2204.tar.gz
script:
- apk update
- apk add --no-cache bash tar
- mkdir -p archive/daqlite-ubuntu2204
- cp -r build/bin archive/daqlite-ubuntu2204
- cp -r build/lib archive/daqlite-ubuntu2204
- cp -r scripts archive/daqlite-ubuntu2204
- cp -r configs archive/daqlite-ubuntu2204
- tar czvf daqlite-ubuntu2204.tar.gz archive/daqlite-ubuntu2204