Create GCP Compute Engine plugin procedures

5 minute readExtensibilityDeveloper productivity

Plugin procedures can be used in procedure steps, process steps, and pipeline tasks, allowing you to orchestrate third-party tools at the appropriate time in your component, application process, or pipeline.

Depending on your plugin configuration and how you run procedures, the Input parameters  Configuration name field may behave differently in the CloudBees CD/RO UI. For more information, refer to Differences in plugin UI behavior.

Create Image

Creates a new virtual machine image in GCP.

Input parameters

Table 1. Create Image input parameters
Parameter Description

Configuration name

Required. The previously defined configuration for the plugin.

Family

The name of the image family. Either the image family name or the image name should be provided. If the image name is not provided, it is calculated from the family name.

Name

The name of the image. Either the image family name or the image name should be provided. If the image name is not provided, it is calculated from the family name.

Source disk

Required. The name of the source disk.

Disk zone

The zone of the source disk. If Source disk is selected, this field must be specified.

Description

The description for the new image.

Disk size (GB)

The disk size, in GB.

Deprecate old image?

If selected, the old image from the same family is deprecated and replaced with the new image.

Force create?

If selected, the image is created even if the disk is in use by a running instance.

Locations

Space or newline-separated zone names for the new image. By default, the new image is multi-zonal.

Labels

Labels for the newly created image object. For example, mylabel: value. Entries may be either JSON or newline-separated values.

Delete Instances

Destroys one or more virtual machine instances in GCP.

Input parameters

Table 2. Delete Instances input parameters
Parameter Description

Configuration name

Required. The previously defined configuration for the plugin.

Instance names

Required. The instance name. If there are multiple instances, specify one instance name per line.

Timeout (seconds)

The time, in seconds, to wait for instances to be deleted.

List Instances

List virtual machine instances in GCP.

Input parameters

Table 3. List Instances input parameters
Parameter Description

Configuration name

Required. The previously defined configuration for the plugin.

Filter

An expression used to filter resources. The filter expression must specify the field name, a comparison operator, and the value used to filter them. The value must be a string, a number, or a boolean and the comparison operator must be either =, !=, >, or <. For example, the name != foobar-instance excludes all virtual instances named foobar-instance.

Max results

The maximum number of results per page that should be returned. Acceptable values are 0 to 500, inclusive. The default is 500. If the number of results returned is larger than Max results, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests.

Order by

The order to sort results. By default, results are sorted in alphanumerical order based on resource name. In addition, results can be sorted in descending order based on the timestamp by using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order, with the newest result first. Only sorting by name or creationTimestamp desc is supported.

Result property sheet

Required. The property sheet used to store the JSON representation of instances found.

Output parameters

Table 4. List Instances output parameters
Parameter Description

instances

JSON representation of instances found.

Provision

Creates one or more virtual machine instances.

Input parameters

Table 5. Provision input parameters
Parameter Description

Configuration name

Required. The previously defined configuration for the plugin.

Instance name template

The name of the instance template. For example, my-instance-1. The instance name is typically generated by adding a random string to the end of this name.

Instance type

Required. The instance type. For example, n1-standard-2.

Source image

The source image starting with a project name. For example, my-project/global/images/image-name. You must specify either a URL or a family.

Source image project

The project the source image belongs to. If not specified, the project from the configuration is used.

Source image family

The source image family. Either the family or a URL must be provided.

Keys

SSH keys in JSON format. For example, [{"userName": "user", "key": "ssh-rsa …​.."}].

Network

The name of the VPC network. For example, default. This may be a name, if the network is located in the same project with the newly created instance, or a path to the network if it is located in another project. For example, projects/other-project/global/networks/shared-network.

Subnetwork

Required. The name of the VPC subnetwork. For example, default. This may be a name, if the subnetwork is located in the same project with the newly created instance, or a path to the subnetwork if it is located in another project. For example, projects/other-project/regions/us-east1/subnetworks/shared-subnetwork.

Disk size (Gb)

The instance disk size, in Gb.

Instance tags

Instance tags that are newline-separated. For example, my-tag1.

Assign public IP?

If selected, a network address translation (NAT) interface is attached to the instance.

Use service account

The service account used to provision the virtual machine.

  • None: No service account is used.

  • Same: Use the service account as in the plugin configuration.

  • Another: Use the service account as specified in the Service account email field. In this case, it is assumed the service account used in the plugin configuration has privileges to access this other service account.

Service account email

The service account email to use with the provisioned machine.

Service account scopes

The service account access scopes. By default, https://www.googleapis.com/auth/cloud-platform scope is used. For more information, refer to Access scopes.

Protect from deletion?

If selected, the instance is protected from deletion.

Labels

Labels for the instance, in JSON format. For example, {"team": "myteam"}.

Preemptible

A preemptible virtual machine is less expensive, but lasts only for 24 hours. It can be terminated sooner due to system demands.

Hostname

The hostname for the instance.

Count

Required. The number of instances to create.

Ping resource?

If selected, the resource is pinged and the job finishes successfully only when the resource is up and running.

Network stack type

The stack type to use for this network interface. To use only IPv4 addresses, select IPV4_ONLY. To use IPv4 and IPv6 addresses or IPv6 only, select IPV4_IPV6. Default is IPV4_ONLY.

Timeout (seconds)

The time, in seconds, to wait for provisioning to complete.

Resource pool name

The resource is created for the instance and placed into this pool.

Resource port

The agent port for the created resource.

Resource workspace

The workspace name for the created resource.

Resource zone

The zone to use for the created resource.

Result property

The property sheet to store the instance result.

Output parameters

Table 6. Provision output parameters
Parameter Description

instanceDetails

Details of the created instance.

Reset Instances

Reset one or more virtual machine instances in GCP.

Input parameters

Table 7. Reset Instances input parameters
Parameter Description

Configuration name

Required. The previously defined configuration for the plugin.

Instance names

Required. The instance name. If there are multiple instances, specify one instance name per line.

Start Instances

Starts one or more virtual machine instances in GCP.

Input parameters

Table 8. Start Instances input parameters
Parameter Description

Configuration name

Required. The previously defined configuration for the plugin.

Instance names

Required. The instance name. If there are multiple instances, specify one instance name per line.

Result property sheet

Required. The property sheet to store instances that are started in JSON format.

Output parameters

Table 9. Start Instances output parameters
Parameter Description

instances

A JSON representation of instances.

Stop Instances

Stops one or more virtual machine instances in GCP.

Input parameters

Table 10. Stop Instances input parameters
Parameter Description

Configuration name

Required. The previously defined configuration for the plugin.

Instance names

Required. The instance name. If there are multiple instances, specify one instance name per line.

Timeout (seconds)

The time, in seconds, to wait for instances to be deleted.

Teardown

Deletes Virtual Machines Instance or Instances that correspond to either a CD Resource or a CD Resource Pool. This procedure essentially calls the Delete Instance procedure followed by removing the Resource from CD.

Input parameters

Table 11. Teardown input parameters
Parameter Description

Resource name or pool name

Required. CloudBees CD/RO resource name or pool name.