-
Notifications
You must be signed in to change notification settings - Fork 69
/
config.yml
253 lines (242 loc) · 9.94 KB
/
config.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
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# Java Gradle CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-java/ for more details
#
version: 2.1
# ###############################################################
# Commands
commands:
attach_repo:
steps:
- attach_workspace:
at: ~/inspectit
build_and_test_agent:
steps:
- run: cd repo && ./gradlew assemble --max-workers=2 --no-daemon
- run: cd repo && ./gradlew test --max-workers=2 --no-daemon
- run: cd repo && ./gradlew systemTest --max-workers=2 --no-daemon
- store_test_results:
path: ~/inspectit/repo/inspectit-ocelot-agent/build/test-results
- store_test_results:
path: ~/inspectit/repo/inspectit-ocelot-core/build/test-results
- store_test_results:
path: ~/inspectit/repo/inspectit-ocelot-config/build/test-results
- store_test_results:
path: ~/inspectit/repo/components/inspectit-ocelot-configurationserver/build/test-results
- store_test_results:
path: ~/inspectit/repo/components/inspectit-ocelot-eum-server/build/test-results
- store_artifacts:
path: /home/circleci/inspectit/repo/heapdump.bin
# ###############################################################
# Jobs
jobs:
# Job for checking out the source code to build and test
checkout:
docker:
- image: circleci/openjdk:8-jdk
working_directory: ~/inspectit
steps:
- checkout:
path: ~/inspectit/repo
- persist_to_workspace:
root: ~/inspectit
paths:
- repo
# Building the release artifacts (agent and demo)
build_release_artifacts:
docker:
- image: circleci/openjdk:8-jdk
working_directory: ~/inspectit
steps:
- attach_repo
- run: cd repo && ./gradlew assemble bootJarWithFrontend packageDemo :inspectit-ocelot-core:cyclonedxBom :inspectit-ocelot-configurationserver:cyclonedxBom :inspectit-ocelot-eum-server:cyclonedxBom :inspectit-ocelot-eum-server:bootJar -PbuildVersion=${CIRCLE_TAG}
- run: mkdir artifacts
- run: cp ~/inspectit/repo/inspectit-ocelot-agent/build/inspectit-ocelot-agent-${CIRCLE_TAG}.jar ~/inspectit/artifacts
- run: cp ~/inspectit/repo/inspectit-ocelot-demo/build/inspectit-ocelot-demo-${CIRCLE_TAG}.zip ~/inspectit/artifacts
- run: cp ~/inspectit/repo/components/inspectit-ocelot-configurationserver/build/libs/inspectit-ocelot-configurationserver-${CIRCLE_TAG}.jar ~/inspectit/artifacts
- run: cp ~/inspectit/repo/components/inspectit-ocelot-eum-server/build/libs/inspectit-ocelot-eum-server-${CIRCLE_TAG}.jar ~/inspectit/artifacts
- run: cp ~/inspectit/repo/inspectit-ocelot-core/build/reports/bom.json ~/inspectit/artifacts/inspectit-ocelot-agent-bom.json
- run: cp ~/inspectit/repo/inspectit-ocelot-core/build/reports/bom.xml ~/inspectit/artifacts/inspectit-ocelot-agent-bom.xml
- run: cp ~/inspectit/repo/components/inspectit-ocelot-configurationserver/build/reports/bom.json ~/inspectit/artifacts/inspectit-ocelot-configurationserver-bom.json
- run: cp ~/inspectit/repo/components/inspectit-ocelot-configurationserver/build/reports/bom.xml ~/inspectit/artifacts/inspectit-ocelot-configurationserver-bom.xml
- run: cp ~/inspectit/repo/components/inspectit-ocelot-eum-server/build/reports/bom.json ~/inspectit/artifacts/inspectit-ocelot-eum-server-bom.json
- run: cp ~/inspectit/repo/components/inspectit-ocelot-eum-server/build/reports/bom.xml ~/inspectit/artifacts/inspectit-ocelot-eum-server-bom.xml
- run:
name: Calculate checksums of release artifacts
working_directory: ~/inspectit/artifacts
command: for f in *; do sha256sum "$f" >> inspectit-ocelot-sha256-checksums.txt; done
- persist_to_workspace:
root: ~/inspectit
paths:
- artifacts
# Generates the changelog body sued for the Github release
generate_changelog:
docker:
- image: circleci/ruby:3.0
working_directory: ~/inspectit
steps:
- attach_repo
- run:
command: |
sudo apt-get install jq
gem install bundler
gem install rspec
gem install github_changelog_generator
cd repo
chmod +x ./resources/github-release-script.sh
./resources/github-release-script.sh
mkdir ~/inspectit/changelog
cp release_body.md ~/inspectit/changelog
- persist_to_workspace:
root: ~/inspectit
paths:
- changelog
# Publish the release artifacts to Github and updates the release
publish_github_release:
docker:
- image: cibuilds/github:0.12
working_directory: ~/inspectit
steps:
- attach_repo
- run:
name: "Publish Release on GitHub"
command: |
VERSION=${CIRCLE_TAG}
BODY=$(cat ~/inspectit/changelog/release_body.md)
ghr -t ${GITHUB_TOKEN} -u inspectIT -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -n "Version ${CIRCLE_TAG}" -b "${BODY}" ${VERSION} ~/inspectit/artifacts/
# Publish docker images
publish_docker_images:
docker:
- image: circleci/openjdk:8-jdk
working_directory: ~/inspectit
steps:
- attach_repo
- run: cd repo && ./gradlew dockerTag -PbuildVersion=${CIRCLE_TAG}
- run: docker login -u $DOCKER_HUB_USER -p $DOCKER_HUB_PASSWORD
- run: docker push
publish_dashboards_to_marketplace:
docker:
- image: circleci/openjdk:8-jdk
working_directory: ~/inspectit/repo/inspectit-ocelot-demo/grafana/marketplace
steps:
- run:
command: |
chmod +x ~/inspectit/repo/resources/upload-all-dashboards.sh
~/inspectit/repo/resources/upload-all-dashboards.sh
# Deploy pre-release documentation
deploy-master-documentation:
docker:
- image: cimg/node:15.0.1
working_directory: ~/inspectit
steps:
- attach_repo
- run:
name: Deploying to GitHub Pages
working_directory: ~/inspectit/repo/inspectit-ocelot-documentation/website
command: |
git config --global user.email "NTTechnicalUser@users.noreply.github.com"
git config --global user.name "NTTechnicalUser"
echo "machine github.com login NTTechnicalUser password $GITHUB_TOKEN" > ~/.netrc
npm install && GIT_USER=NTTechnicalUser CUSTOM_COMMIT_MESSAGE="[skip ci] Updated master documentation." npm run publish-gh-pages
# Deploy pre-release documentation
deploy-release-documentation:
docker:
- image: cimg/node:15.0.1
working_directory: ~/inspectit
steps:
- run:
name: Avoid hosts unknown for github
command: mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
- add_ssh_keys:
fingerprints:
- "9e:4e:80:f7:6b:34:39:48:88:02:f6:ff:40:c3:30:4c"
- run:
name: GitHub Login
command: |
git config --global user.email "NTTechnicalUser@users.noreply.github.com"
git config --global user.name "NTTechnicalUser"
git config --global push.default simple
echo "machine github.com login NTTechnicalUser password $GITHUB_TOKEN" > ~/.netrc
- run:
name: Checkout latest master branch for documentation
working_directory: ~/inspectit
command: |
git clone git@github.com:inspectIT/inspectit-ocelot.git .
- run:
name: Replace variables
working_directory: ~/inspectit/inspectit-ocelot-documentation/docs
command: |
find . -type f -print0 | xargs -0 sed -i 's/{inspectit-ocelot-version}/'"${CIRCLE_TAG}"'/g'
OPEN_CENSUS_VERSION=$(cat ../../gradle.properties | grep -oP '(?<=openCensusVersion=).*')
find . -type f -print0 | xargs -0 sed -i 's/{opencensus-version}/'"${OPEN_CENSUS_VERSION}"'/g'
- run:
name: Create new documentation version
working_directory: ~/inspectit/inspectit-ocelot-documentation/website
command: |
npm install
npm run version ${CIRCLE_TAG}
git add versions.json versioned_docs versioned_sidebars
git commit -m "[skip ci] Publish documentation v${CIRCLE_TAG}"
git push
GIT_USER=NTTechnicalUser CUSTOM_COMMIT_MESSAGE="[skip ci] Publish documentation v${CIRCLE_TAG}" npm run publish-gh-pages
# ###############################################
# The defined workflows
workflows:
version: 2
# Workflow for deploying master documentation
deploy_documentation:
jobs:
- checkout
- deploy-master-documentation:
requires:
- checkout
filters:
branches:
only: master
# Workflow for building and deploying releases based on tagged commits
# Note: you have to manually approve the workflow on CircleCI
release:
jobs:
- requesting-release-build:
type: approval
filters: &filter_release
branches:
ignore: /.*/
tags:
only: /\d+\.\d+(\..+)?/
- checkout:
filters:
<<: *filter_release
requires:
- requesting-release-build
- deploy-release-documentation:
filters:
<<: *filter_release
requires:
- checkout
- build_release_artifacts:
filters:
<<: *filter_release
requires:
- checkout
- generate_changelog:
filters:
<<: *filter_release
requires:
- checkout
- publish_dashboards_to_marketplace:
filters:
<<: *filter_release
requires:
- checkout
- publish_github_release:
filters:
<<: *filter_release
requires:
- build_release_artifacts
- generate_changelog
- publish_docker_images:
filters:
<<: *filter_release
requires:
- publish_github_release