forked from sdemo/pipelines
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pipelines.yml
294 lines (269 loc) · 8.27 KB
/
pipelines.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
resources:
- name: gosvc_gitRepo
type: GitRepo
configuration:
path: sdemo/go-service
gitProvider: demo_github
- name: gosvc_build_info
type: BuildInfo
configuration:
sourceArtifactory: demo_art
buildName: svc_build
buildNumber: 1
- name: gosvc_promoted_build_info
type: BuildInfo
configuration:
sourceArtifactory: demo_art
buildName: svc_build
buildNumber: 1
- name: be_gitRepo
type: GitRepo
configuration:
path: sdemo/java-backend
gitProvider: demo_github
- name: appl_build_info_output
type: BuildInfo
configuration:
sourceArtifactory: demo_art
buildName: backend_build
buildNumber: 1
- name: appl_build_info
type: BuildInfo
configuration:
sourceArtifactory: demo_art
buildName: backend_build
buildNumber: 1
- name: appl_promoted_build_info
type: BuildInfo
configuration:
sourceArtifactory: demo_art
buildName: backend_build
buildNumber: 1
- name: fe_gitRepo
type: GitRepo
configuration:
path: sdemo/vue-frontend
gitProvider: demo_github
# - name: release_bundle
# type: ReleaseBundle
# configuration:
# sourceDistribution: demoDist
# name: demo_rb
# version: v1.0.0
# - name: signed_bundle
# type: ReleaseBundle
# configuration:
# sourceDistribution: demoDist
# name: demo_rb
# version: v1.0.0
# - name: distribution_rules
# type: DistributionRule
# configuration:
# sourceDistribution: demoDist
# serviceName: "*"
# siteName: "*"
# cityName: "*"
# countryCodes:
# - "CN"
# - "GB"
# - name: deploy_vm
# type: VmCluster
# configuration:
# sshKey: demo_ssh
# targets:
# - 130.211.121.141
pipelines:
- name: demo_gosvc
steps:
- name: bld_svc
type: DockerBuild
configuration:
dockerFileLocation: .
dockerFileName: Dockerfile
dockerImageName: avinci-docker-local.jfrog.io/gosvc
dockerImageTag: ${run_number}
inputResources:
- name: gosvc_gitRepo
integrations:
- name: demo_art
- name: push_svc
type: DockerPush
configuration:
targetRepository: docker-local
#forceXrayScan: true
autoPublishBuildInfo: true
integrations:
- name: demo_art
inputSteps:
- name: bld_svc
outputResources:
- name: gosvc_build_info
- name: promote_svc_build
type: PromoteBuild
configuration:
targetRepository: docker
integrations:
- name: demo_art
inputResources:
- name: gosvc_build_info
outputResources:
- name: gosvc_promoted_build_info
- name: demo_application
steps:
- name: bld_backend
type: MvnBuild
configuration:
sourceLocation: .
mvnCommand: clean install -ntp
configFileLocation: .
configFileName: mvn-art-config
inputResources:
- name: be_gitRepo
integrations:
- name: demo_art
runtime:
type: image
image:
auto:
language: java
versions:
- "11"
execution:
onStart:
- javac -version
- mvn --version
- name: bld_frontend
type: NpmBuild
configuration:
npmArgs: --no-progress --no-audit
sourceLocation: .
repositoryName: npm-local
inputResources:
- name: fe_gitRepo
integrations:
- name: demo_art
- name: pack_frontend
type: Bash
configuration:
inputSteps:
- name: bld_frontend
integrations:
- name: demo_art
execution:
onStart:
- export tempStateLocation="$step_tmp_dir/npmSourceState"
- restore_run_files npmBuildInputGitRepo $tempStateLocation
- pushd $tempStateLocation
- npm run build
- add_run_files $tempStateLocation/. npmBuildInputGitRepo
- name: publish_frontend
type: NpmPublish
configuration:
repositoryName: npm-local
inputSteps:
- name: pack_frontend
integrations:
- name: demo_art
execution:
onStart:
- export inputNpmBuildStepName="bld_frontend"
- name: build_app
type: Bash
configuration:
environmentVariables:
dockerImageName: avinci-docker-local.jfrog.io/app
dockerImageTag: ${run_number}
inputResources:
- name: be_gitRepo
trigger: false
inputSteps:
- name: bld_backend
- name: publish_frontend
integrations:
- name: demo_art
execution:
onStart:
- rm -rf $run_dir/workspace/jfrog
- retry_command jfrog rt config --url $int_demoArt_url --user $int_demoArt_user --apikey $int_demoArt_apikey --interactive=false
- pushd $res_be_gitRepo_resourcePath
- add_run_variables buildStepName=${step_name}
- add_run_variables ${step_name}_buildNumber=${run_number}
- add_run_variables ${step_name}_buildName=${pipeline_name}
- docker build --pull --no-cache -t $dockerImageName:$dockerImageTag --build-arg REGISTRY=${int_demoArt_url} .
- jfrog rt bce $pipeline_name $run_number
- jfrog rt docker-push avinci-docker-local.jfrog.io/app:$run_number docker-local --build-name=$pipeline_name --build-number=$run_number
- add_run_files /tmp/jfrog/. jfrog
- name: publish_app_build
type: PublishBuildInfo
configuration:
forceXrayScan: false
inputSteps:
- name: build_app
outputResources:
- name: appl_build_info
- 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: demo_release_mgmt
# steps:
# - name: bundle
# type: CreateReleaseBundle
# configuration:
# releaseBundleName: demo_rb
# releaseBundleVersion: v1.0.${run_number}
# dryRun: false
# sign: false
# description: "some random test description"
# inputResources:
# - name: gosvc_promoted_build_info
# trigger: false
# - name: appl_promoted_build_info
# trigger: false
# outputResources:
# - name: release_bundle
# releaseNotes:
# syntax: markdown
# content: |
# ## Heading
# * Bullet
# * Points
# - name: sign
# type: SignReleaseBundle
# configuration:
# inputResources:
# - name: release_bundle
# outputResources:
# - name: signed_bundle
# - name: distribute
# type: DistributeReleaseBundle
# configuration:
# dryRun: false
# inputResources:
# - name: signed_bundle
# - name: distribution_rules
# - name: deploy
# type: Bash
# configuration:
# environmentVariables:
# docker_repository: demo-pipelines
# artifactory_address: 35.192.24.86: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