Use CircleCI version 2.1 at the top of your .circleci/config.yml file.
1
version: 2.1
Add the orbs
stanza below your version, invoking the orb:
1
2
orbs:
cloudfoundry: circleci/cloudfoundry@1.0.0
Use cloudfoundry
elements in your existing workflows and jobs.
A blue-green deployment
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
version: '2.1'
orbs:
cloudfoundry: circleci/cloudfoundry@x.y
workflows:
build_deploy:
jobs:
- cloudfoundry/blue_green:
appname: your-app
build_steps:
- run: echo 'your build steps'
- run: echo 'you can have more, too'
context: your-context
domain: your-domain
org: your-org
space: your-space
validate_steps:
- run: echo 'your validation steps'
- run: echo 'you can also have more of these'
Build and deploy your application in a single job.
1
2
3
4
5
6
7
8
9
10
11
12
13
version: '2.1'
orbs:
cloudfoundry: circleci/cloudfoundry@x.y
workflows:
build-deploy:
jobs:
- cloudfoundry/push:
appname: your-app
build_steps:
- run: echo 'your build steps'
- run: echo 'you can have more, too'
org: your-org
space: your-space
Execute a blue/green deploy in a single job. Expects either build_steps or workspace_path for assets to deploy.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
appname | App Name | Yes | - | string |
build_steps | Steps to generate application package or files. Alternately provide `workspace_path`
| No | [] | steps |
dark_subdomain | Cloud Foundry dark domain to prefix domain (i.e. <dark_subdomain>.<domain>, defaults to "dark")
| No | dark | string |
domain | Cloud Foundry domain registered to handle routes for this space (a "dark" or "live" sub-domain will be used in conjunction with this, i.e. <dark_subdomain>.<domain>)
| Yes | - | string |
endpoint | The domain of the Cloud Foundry runtime API endpoint. Defaults to https://api.run.pivotal.io
| No | https://api.run.pivotal.io | string |
image | Docker image in which to run commands. | No | cimg/base:stable | string |
live_subdomain | Cloud Foundry live subdomain to prefix domain (i.e. <live_subdomain>.<domain>, defaults to "www")
| No | www | string |
manifest | The Cloud Foundry manifest for this environment | No | '' | string |
org | Cloud Foundry Org to target | Yes | - | string |
package | path to the asset/package to push | Yes | - | string |
space | Cloud Foundry space to target | Yes | - | string |
validate_steps | Optional steps to run between the dark and live deployments. | No | [] | steps |
vars | Vars file for variable substitution. | No | '' | string |
workspace_path | The key of a workflow workspace which contains artifact. Alternately provide `build_steps`
| No | '' | string |
Execute a dark (blue) deploy in a single job. Expects either build_steps or workspace_path for assets to deploy.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
appname | App Name | Yes | - | string |
build_steps | Steps to generate artifacts. Alternately provide `workspace_path` | No | [] | steps |
dark_subdomain | Cloud Foundry dark domain to prefix domain (i.e. <dark_subdomain>.<domain>, defaults to "dark")
| No | dark | string |
domain | Cloud Foundry domain registered to handle routes for this space (a "dark" or "live" sub-domain will be used in conjunction with this, i.e. <dark_subdomain>.<domain>)
| Yes | - | string |
endpoint | The domain of the Cloud Foundry runtime API endpoint. Defaults to https://api.run.pivotal.io
| No | https://api.run.pivotal.io | string |
image | Docker image in which to run commands. | No | cimg/base:stable | string |
manifest | The Cloud Foundry manifest for this environment | No | '' | string |
org | Cloud Foundry Org to target | Yes | - | string |
package | path to the asset/package to push | Yes | - | string |
space | Cloud Foundry space to target | Yes | - | string |
validate_steps | Optional steps to run between the dark and live deployments. | No | [] | steps |
vars | Vars file for variable substitution. | No | '' | string |
workspace_path | The key of a workflow workspace which contains artifact. Alternately provide `build_steps`
| No | '' | string |
Execute final URL remap and application name cleanup.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
appname | App Name | Yes | - | string |
domain | Cloud Foundry domain registered to handle routes for this space (a "dark" or "live" sub-domain will be used in conjunction with this, i.e. <live_subdomain>.<domain>)
| Yes | - | string |
endpoint | The domain of the Cloud FOundry runtime API endpoint. Defaults to https://api.run.pivotal.io
| No | https://api.run.pivotal.io | string |
image | Docker image in which to run commands. | No | cimg/base:stable | string |
live_subdomain | Cloud Foundry dark domain to prefix domain (i.e. <live_subdomain>.<domain>, defaults to "www")
| No | www | string |
org | Cloud Foundry Org to target | Yes | - | string |
space | Cloud Foundry space to target | Yes | - | string |
validate_steps | Optional steps to run before remapping URLs. | No | [] | steps |
Execute a simple push in a single job. Expects either build_steps or workspace_path for assets to deploy.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
appname | App Name | Yes | - | string |
build_steps | Steps to generate application package or files. Alternately provide `workspace_path`
| No | [] | steps |
endpoint | The domain of the Cloud Foundry runtime API endpoint. Defaults to https://api.run.pivotal.io
| No | https://api.run.pivotal.io | string |
image | Docker image in which to run commands. | No | cimg/base:stable | string |
manifest | The Cloud Foundry manifest for this environment | No | '' | string |
org | Cloud Foundry 'Org' to target | Yes | - | string |
package | path to the package/files to push if not the current directory | No | '' | string |
space | Cloud Foundry 'Space' to target | Yes | - | string |
vars | Vars file for variable substitution. | No | '' | string |
workspace_path | The key of a workflow workspace which contains artifact. Alternately provide `build_steps`
| No | '' | string |
Authenticates with a CloudFoundry host.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
endpoint | The domain of the Cloud Foundry runtime API endpoint. Defaults to https://api.run.pivotal.io | No | https://api.run.pivotal.io | string |
org | Cloud Foundry org to target | Yes | - | string |
space | Cloud Foundry space to target | Yes | - | string |
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
appname | App Name | Yes | - | string |
dark_subdomain | Cloud Foundry dark domain to prefix domain (i.e. <dark_subdomain>.<domain>, defaults to "dark") | No | dark | string |
domain | Cloud Foundry domain registered to handle routes for this space (a "dark" or "live" sub-domain will be used in conjunction with this, i.e. <dark_subdomain>.<domain>) | Yes | - | string |
manifest | The Cloud Foundry manifest for this environment | No | '' | string |
package | path to the asset/package to push | Yes | - | string |
vars | Vars file for variable substitution. | No | '' | string |
Installs and authenticates with the latest CLI version if not present.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
platform | The platform to install CloudFoundry on - macosx, linux or windows. | No | linux | enum |
version | Version of CloudFoundry CLI to install. | No | '6' | enum |
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
appname | App Name | Yes | - | string |
domain | Cloud Foundry domain (a "dark" sub-domain will be used on this.) | Yes | - | string |
live_subdomain | Cloud Foundry live subdomain to prefix domain (i.e. <live_subdomain>.<domain>, defaults to "wwww") | No | www | string |
Push and stard a Cloud Foundry application.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
appname | App Name | Yes | - | string |
manifest | The Cloud Foundry manifest for this environment | No | '' | string |
package | path to the asset/package to push | No | '' | string |
path | Directory or zip file containing your application. | No | . | string |
vars | Vars file for variable substitution. | No | '' | string |
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
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
# This code is licensed from CircleCI to the user under the MIT license.
# See here for details: https://circleci.com/developer/orbs/licensing
version: 2.1
description: |
Push and deploy applications to Cloud Foundry
display:
source_url: https://github.com/CircleCI-Public/cloudfoundry-orb
commands:
auth:
description: Authenticates with a CloudFoundry host.
parameters:
endpoint:
default: https://api.run.pivotal.io
description: The domain of the Cloud Foundry runtime API endpoint. Defaults to https://api.run.pivotal.io
type: string
org:
description: Cloud Foundry org to target
type: string
space:
description: Cloud Foundry space to target
type: string
steps:
- run:
command: |
: "${CF_USERNAME?Cloud Foundry username and password must be set as Environment variables before running this command.}"
: "${CF_PASSWORD?Cloud Foundry username and password must be set as Environment variables before running this command.}"
cf api "$INSTALL_ENDPOINT"
cf auth "$CF_USERNAME" "$CF_PASSWORD"
cf target -o "$INSTALL_ORG" -s "$INSTALL_SPACE"
environment:
INSTALL_ENDPOINT: <<parameters.endpoint>>
INSTALL_ORG: <<parameters.org>>
INSTALL_SPACE: <<parameters.space>>
name: Setup CF CLI
dark_deploy:
parameters:
appname:
description: App Name
type: string
dark_subdomain:
default: dark
description: Cloud Foundry dark domain to prefix domain (i.e. <dark_subdomain>.<domain>, defaults to "dark")
type: string
domain:
description: Cloud Foundry domain registered to handle routes for this space (a "dark" or "live" sub-domain will be used in conjunction with this, i.e. <dark_subdomain>.<domain>)
type: string
manifest:
default: ""
description: The Cloud Foundry manifest for this environment
type: string
package:
description: path to the asset/package to push
type: string
vars:
default: ""
description: Vars file for variable substitution.
type: string
steps:
- run:
command: |
Setup_Args() {
if [ -n "$DD_VARS" ]; then
ARGS_VARS="--vars-file $DD_VARS"
fi
if [ -n "$DD_SUBDOMAIN" ]; then
ARGS_SUBDOMAIN="-n $DD_SUBDOMAIN"
fi
}
Setup_Args
cf push --no-start "$DD_APPNAME-dark" -f "$DD_MANIFEST" \
"$ARGS_VARS" \
-p "$DD_PACKAGE" \
"$ARGS_SUBDOMAIN" \
-d "$DD_DOMAIN"
cf set-env "$DD_APPNAME-dark" CIRCLE_BUILD_NUM "${CIRCLE_BUILD_NUM}"
cf set-env "$DD_APPNAME-dark" CIRCLE_SHA1 "${CIRCLE_SHA1}"
cf set-env "$DD_APPNAME-dark" CIRCLE_WORKFLOW_ID "${CIRCLE_WORKFLOW_ID}"
cf set-env "$DD_APPNAME-dark" CIRCLE_PROJECT_USERNAME "${CIRCLE_PROJECT_USERNAME}"
cf set-env "$DD_APPNAME-dark" CIRCLE_PROJECT_REPONAME "${CIRCLE_PROJECT_REPONAME}"
# Push as "dark" instance (URL in manifest)
cf start "$DD_APPNAME-dark"
# Ensure dark route is exclusive to dark app
cf unmap-route "$DD_APPNAME" "$DD_DOMAIN" "$ARGS_SUBDOMAIN" || echo "Already exclusive"
environment:
DD_APPNAME: <<parameters.appname>>
DD_DOMAIN: <<parameters.domain>>
DD_MANIFEST: <<parameters.manifest>>
DD_PACKAGE: <<parameters.package>>
DD_SUBDOMAIN: <<parameters.dark_subdomain>>
DD_VARS: <<parameters.vars>>
name: Cloud Foundry Dark Deployment
install:
description: Installs and authenticates with the latest CLI version if not present.
parameters:
platform:
default: linux
description: The platform to install CloudFoundry on - macosx, linux or windows.
enum:
- linux
- macosx
- windows
type: enum
version:
default: "6"
description: Version of CloudFoundry CLI to install.
enum:
- "6"
- "7"
type: enum
steps:
- run:
command: |
BASE_INSTALLER_URL="https://packages.cloudfoundry.org/stable?release=${CLOUDFOUNDRY_BINARY_PLATFORM}64-binary&source=github&version=v${CLOUDFOUNDRY_BINARY_VERSION}"
echo "Downloading ${BASE_INSTALLER_URL}"
curl -L $BASE_INSTALLER_URL | tar -zx
if which sudo > /dev/null; then
sudo mv cf /usr/local/bin
else
echo "No sudo command, falling back to manual install"
mkdir -p $HOME/bin
mv cf $HOME/bin
echo "export PATH=$PATH:$HOME/bin" >> $BASH_ENV
. $BASH_ENV
fi
cf version
environment:
CLOUDFOUNDRY_BINARY_PLATFORM: <<parameters.platform>>
CLOUDFOUNDRY_BINARY_VERSION: <<parameters.version>>
name: Install cf CLI
live_deploy:
parameters:
appname:
description: App Name
type: string
domain:
description: Cloud Foundry domain (a "dark" sub-domain will be used on this.)
type: string
live_subdomain:
default: www
description: Cloud Foundry live subdomain to prefix domain (i.e. <live_subdomain>.<domain>, defaults to "wwww")
type: string
steps:
- run:
command: |-
Setup_Args() {
if [ -n "$LD_SUBDOMAIN" ]; then
ARGS_SUBDOMAIN="-n $LD_SUBDOMAIN"
fi
}
Setup_Args
# Send "real" url to new version
cf map-route "$LD_APPNAME-dark" "$LD_DOMAIN" "$ARGS_SUBDOMAIN"
# Stop sending traffic to previous version
cf unmap-route "$LD_APPNAME" "$LD_DOMAIN" "$ARGS_SUBDOMAIN"
# stop previous version
cf stop "$LD_APPNAME"
# delete previous version
cf delete "$LD_APPNAME" -f
# Switch name of "dark" version to claim correct name
cf rename "$LD_APPNAME-dark" "$LD_APPNAME"
environment:
LD_APPNAME: <<parameters.appname>>
LD_DOMAIN: <<parameters.domain>>
LD_SUBDOMAIN: <<parameters.live_subdomain>>
name: Cloud Foundry - Re-route live Domain
push:
description: |
Push and stard a Cloud Foundry application.
parameters:
appname:
description: App Name
type: string
manifest:
default: ""
description: The Cloud Foundry manifest for this environment
type: string
package:
default: ""
description: path to the asset/package to push
type: string
path:
default: .
description: Directory or zip file containing your application.
type: string
vars:
default: ""
description: Vars file for variable substitution.
type: string
steps:
- run:
command: |
Setup_Args() {
if [ -n "$DEPLOY_VARS" ]; then
ARGS_VARS="--vars-file $DD_VARS"
fi
if [ -n "$DEPLOY_PACKAGE" ]; then
ARGS_PACKAGE="-n $DEPLOY_PACKAGE"
fi
if [ -n "$DEPLOY_PATH" ]; then
ARGS_PATH="-p$DEPLOY_PATH"
fi
}
Setup_Args
cf push --no-start "$DEPLOY_APPNAME" -f "$DEPLOY_MANIFEST" "$ARGS_VARS" "$ARGS_PACKAGE" "$ARGS_PATH"
cf set-env "$DEPLOY_APPNAME" CIRCLE_BUILD_NUM "${CIRCLE_BUILD_NUM}"
cf set-env "$DEPLOY_APPNAME" CIRCLE_SHA1 "${CIRCLE_SHA1}"
cf set-env "$DEPLOY_APPNAME" CIRCLE_WORKFLOW_ID "${CIRCLE_WORKFLOW_ID}"
cf set-env "$DEPLOY_APPNAME" CIRCLE_PROJECT_USERNAME "${CIRCLE_PROJECT_USERNAME}"
cf set-env "$DEPLOY_APPNAME" CIRCLE_PROJECT_REPONAME "${CIRCLE_PROJECT_REPONAME}"
#now start
cf start "$DEPLOY_APPNAME"
environment:
DEPLOY_APPNAME: <<parameters.appname>>
DEPLOY_MANIFEST: <<parameters.manifest>>
DEPLOY_PACKAGE: <<parameters.package>>
DEPLOY_PATH: <<parameters.path>>
DEPLOY_VARS: <<parameters.vars>>
name: Cloud Foundry Push
jobs:
blue_green:
description: |
Execute a blue/green deploy in a single job. Expects either build_steps or workspace_path for assets to deploy.
docker:
- image: << parameters.image >>
parameters:
appname:
description: App Name
type: string
build_steps:
default: []
description: |
Steps to generate application package or files. Alternately provide `workspace_path`
type: steps
dark_subdomain:
default: dark
description: |
Cloud Foundry dark domain to prefix domain (i.e. <dark_subdomain>.<domain>, defaults to "dark")
type: string
domain:
description: |
Cloud Foundry domain registered to handle routes for this space (a "dark" or "live" sub-domain will be used in conjunction with this, i.e. <dark_subdomain>.<domain>)
type: string
endpoint:
default: https://api.run.pivotal.io
description: |
The domain of the Cloud Foundry runtime API endpoint. Defaults to https://api.run.pivotal.io
type: string
image:
default: cimg/base:stable
description: Docker image in which to run commands.
type: string
live_subdomain:
default: www
description: |
Cloud Foundry live subdomain to prefix domain (i.e. <live_subdomain>.<domain>, defaults to "www")
type: string
manifest:
default: ""
description: The Cloud Foundry manifest for this environment
type: string
org:
description: Cloud Foundry Org to target
type: string
package:
description: path to the asset/package to push
type: string
space:
description: Cloud Foundry space to target
type: string
validate_steps:
default: []
description: Optional steps to run between the dark and live deployments.
type: steps
vars:
default: ""
description: Vars file for variable substitution.
type: string
workspace_path:
default: ""
description: |
The key of a workflow workspace which contains artifact. Alternately provide `build_steps`
type: string
steps:
- checkout
- when:
condition: <<parameters.build_steps>>
steps: << parameters.build_steps >>
- when:
condition: <<parameters.workspace_path>>
steps:
- attach_workspace:
at: <<parameters.workspace_path>>
- install
- auth:
endpoint: <<parameters.endpoint>>
org: <<parameters.org>>
space: <<parameters.space>>
- dark_deploy:
appname: <<parameters.appname>>
dark_subdomain: <<parameters.dark_subdomain>>
domain: <<parameters.domain>>
manifest: <<parameters.manifest>>
package: <<parameters.package>>
vars: <<parameters.vars>>
- when:
condition: <<parameters.validate_steps>>
steps: << parameters.validate_steps >>
- live_deploy:
appname: <<parameters.appname>>
domain: <<parameters.domain>>
live_subdomain: <<parameters.live_subdomain>>
dark_deploy:
description: |
Execute a dark (blue) deploy in a single job. Expects either build_steps or workspace_path for assets to deploy.
docker:
- image: << parameters.image >>
parameters:
appname:
description: App Name
type: string
build_steps:
default: []
description: Steps to generate artifacts. Alternately provide `workspace_path`
type: steps
dark_subdomain:
default: dark
description: |
Cloud Foundry dark domain to prefix domain (i.e. <dark_subdomain>.<domain>, defaults to "dark")
type: string
domain:
description: |
Cloud Foundry domain registered to handle routes for this space (a "dark" or "live" sub-domain will be used in conjunction with this, i.e. <dark_subdomain>.<domain>)
type: string
endpoint:
default: https://api.run.pivotal.io
description: |
The domain of the Cloud Foundry runtime API endpoint. Defaults to https://api.run.pivotal.io
type: string
image:
default: cimg/base:stable
description: Docker image in which to run commands.
type: string
manifest:
default: ""
description: The Cloud Foundry manifest for this environment
type: string
org:
description: Cloud Foundry Org to target
type: string
package:
description: path to the asset/package to push
type: string
space:
description: Cloud Foundry space to target
type: string
validate_steps:
default: []
description: Optional steps to run between the dark and live deployments.
type: steps
vars:
default: ""
description: Vars file for variable substitution.
type: string
workspace_path:
default: ""
description: |
The key of a workflow workspace which contains artifact. Alternately provide `build_steps`
type: string
steps:
- checkout
- when:
condition: <<parameters.build_steps>>
steps: << parameters.build_steps >>
- when:
condition: <<parameters.workspace_path>>
steps:
- attach_workspace:
at: <<parameters.workspace_path>>
- install
- auth:
endpoint: <<parameters.endpoint>>
org: <<parameters.org>>
space: <<parameters.space>>
- dark_deploy:
appname: <<parameters.appname>>
dark_subdomain: <<parameters.dark_subdomain>>
domain: <<parameters.domain>>
manifest: <<parameters.manifest>>
package: <<parameters.package>>
vars: <<parameters.vars>>
- when:
condition: <<parameters.validate_steps>>
steps: << parameters.validate_steps >>
live_deploy:
description: Execute final URL remap and application name cleanup.
docker:
- image: << parameters.image >>
parameters:
appname:
description: App Name
type: string
domain:
description: |
Cloud Foundry domain registered to handle routes for this space (a "dark" or "live" sub-domain will be used in conjunction with this, i.e. <live_subdomain>.<domain>)
type: string
endpoint:
default: https://api.run.pivotal.io
description: |
The domain of the Cloud FOundry runtime API endpoint. Defaults to https://api.run.pivotal.io
type: string
image:
default: cimg/base:stable
description: Docker image in which to run commands.
type: string
live_subdomain:
default: www
description: |
Cloud Foundry dark domain to prefix domain (i.e. <live_subdomain>.<domain>, defaults to "www")
type: string
org:
description: Cloud Foundry Org to target
type: string
space:
description: Cloud Foundry space to target
type: string
validate_steps:
default: []
description: Optional steps to run before remapping URLs.
type: steps
steps:
- install
- auth:
endpoint: <<parameters.endpoint>>
org: <<parameters.org>>
space: <<parameters.space>>
- when:
condition: <<parameters.validate_steps>>
steps: << parameters.validate_steps >>
- live_deploy:
appname: <<parameters.appname>>
domain: <<parameters.domain>>
live_subdomain: <<parameters.live_subdomain>>
push:
description: |
Execute a simple push in a single job. Expects either build_steps or workspace_path for assets to deploy.
docker:
- image: << parameters.image >>
parameters:
appname:
description: App Name
type: string
build_steps:
default: []
description: |
Steps to generate application package or files. Alternately provide `workspace_path`
type: steps
endpoint:
default: https://api.run.pivotal.io
description: |
The domain of the Cloud Foundry runtime API endpoint. Defaults to https://api.run.pivotal.io
type: string
image:
default: cimg/base:stable
description: Docker image in which to run commands.
type: string
manifest:
default: ""
description: The Cloud Foundry manifest for this environment
type: string
org:
description: Cloud Foundry 'Org' to target
type: string
package:
default: ""
description: path to the package/files to push if not the current directory
type: string
space:
description: Cloud Foundry 'Space' to target
type: string
vars:
default: ""
description: Vars file for variable substitution.
type: string
workspace_path:
default: ""
description: |
The key of a workflow workspace which contains artifact. Alternately provide `build_steps`
type: string
steps:
- checkout
- when:
condition: <<parameters.build_steps>>
steps: << parameters.build_steps >>
- when:
condition: <<parameters.workspace_path>>
steps:
- attach_workspace:
at: <<parameters.workspace_path>>
- install
- auth:
endpoint: <<parameters.endpoint>>
org: <<parameters.org>>
space: <<parameters.space>>
- push:
appname: <<parameters.appname>>
manifest: <<parameters.manifest>>
package: <<parameters.package>>
vars: <<parameters.vars>>
examples:
blue_green_deploy:
description: A blue-green deployment
usage:
version: "2.1"
orbs:
cloudfoundry: circleci/cloudfoundry@x.y
workflows:
build_deploy:
jobs:
- cloudfoundry/blue_green:
appname: your-app
build_steps:
- run: echo 'your build steps'
- run: echo 'you can have more, too'
context: your-context
domain: your-domain
org: your-org
space: your-space
validate_steps:
- run: echo 'your validation steps'
- run: echo 'you can also have more of these'
build_and_push:
description: Build and deploy your application in a single job.
usage:
version: "2.1"
orbs:
cloudfoundry: circleci/cloudfoundry@x.y
workflows:
build-deploy:
jobs:
- cloudfoundry/push:
appname: your-app
build_steps:
- run: echo 'your build steps'
- run: echo 'you can have more, too'
org: your-org
space: your-space