-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
160 lines (148 loc) · 4.51 KB
/
.gitlab-ci.yml
File metadata and controls
160 lines (148 loc) · 4.51 KB
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
stages:
- build
- package
- coverage
- publish
- release
variables:
MAVEN_CLI_OPTS: "--batch-mode --errors --no-transfer-progress --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true -Dmaven.repo.local=.m2/repository"
REPO_NAME: dcache-cta
# LB tests expect special DNS entries
before_script:
- |
echo "127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4" >> /etc/hosts
echo "::1 localhost localhost.localdomain localhost6 localhost6.localdomain6" >> /etc/hosts
build:
stage: build
image: maven:3.6.3-openjdk-11
# Cache downloaded dependencies and plugins between builds.
# To keep cache across branches add 'key: "$CI_JOB_NAME"'
cache:
key:
files:
- pom.xml
prefix: "$CI_JOB_NAME"
paths:
- ./.m2/repository
script:
- mvn $MAVEN_CLI_OPTS clean package
artifacts:
reports:
junit:
- "target/surefire-reports/TEST-*.xml"
- "target/failsafe-reports/TEST-*.xml"
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME"
paths:
- "target/dcache-cta*.tar.gz"
- "target/SPECS"
build_java_17:
stage: build
image: maven:3.8.4-openjdk-17
# Cache downloaded dependencies and plugins between builds.
# To keep cache across branches add 'key: "$CI_JOB_NAME"'
cache:
key:
files:
- pom.xml
prefix: "$CI_JOB_NAME"
paths:
- ./.m2/repository
script:
- mvn $MAVEN_CLI_OPTS clean package
artifacts:
reports:
junit:
- "target/surefire-reports/TEST-*.xml"
- "target/failsafe-reports/TEST-*.xml"
build_java_21:
stage: build
image: maven:3.9-eclipse-temurin-21
# Cache downloaded dependencies and plugins between builds.
# To keep cache across branches add 'key: "$CI_JOB_NAME"'
cache:
key:
files:
- pom.xml
prefix: "$CI_JOB_NAME"
paths:
- ./.m2/repository
script:
- mvn $MAVEN_CLI_OPTS clean package
artifacts:
reports:
junit:
- "target/surefire-reports/TEST-*.xml"
- "target/failsafe-reports/TEST-*.xml"
package_rpm:
stage: package
dependencies:
- build
image: almalinux:9
script:
- echo $DCACHE_ORG_PGP_KEY | base64 -d -i > secret.gpg
- gpg --quiet --batch --yes --allow-secret-key-import --passphrase="$DCACHE_ORG_PGP_KEY_PASS" --import secret.gpg
- gpg -k
- gpg -a --export "$DCACHE_ORG_KEY_NAME" > RPM-GPG-KEY
- dnf install -y rpm-build rpm-sign
- mkdir -p rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
- cp target/dcache-cta*.tar.gz rpmbuild/SOURCES
- rpmbuild -ba --define "_topdir `pwd`/rpmbuild" target/SPECS/dcache-cta.spec
- rpmsign --addsign --define "_signature gpg" --define "_gpg_name $DCACHE_ORG_KEY_NAME" --define "_gpg_sign_cmd_extra_args --pinentry-mode loopback --passphrase $DCACHE_ORG_PGP_KEY_PASS" rpmbuild/RPMS/noarch/dcache-cta-*
- rpmkeys --import RPM-GPG-KEY
- rpm --checksig -v rpmbuild/RPMS/noarch/dcache-cta-*
artifacts:
paths:
- rpmbuild/RPMS/noarch/dcache-cta-*
publish_tar:
only:
- tags
stage: publish
image: almalinux:9-minimal
script:
- PACKAGE=$(ls -1 target/dcache-cta*.tar.gz)
- PACKAGENAME=$(basename ${PACKAGE})
- VERSION_1=${PACKAGENAME##*-}
- VERSION=${VERSION_1%.tar.gz}
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ${PACKAGE} ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/v${VERSION}/${PACKAGENAME}'
publish_rpm:
only:
- tags
stage: publish
dependencies:
- package_rpm
image: almalinux:9-minimal
script:
- PACKAGE=$(ls -1 rpmbuild/RPMS/noarch/dcache-cta-*)
- 'curl -sS -u ${YUM_REPO_USER}:${YUM_REPO_PASS} --upload-file ${PACKAGE} ${YUM_REPO_URL}/`basename ${PACKAGE}`'
- echo DOWNLOAD_URL=${YUM_REPO_URL}/`basename ${PACKAGE}` > download_url.env
artifacts:
reports:
dotenv: download_url.env
release_job:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
only:
- tags
script:
- echo "Running the release job."
needs:
- publish_rpm
release:
tag_name: $CI_COMMIT_TAG
name: 'Release $CI_COMMIT_TAG'
description: 'Release $CI_COMMIT_TAG.'
assets:
links:
- name: 'rpm'
url: '$DOWNLOAD_URL'
# requires gitlab 17.6 or later
coverage:
stage: build
image: maven:3.6.3-openjdk-11
script:
- mvn $MAVEN_CLI_OPTS clean org.jacoco:jacoco-maven-plugin:prepare-agent test jacoco:report
artifacts:
reports:
coverage_report:
coverage_format: jacoco
path: target/site/jacoco/jacoco.xml