This repository was archived by the owner on Jul 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
198 lines (175 loc) · 7.83 KB
/
.gitlab-ci.yml
File metadata and controls
198 lines (175 loc) · 7.83 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# GIT_STRATEGY: none Clone manually as a resolution of https clone is not available, and runner can't do ssh clone automatically
# Issue 3378 Uploading untracked artifacts includes ignored files, see: https://gitlab.com/gitlab-org/gitlab-runner/issues/3378
# Issue 4072 artifacts ignore paths , see: https://gitlab.com/gitlab-org/gitlab-ce/issues/4072
#image: openjdk:8
cache:
key: ${CI_PROJECT_ID}
paths:
- .m2/repository
- .m2/wrapper
.git_refs_develop_only: &git_refs_develop_only
only:
- develop
.git_refs_of_snapshots: &git_refs_of_snapshots
except:
- master
- /^hotfix\/.+$/
- /^release\/.+$/
- /^support\/.*$/
- /^v\d+\.\d+(\.\d+)?(-\S*)?/
.git_refs_of_releases: &git_refs_of_releases
only:
- /^hotfix\/.+$/
- /^release\/.+$/
- /^support\/.*$/
#- temp
.script_build: &script_build
script:
- |
if [[ -z "${CI_OPT_MAVEN_EFFECTIVE_POM}" ]]; then export CI_OPT_MAVEN_EFFECTIVE_POM="true"; fi;
time ./mvnw ${MAVEN_GLOBAL_SETTINGS} -e -ntp -U -Dmaven.javadoc.skip=true -Dmaven.source.skip=true clean verify;
if type -p column > /dev/null; then find .mvn/profiler-report -name "*.json" | xargs cat | jq -r '.projects[]|"module:", .project, "plugins", (.mojos[]|[.mojo,.time]|@tsv)' | column -t; fi; rm -rf .mvn/profiler-report;
echo archive $(git ls-files -o | grep -Ev '.+-exec\.jar' | grep -v 'profiler-report' | grep -v '.m2' | grep -v 'untracked.tar.gz' | grep -v 'untracked.zip' | wc -l) files into archive;
if type -p zip > /dev/null && type -p unzip > /dev/null; then
git ls-files -o | grep -Ev '.+-exec\.jar' | grep -v 'profiler-report' | grep -v '.m2' | grep -v 'untracked.tar.gz' | grep -v 'untracked.zip' | zip -P ${ARCHIVE_PASS:-pass} untracked.zip -@;
else
git ls-files -o | grep -Ev '.+-exec\.jar' | grep -v 'profiler-report' | grep -v '.m2' | grep -v 'untracked.tar.gz' | grep -v 'untracked.zip' | tar -czf untracked.tar.gz -T -;
fi;
.script_publish: &script_publish
script:
# force publish on temp branch push
#- export CI_OPT_PUBLISH_TO_REPO="true";
- |
if type -p zip > /dev/null && type -p unzip > /dev/null; then
if [ -f untracked.zip ]; then unzip -P ${ARCHIVE_PASS:-pass} untracked.zip; fi; ls -ahl;
else
if [ -f untracked.tar.gz ]; then tar -xzf untracked.tar.gz; fi; ls -ahl;
fi;
time CI_OPT_FAST="true" ./mvnw ${MAVEN_GLOBAL_SETTINGS} -e -ntp -U deploy;
if type -p column > /dev/null; then find .mvn/profiler-report -name "*.json" | xargs cat | jq -r '.projects[]|"module:", .project, "plugins", (.mojos[]|[.mojo,.time]|@tsv)' | column -t; fi; rm -rf .mvn/profiler-report;
time CI_OPT_FAST="true" CI_OPT_INFRASTRUCTURE="custom" CI_OPT_NEXUS2_STAGING="false" ./mvnw ${MAVEN_GLOBAL_SETTINGS} -e -ntp deploy;
if type -p column > /dev/null; then find .mvn/profiler-report -name "*.json" | xargs cat | jq -r '.projects[]|"module:", .project, "plugins", (.mojos[]|[.mojo,.time]|@tsv)' | column -t; fi; rm -rf .mvn/profiler-report;
if type -p zip > /dev/null && type -p unzip > /dev/null; then
git ls-files -o | grep -Ev '.+-exec\.jar' | grep -v 'profiler-report' | grep -v '.m2' | grep -v 'untracked.tar.gz' | grep -v 'untracked.zip' | zip -P ${ARCHIVE_PASS:-pass} untracked.zip -@;
else
git ls-files -o | grep -Ev '.+-exec\.jar' | grep -v 'profiler-report' | grep -v '.m2' | grep -v 'untracked.tar.gz' | grep -v 'untracked.zip' | tar -czf untracked.tar.gz -T -;
fi;
.script_site: &script_site
script:
- |
if type -p zip > /dev/null && type -p unzip > /dev/null; then
if [ -f untracked.zip ]; then unzip -P ${ARCHIVE_PASS:-pass} untracked.zip; fi; ls -ahl;
else
if [ -f untracked.tar.gz ]; then tar -xzf untracked.tar.gz; fi; ls -ahl;
fi;
time ./mvnw ${MAVEN_GLOBAL_SETTINGS} -e -ntp site-deploy;
if type -p column > /dev/null; then find .mvn/profiler-report -name "*.json" | xargs cat | jq -r '.projects[]|"module:", .project, "plugins", (.mojos[]|[.mojo,.time]|@tsv)' | column -t; fi; rm -rf .mvn/profiler-report;
.upload_files_for_latter_stages: &upload_files_for_latter_stages
artifacts:
expire_in: 1 day
paths:
- untracked.zip
- untracked.tar.gz
before_script:
- if [ -f ~/env ]; then source ~/env; fi;
- set -ex;
# info
- |
echo "HOST_HOSTNAME '${HOST_HOSTNAME}', HOST_IPADDRESS '${HOST_IPADDRESS}'";
echo working directory `pwd`;
echo CI_PROJECT_URL ${CI_PROJECT_URL} CI_COMMIT_REF_NAME ${CI_COMMIT_REF_NAME}, CI_COMMIT_SHA ${CI_COMMIT_SHA}, CI_PROJECT_NAME ${CI_PROJECT_NAME}, CI_PROJECT_NAMESPACE ${CI_PROJECT_NAMESPACE};
# environment variables
# Settings -> CI / CD -> Variables -> Expand -> Save Variables
# CI_OPT_GPG_PASSPHRASE
# CI_OPT_ORIGIN_REPO_SLUG
# CI_OPT_OSSRH_DOCKER_REGISTRY_PASS
# CI_OPT_OSSRH_DOCKER_REGISTRY_USER
# CI_OPT_OSSRH_GIT_AUTH_TOKEN
# CI_OPT_OSSRH_MVNSITE_PASSWORD
# CI_OPT_OSSRH_MVNSITE_USERNAME
# CI_OPT_OSSRH_NEXUS2_PASS
# CI_OPT_OSSRH_NEXUS2_USER
# CI_OPT_OSSRH_SONAR_LOGIN
- |
if [[ "$(whoami)" == "root" ]] && [[ ! -d /usr/lib/jvm/java-8-openjdk ]] && [[ -d /usr/local/openjdk-8 ]]; then mkdir -p /usr/lib/jvm; ln -s /usr/local/openjdk-8 /usr/lib/jvm/java-8-openjdk; fi;
if [[ "$(whoami)" == "root" ]] && [[ ! -d /usr/lib/jvm/java-11-openjdk ]] && [[ -d /usr/local/openjdk-11 ]]; then mkdir -p /usr/lib/jvm; ln -s /usr/local/openjdk-11 /usr/lib/jvm/java-11-openjdk; fi;
if [[ "$(whoami)" == "root" ]] && [[ ! -d /usr/lib/jvm/java-11-openjdk ]] && [[ -d /docker-java-home ]]; then mkdir -p /usr/lib/jvm; ln -s /docker-java-home /usr/lib/jvm/java-11-openjdk; fi;
- |
export CI_OPT_MVN_MULTI_STAGE_BUILD="true";
source circ.sh;
#- |
# export MAVEN_GLOBAL_SETTINGS="--global-settings ${SETTINGS_GLOBAL_XML}";
- |
if [[ -z "${MAVEN_OPTS}" ]]; then export MAVEN_OPTS="-XX:+UseParallelGC -Dmaven.repo.local=.m2/repository -Dprofile=title -DprofileFormat=JSON,HTML"; fi;
if [[ -d ${HOME}/.m2 ]]; then rm -rf ${HOME}/.m2/repository/top/infra/maven; ls -ahl ${HOME}/.m2; fi;
export MAVEN_USER_HOME="${PWD}/.m2";
./mvnw ${MAVEN_GLOBAL_SETTINGS} -version;
build_snapshots:
<<: *git_refs_of_snapshots
<<: *script_build
<<: *upload_files_for_latter_stages
stage: build
variables:
GIT_STRATEGY: fetch
analysis:
dependencies:
- build_snapshots
<<: *git_refs_develop_only
stage: analysis
script:
- |
if type -p zip > /dev/null && type -p unzip > /dev/null; then
if [ -f untracked.zip ]; then unzip -P ${ARCHIVE_PASS:-pass} untracked.zip; fi; ls -ahl;
else
if [ -f untracked.tar.gz ]; then tar -xzf untracked.tar.gz; fi; ls -ahl;
fi;
time ./mvnw ${MAVEN_GLOBAL_SETTINGS} -e -ntp sonar:sonar;
if type -p column > /dev/null; then find .mvn/profiler-report -name "*.json" | xargs cat | jq -r '.projects[]|"module:", .project, "plugins", (.mojos[]|[.mojo,.time]|@tsv)' | column -t; fi; rm -rf .mvn/profiler-report;
variables:
GIT_STRATEGY: fetch
publish_snapshots:
dependencies:
- build_snapshots
<<: *git_refs_of_snapshots
<<: *script_publish
<<: *upload_files_for_latter_stages
stage: publish
variables:
GIT_STRATEGY: fetch
site_snapshots:
dependencies:
- publish_snapshots
<<: *git_refs_develop_only
<<: *script_site
stage: site
variables:
GIT_STRATEGY: fetch
build_releases:
<<: *git_refs_of_releases
<<: *script_build
<<: *upload_files_for_latter_stages
stage: build
variables:
GIT_STRATEGY: fetch
publish_releases:
dependencies:
- build_releases
<<: *git_refs_of_releases
<<: *script_publish
<<: *upload_files_for_latter_stages
stage: publish
variables:
GIT_STRATEGY: fetch
site_releases:
dependencies:
- publish_releases
<<: *git_refs_of_releases
<<: *script_site
stage: site
variables:
GIT_STRATEGY: fetch
stages:
- build
- analysis
- publish
- site