-
Notifications
You must be signed in to change notification settings - Fork 18
/
pipelines_demo.yml
394 lines (366 loc) · 11 KB
/
pipelines_demo.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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
resources:
- name: gosvc_code
type: GitRepo
configuration:
path: sdemo/go-service
gitProvider: sdemo
buildOn:
commit: true
pullRequestCreate: true
pullRequestClose: true
releaseCreate: true
tagCreate: true
- name: gosvc_build
type: BuildInfo
configuration:
sourceArtifactory: demo_art
- name: gosvc_tested_build
type: BuildInfo
configuration:
sourceArtifactory: demo_art
- name: gosvc_promoted_build
type: BuildInfo
configuration:
sourceArtifactory: demo_art
- name: backend_code
type: GitRepo
configuration:
path: sdemo/java-backend
gitProvider: sdemo
branches:
include: ^master$
- name: app_build
type: BuildInfo
configuration:
sourceArtifactory: demo_art
- name: app_tested_build
type: BuildInfo
configuration:
sourceArtifactory: demo_art
- name: app_promoted_build
type: BuildInfo
configuration:
sourceArtifactory: demo_art
- name: frontend_code
type: GitRepo
configuration:
path: sdemo/vue-frontend
gitProvider: sdemo
branches:
include: ^master$
- name: frontend_package
type: FileSpec
configuration:
sourceArtifactory: demo_art
pattern: "pip-npm-dev-local/frontend/-/frontend-3.0.0.tgz"
recursive: false
flat: true
- name: backend_package
type: FileSpec
configuration:
sourceArtifactory: demo_art
pattern: "libs-release-local/com/jfrog/backend/1.0.0/backend-1.0.0.jar"
recursive: false
flat: true
- name: app_release
type: ReleaseBundle
configuration:
sourceDistribution: int_distribution
name: app_rb
version: v1.0.0
- name: signed_app_release
type: ReleaseBundle
configuration:
sourceDistribution: int_distribution
name: app_rb
version: v1.0.0
- name: distribution_rules
type: DistributionRule
configuration:
sourceDistribution: int_distribution
serviceName: "*"
siteName: "*"
cityName: "*"
countryCodes:
- "*"
# - "GB"
#
# - name: deploy_vm
# type: VmCluster
# configuration:
# sshKey: demo_ssh
# targets:
# - 130.211.121.141
pipelines:
- name: gosvc_dev
steps:
- name: bld_svc
type: DockerBuild
configuration:
affinityGroup: dockerbuild
dockerFileLocation: .
dockerFileName: Dockerfile
dockerImageName: pipdemo.jfrog.io/pip-docker-dev-local/gosvc
dockerImageTag: ${run_number}
environmentVariables:
JFROG_CLI_BUILD_NAME: gosvc_build
inputResources:
- name: gosvc_code
integrations:
- name: demo_art
- name: push_svc
type: DockerPush
configuration:
affinityGroup: dockerbuild
targetRepository: pip-docker-dev-local
forceXrayScan: true
failOnScan: true
autoPublishBuildInfo: true
integrations:
- name: demo_art
inputSteps:
- name: bld_svc
outputResources:
- name: gosvc_build
- name: gosvc_test
steps:
- name: test_svc
type: Bash
configuration:
inputResources:
- name: gosvc_build
outputResources:
- name: gosvc_tested_build
execution:
onExecute:
- echo "testing docker image"
- replicate_resource gosvc_build gosvc_tested_build
- name: promote_svc_build
type: PromoteBuild
configuration:
targetRepository: pip-docker-test-local
integrations:
- name: demo_art
inputResources:
- name: gosvc_tested_build
outputResources:
- name: gosvc_promoted_build
- name: app_dev
configuration:
environmentVariables:
readOnly:
JFROG_CLI_BUILD_NAME: app_build
steps:
- name: bld_backend
type: MvnBuild
configuration:
resolverSnapshotRepo: libs-snapshot
resolverReleaseRepo: libs-release
deployerSnapshotRepo: libs-snapshot-local
deployerReleaseRepo: libs-release-local
mvnCommand: clean install -ntp
inputResources:
- name: backend_code
integrations:
- name: demo_art
outputResources:
- name: backend_package
runtime:
type: image
image:
auto:
language: java
versions:
- "11"
execution:
onStart:
- javac -version
- mvn --version
- name: bld_frontend
type: NpmBuild
configuration:
runtime:
type: image
image:
auto:
language: node
versions:
- "14"
affinityGroup: npmBuild
npmArgs: --no-progress --no-audit
sourceLocation: .
repositoryName: pip-npm-virtual
inputResources:
- name: frontend_code
integrations:
- name: demo_art
execution:
onComplete:
- cp -r $res_frontend_code_resourcePath $shared_workspace
- rm -rf $steplet_run_state_dir/npmBuildInputGitRepo
- name: pblsh_frontend
type: Bash
configuration:
runtime:
type: image
image:
auto:
language: node
versions:
- "14"
affinityGroup: npmBuild
inputSteps:
- name: bld_frontend
outputResources:
- name: frontend_package
integrations:
- name: demo_art
execution:
onStart:
# - export tempStateLocation="$step_tmp_dir/npmSourceState"
# - restore_run_files npmBuildInputGitRepo $tempStateLocation
- pushd $shared_workspace/frontend_code
- npm update
- npm run build
# - add_run_files $tempStateLocation/. npmBuildInputGitRepo
- jfrog rt npm-config --repo-deploy pip-npm-dev-local --server-id-deploy demo_art
- jfrog rt npm-publish --detailed-summary
#
# - name: publish_frontend
# type: NpmPublish
# configuration:
# affinityGroup: npmBuild
# repositoryName: pip-npm-dev-local
# inputSteps:
# - name: pack_frontend
# integrations:
# - name: demo_art
# execution:
# onStart:
# - export inputNpmBuildStepName="bld_frontend"
- name: build_app
type: Bash
configuration:
environmentVariables:
dockerImageName: pipdemo.jfrog.io/pip-docker-dev-local/app
dockerImageTag: ${run_number}
inputResources:
- name: backend_code
trigger: false
- name: frontend_package
- name: backend_package
integrations:
- name: demo_art
execution:
onStart:
- rm -rf $run_dir/workspace/jfrog
- add_run_variables buildStepName=${step_name}
- add_run_variables ${step_name}_buildNumber=${run_number}
- add_run_variables ${step_name}_buildName=${pipeline_name}
onExecute:
- pushd $res_backend_code_resourcePath
- cp $res_frontend_package_resourcePath/frontend-3.0.0.tgz ./client.tgz
- cp $res_backend_package_resourcePath/backend-1.0.0.jar ./server.jar
- docker build --pull --no-cache -t $dockerImageName:$dockerImageTag --build-arg REGISTRY=${int_demo_art_url} .
onSuccess:
- jfrog rt bce $pipeline_name $run_number
- jfrog rt docker-push $dockerImageName:$dockerImageTag pip-docker-dev-local --build-name=$pipeline_name --build-number=$run_number
- add_run_files /tmp/jfrog/. jfrog
- name: publish_app_build
type: PublishBuildInfo
configuration:
inputSteps:
- name: build_app
outputResources:
- name: app_build
#
# - name: promote_app_build
# type: PromoteBuild
# configuration:
# targetRepository: docker
# integrations:
# - name: demo_art
# inputResources:
# - name: appl_build_info
# outputResources:
# - name: appl_promoted_build_info
- name: app_test
steps:
- name: test_app
type: Bash
configuration:
inputResources:
- name: app_build
outputResources:
- name: app_tested_build
execution:
onExecute:
- echo "testing docker image"
- replicate_resource app_build app_tested_build
- name: promote_app_build
type: PromoteBuild
configuration:
targetRepository: pip-docker-test-local
integrations:
- name: demo_art
inputResources:
- name: app_tested_build
outputResources:
- name: app_promoted_build
- name: release_application
steps:
- name: create_app_bundle
type: CreateReleaseBundle
configuration:
releaseBundleName: app_rb
releaseBundleVersion: v1.0.${run_number}
dryRun: false
sign: false
description: "some random test description"
inputResources:
- name: gosvc_promoted_build
trigger: false
- name: app_promoted_build
trigger: false
outputResources:
- name: app_release
releaseNotes:
syntax: markdown
content: |
## Heading
* Bullet
* Points
- name: sign_app_bundle
type: SignReleaseBundle
configuration:
inputResources:
- name: app_release
outputResources:
- name: signed_app_release
- name: distribute_app_bundle
type: DistributeReleaseBundle
configuration:
dryRun: false
inputResources:
- name: signed_app_release
- name: distribution_rules
#
# - name: deploy
# type: Bash
# configuration:
# environmentVariables:
# docker_repository: docker
# artifactory_address: 35.222.179.206:8082
# integrations:
# - name: edge_art
# inputResources:
# - name: deploy_vm
# - name: gosvc_promoted_build_info
# trigger: false
# - name: appl_promoted_build_info
# trigger: false
# inputSteps:
# - name: distribute
# execution:
# onExecute:
# - ssh -i ~/.ssh/deploy_vm sdemo@${res_deploy_vm_targets_0} sudo /home/sdemo/deploy-to-prod-test.sh $artifactory_address $docker_repository $int_edge_art_apikey $res_appl_promoted_build_info_buildNumber $res_gosvc_promoted_build_info_buildNumber