-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitlab-ci.yml
100 lines (86 loc) · 2.53 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
stages:
- build
- docker
- publish
#--------------------------
# Build templates
#--------------------------
.build-template: &build-template_definition
stage: build
script:
- ci/fedora-packages.sh
- ci/common-rpm-build.sh
- mkdir ${CI_JOB_NAME}
- cp -rv build/RPMS build/SRPMS ${CI_JOB_NAME}
- tree ${CI_JOB_NAME}
variables:
BRANCH: ${CI_COMMIT_REF_NAME}
artifacts:
paths:
- "$CI_JOB_NAME"
#--------------------------
# Build jobs
#--------------------------
alma9:
image: gitlab-registry.cern.ch/linuxsupport/alma9-base
<<: *build-template_definition
#--------------------------
# Docker build templates
#--------------------------
.kaniko_build: &kaniko_build-template
stage: docker
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- if [[ -z "$CI_COMMIT_TAG" ]];
then CACHE="true"; REGISTRY="latest";
else CACHE="false"; REGISTRY="${CI_COMMIT_TAG}";
fi
- DESTINATION="gitlab-registry.cern.ch/fts/fts-monitoring:${REGISTRY}"
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --dockerfile ci/docker/Dockerfile-ci --context "${CI_PROJECT_DIR}" --cache=${CACHE} --destination ${DESTINATION}
retry: 1
#--------------------------
# Docker build jobs
#--------------------------
docker_build:
<<: *kaniko_build-template
needs:
- job: alma9
rules:
- if: $CI_COMMIT_REF_NAME == "develop"
docker_tag:
<<: *kaniko_build-template
needs:
- job: alma9
rules:
- if: $CI_COMMIT_TAG != null
#--------------------------
# Publish templates
#--------------------------
.publish-template: &publish-template_definition
stage: publish
image: gitlab-registry.cern.ch/eos/gitlab-eos/alma9:latest
dependencies:
- alma9
script:
- automount
- cat "$repo_passwd" | kinit "$repo_user"
- packaging/fts-repo-manager.py --action add --base /eos/workspace/f/fts/repo/www/repos/ --ref ${CI_COMMIT_REF_NAME} --arch-dir x86_64 --packages alma9/RPMS/*/*.rpm alma9/SRPMS/*
tags:
- docker-privileged-xl
retry: 2
#--------------------------
# Publish jobs
#--------------------------
rpms:
<<: *publish-template_definition
rules:
- if: '$CI_COMMIT_REF_NAME == "develop" || $CI_COMMIT_TAG!= null'
testing-rpms:
<<: *publish-template_definition
rules:
- if: '$CI_COMMIT_REF_NAME != "develop" && $CI_COMMIT_TAG == null'
when: manual