cf cli Concourse Resource
An output only resource capable of running lots of Cloud Foundry cli commands.
Source Configuration
api: Required. The address of the Cloud Controller in the Cloud Foundry deployment.username: Required. The username used to authenticate.password: Required. The password used to authenticate.skip_cert_check: Optional. Check the validity of the CF SSL cert. Defaults tofalse.org: Optional. Sets the default organization to target (can be overridden in the params config).space: Optional. Sets the default space to target (can be overridden in the params config).cf_color: Optional. Set tofalseto not colorize cf output (can be overridden in the params config).cf_dial_timeout: Optional. Max wait time to establish a connection, including name resolution, in seconds (can be overridden in the params config).cf_trace: Optional. Set totrueto print cf API request diagnostics to stdout (can be overridden in the params config).
resource_types:
- name: cf-cli-resource
type: docker-image
source:
repository: nulldriver/cf-cli-resource
tag: latest
resources:
- name: cf-env
type: cf-cli-resource
source:
api: https://api.local.pcfdev.io
username: admin
password: admin
skip_cert_check: trueMultiple Command Syntax
This resource is capable of running single commands in separate put steps.
NOTE: A common practice is to use different logical names for each put step and reuse the same resource.
In this example were we use cf-create-org and cf-create-space to describe the put steps and use the same cf-env resource for both steps.
- put: cf-create-org
resource: cf-env
params:
command: create-org
org: myorg
- put: cf-create-space
resource: cf-env
params:
command: create-space
org: myorg
space: myspaceor they can be combined in a single put step:
- put: cf-create-org-and-space
resource: cf-env
params:
commands:
- command: create-org
org: myorg
- command: create-space
org: myorg
space: myspaceAnd, of course, if you have your org and space defined in the source config,
it gets even simpler:
- put: cf-create-org-and-space
resource: cf-env
params:
commands:
- command: create-org
- command: create-spaceBehavior
out: Run a cf cli command.
Run cf command(s) on a Cloud Foundry installation.
create-org
Create an org
org: Optional. The organization to create (required if not set in the source config)
- put: cf-create-org
resource: cf-env
params:
command: create-org
org: myorgdelete-org
Delete an org
org: Optional. The organization to delete (required if not set in the source config)
- put: cf-delete-org
resource: cf-env
params:
command: delete-org
org: myorgcreate-space
Create a space
org: Optional. The organization to target (required if not set in the source config)space: Optional. The space to create (required if not set in the source config)
- put: cf-create-space
resource: cf-env
params:
command: create-space
org: myorg
space: myspacedelete-space
Delete a space
org: Optional. The organization to target (required if not set in the source config)space: Optional. The space to delete (required if not set in the source config)
- put: cf-delete-space
resource: cf-env
params:
command: delete-space
org: myorg
space: myspacecreate-domain
Create a domain in an org for later use
org: Optional. The organization to create the domain in (required if not set in the source config)domain: Optional. The domain to add to the organization
- put: cf-create-domain
resource: cf-env
params:
command: create-domain
org: myorg
domain: example.comdelete-domain
Delete a domain
org: Optional. The organization to target (required if not set in the source config)space: Optional. The space to target (required if not set in the source config)domain: Optional. The domain to delete
- put: cf-delete-domain
resource: cf-env
params:
command: delete-domain
domain: example.commap-route
Add a url route to an app
org: Optional. The organization to target (required if not set in the source config)space: Optional. The space to target (required if not set in the source config)app_name: Required. The application to map the route todomain: Required. The domain to map to the applicationhostname: Optional. Hostname for the HTTP route (required for shared domains)path: Optional. Path for the HTTP route
- put: cf-map-route
resource: cf-env
params:
command: map-route
app_name: myapp-ui
domain: example.com
hostname: myhost
path: foounmap-route
Remove a url route from an app
org: Optional. The organization to target (required if not set in the source config)space: Optional. The space to target (required if not set in the source config)app_name: Required. The application to map the route todomain: Required. The domain to unmap from the applicationhostname: Optional. Hostname used to identify the HTTP routepath: Optional. Path used to identify the HTTP route
- put: cf-unmap-route
resource: cf-env
params:
command: unmap-route
app_name: myapp-ui
domain: example.com
hostname: myhost
path: foocreate-user
Create a new user
username: Required. The user to createpassword: Optional. The password (must specify eitherpasswordororigin)origin: Optional. The authentication origin (e.g. ldap, provider-alias) (must specify eitherpasswordororigin)
Create a user with credentials:
- put: prepare-env
resource: cf-env
params:
command: create-user
username: j.smith@example.com
password: S3cr3tCreate an LDAP user:
- put: prepare-env
resource: cf-env
params:
command: create-user
username: j.smith@example.com
origin: ldapcreate-users-from-file
Bulk create users from a csv file
file: Required. The csv file containing the users
- put: prepare-env
resource: cf-env
params:
command: create-users-from-file
file: somepath/users.csvThe format of the bulk load file:
| Username | Password | Org | Space | OrgManager | BillingManager | OrgAuditor | SpaceManager | SpaceDeveloper | SpaceAuditor |
|---|---|---|---|---|---|---|---|---|---|
| user1 | S3cr3t | org1 | dev | x | x | x | x | x | x |
| user2 | org2 | dev | x | x | x | x | |||
| user3 | S3cr3t | org3 | dev | x | x | ||||
| user3 | S3cr3t | org3 | test | x | x |
Notes:
- The file must include the header row
- The file must be in comma separated value format
- You can specify the user more than once to assign multiple orgs/spaces
- If you omit the Org, no org or space roles will be assigned
- If you omit the Space, no space roles will be assigned
delete-user
Delete a user
username: Required. The user to delete
- put: prepare-env
resource: cf-env
params:
command: delete-user
username: j.smith@example.comcreate-user-provided-service
Make a user-provided service instance available to CF apps
org: Optional. The organization to target (required if not set in the source config)space: Optional. The space to target (required if not set in the source config)service_instance: Required. The name to give the service instance- Options: Only specify one.
credentials: Credentials, provided inline or in a file, to be exposed in the VCAP_SERVICES environment variable for bound applicationssyslog_drain_url: URL to which logs for bound applications will be streamedroute_service_url: URL to which requests for bound routes will be forwarded. Scheme for this URL must be https
- put: cf-create-user-provided-service
resource: cf-env
params:
commands:
# inline json
- command: create-user-provided-service
service_instance: my-db-mine
credentials: '{"username":"admin","password":"pa55woRD"}'
# json file
- command: create-user-provided-service
service_instance: another-db-mine
credentials: path/to/credentials.json
# syslog drain url
- command: create-user-provided-service
service_instance: my-drain-service
syslog_drain_url: syslog://example.com
# route service url
- command: create-user-provided-service
service_instance: my-route-service
syslog_drain_url: https://example.comcreate-service
Create a service instance
org: Optional. The organization to target (required if not set in the source config)space: Optional. The space to target (required if not set in the source config)service: Required. The marketplace service name to createplan: Required. The service plan name to createservice_instance: Required. The name to give the service instanceconfiguration: Optional. Valid JSON object containing service-specific configuration parameters, provided either in-line or in a file. For a list of supported configuration parameters, see documentation for the particular service offering.tags: Optional. User provided tagstimeout: Optional. Max wait time for service creation, in seconds. Defaults to600(10 minutes)wait_for_service: Optional. Wait for the asynchronous service to start. Defaults tofalse.
- put: cf-create-service
resource: cf-env
params:
command: create-service
service: p-config-server
plan: standard
service_instance: my-config-server
configuration: '{"count":3}'
tags: 'list, of, tags'
timeout: 300
wait_for_service: truedelete-service
Delete a service instance
org: Optional. The organization to target (required if not set in the source config)space: Optional. The space to target (required if not set in the source config)service_instance: Required. The service instance to deletewait_for_service: Optional. Wait for the service to delete. Defaults tofalse.
- put: cf-delete-service
resource: cf-env
params:
command: delete-service
service_instance: my-config-server
wait_for_service: truecreate-service-broker
Create/Update a service broker. If a service broker already exists, updates the existing service broker.
org: Optional. The organization to target (required ifspace_scoped: true)space: Optional. The space to target (required ifspace_scoped: true)service_broker: Required. The service broker name to createusername: Required. The service broker usernamepassword: Required. The service broker passwordurl: Required. The service broker urlspace_scoped: Optional. Make the broker's service plans only visible within the targeted space. Defaults tofalse.
- put: cf-create-service-broker
resource: cf-env
params:
command: create-service-broker
service_broker: some-service
username: admin
password: password
url: http://broker.name.com
space_scoped: truedelete-service-broker
Deletes a service broker
org: Optional. The organization to target (required if not set in the source config)space: Optional. The space to target (required if not set in the source config)service_broker: Required. The service broker name to delete
- put: cf-delete-service-broker
resource: cf-env
params:
command: delete-service-broker
service_broker: some-servicewait-for-service
Wait for a service instance to start
org: Optional. The organization to target (required if not set in the source config)space: Optional. The space to target (required if not set in the source config)service_instance: Required. The service instance to wait fortimeout: Optional. Max wait time for service creation, in seconds. Defaults to600(10 minutes)
- put: cf-wait-for-service
resource: cf-env
params:
command: wait-for-service
service_instance: my-config-server
timeout: 300enable-service-access
Enable access to a service or service plan for one or all orgs
org: Optional. The organization to target (required if not set in the source config)space: Optional. The space to target (required if not set in the source config)service_broker: Required. The marketplace service name to enableaccess_org: Optional. Enable access for a specified organizationplan: Optional. Enable access to a specified service plan
- put: cf-enable-service-access
resource: cf-env
params:
command: enable-service-access
service_broker: some-service
access_org: myorg
plan: simpledisable-service-access
Disable access to a service or service plan for one or all orgs
org: Optional. The organization to target (required if not set in the source config)space: Optional. The space to target (required if not set in the source config)service_broker: Required. The marketplace service name to disableaccess_org: Optional. Disable access for a specified organizationplan: Optional. Disable access to a specified service plan
- put: cf-disable-service-access
resource: cf-env
params:
command: disable-service-access
service_broker: some-service
access_org: myorg
plan: simplebind-service
Bind a service instance to an app
org: Optional. The organization to target (required if not set in the source config)space: Optional. The space to target (required if not set in the source config)app_name: Required. The application to bind to the serviceservice_instance: Required. The service instance to bind to the applicationconfiguration: Optional. Valid JSON object containing service-specific configuration parameters, provided either in-line or in a file. For a list of supported configuration parameters, see documentation for the particular service offering.
- put: cf-bind-service
resource: cf-env
params:
command: bind-service
app_name: myapp-ui
service_instance: mydb
configuration: '{"permissions":"read-only"}'unbind-service
Unbind a service instance from an app
org: Optional. The organization to target (required if not set in the source config)space: Optional. The space to target (required if not set in the source config)app_name: Required. The application to unbind from the service instanceservice_instance: Required. The service instance to unbind from the application
- put: cf-unbind-service
resource: cf-env
params:
command: unbind-service
app_name: myapp-ui
service_instance: mydbenable-feature-flag
Allow use of a feature
feature_name: Required. Feature to enable
- put: cf-enable-feature-flag
resource: cf-env
params:
command: enable-feature-flag
feature_name: service_instance_sharingdisable-feature-flag
Prevent use of a feature
feature_name: Required. Feature to disable
- put: cf-disable-feature-flag
resource: cf-env
params:
command: disable-feature-flag
feature_name: service_instance_sharingpush
Push a new app or sync changes to an existing app
NOTE: A manifest can be used to specify values for required parameters. Any parameters specified will override manifest values.
org: Optional. The organization to target (required if not set in the source config)space: Optional. The space to target (required if not set in the source config)app_name: Required. The name of the applicationhostname: Optional. Hostname (e.g. my-subdomain)memory: Optional. Memory limit (e.g. 256M, 1024M, 1G)disk_quota: Optional. Disk limit (e.g. 256M, 1024M, 1G)instances: Optional. Number of instancespath: Optional. Path to app directory or to a zip file of the contents of the app directorybuildpack: Optional. Custom buildpack by name (e.g. my-buildpack) or Git URL (e.g. 'https://github.com/cloudfoundry/java-buildpack.git') or Git URL with a branch or tag (e.g. 'https://github.com/cloudfoundry/java-buildpack.git#v3.3.0' for 'v3.3.0' tag). To use built-in buildpacks only, specify 'default' or 'null'manifest: Optional. Path to manifestno_start: Optional. Do not start an app after pushing. Defaults tofalse.
- put: cf-push
resource: cf-env
params:
command: push
app_name: myapp-ui
hostname: myapp
memory: 512M
disk_quota: 1G
instances: 1
path: path/to/myapp-*.jar
buildpack: java_buildpack
manifest: path/to/manifest.yml
no_start: truezero-downtime-push
Push a single app using the autopilot plugin.
org: Optional. The organization to target (required if not set in the source config)space: Optional. The space to target (required if not set in the source config)manifest: Required. Path to a application manifest file.path: Optional. Path to the application to push. If this isn't set then it will be read from the manifest instead.current_app_name: Optional. This should be the name of the application that this will re-deploy over. If this is set the resource will perform a zero-downtime deploy.environment_variables: Optional. Environment variable key/value pairs to add to the manifest.
- put: cf-zero-downtime-push
resource: cf-env
params:
command: zero-downtime-push
manifest: path/to/manifest.yml
path: path/to/myapp-*.jar
current_app_name: myapp-ui
environment_variables:
key: value
key2: value2start
Start an app
org: Optional. The organization to target (required if not set in the source config)space: Optional. The space to target (required if not set in the source config)app_name: Required. The name of the applicationstaging_timeout: Optional. Max wait time for buildpack staging, in minutesstartup_timeout: Optional. Max wait time for app instance startup, in minutes
- put: cf-start
resource: cf-env
params:
command: start
app_name: myapp-ui
staging_timeout: 15
startup_timeout: 5stop
Stop an app
org: Optional. The organization to target (required if not set in the source config)space: Optional. The space to target (required if not set in the source config)app_name: Required. The name of the application
- put: cf-stop
resource: cf-env
params:
command: stop
app_name: myapp-uirestart
Stop all instances of the app, then start them again. This causes downtime.
org: Optional. The organization to target (required if not set in the source config)space: Optional. The space to target (required if not set in the source config)app_name: Required. The name of the applicationstaging_timeout: Optional. Max wait time for buildpack staging, in minutesstartup_timeout: Optional. Max wait time for app instance startup, in minutes
- put: cf-restart
resource: cf-env
params:
command: restart
app_name: myapp-ui
staging_timeout: 15
startup_timeout: 5restage
Recreate the app's executable artifact using the latest pushed app files and the latest environment (variables, service bindings, buildpack, stack, etc.)
org: Optional. The organization to target (required if not set in the source config)space: Optional. The space to target (required if not set in the source config)app_name: Required. The name of the applicationstaging_timeout: Optional. Max wait time for buildpack staging, in minutesstartup_timeout: Optional. Max wait time for app instance startup, in minutes
- put: cf-restage
resource: cf-env
params:
command: restage
app_name: myapp-ui
staging_timeout: 15
startup_timeout: 5delete
Delete an app
org: Optional. The organization to target (required if not set in the source config)space: Optional. The space to target (required if not set in the source config)app_name: Required. The name of the applicationdelete_mapped_routes: Optional. Delete any mapped routes. Defaults tofalse.
- put: cf-delete
resource: cf-env
params:
command: delete
app_name: myapp-ui
delete_mapped_routes: truerun-task
Run a one-off task on an app
org: Optional. The organization to target (required if not set in the source config)space: Optional. The space to target (required if not set in the source config)app_name: Required. The name of the applicationtask_command: Required. The command to run for the tasktask_name: Optional. Name to give the task (generated if omitted)memory: Optional. Memory limit (e.g. 256M, 1024M, 1G)disk_quota: Optional. Disk limit (e.g. 256M, 1024M, 1G)
- put: cf-run-task
resource: cf-env
params:
command: run-task
app_name: myapp-ui
task_command: "bundle exec rake db:migrate"
task_name: migrate
memory: 256M
disk_quota: 1Gscale
Change or view the instance count, disk space limit, and memory limit for an app
org: Optional. The organization to target (required if not set in the source config)space: Optional. The space to target (required if not set in the source config)app_name: Required. The name of the applicationinstances: Optional. Number of instancesdisk_quota: Optional. Disk limit (e.g. 256M, 1024M, 1G)memory: Optional. Memory limit (e.g. 256M, 1024M, 1G)
- put: cf-scale
resource: cf-env
params:
command: scale
app_name: myapp-ui
instances: 3
disk_quota: 1G
memory: 2G
Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
