View Source

h2. GCP cloud profile

Cloud profiles rely on cloud providers to do its job. QuickBuild 12.0 ships with the GCP cloud provider. To use it, one has to enable the GCP plugin by providing a json file containing private key of a GCP service account in _Administration/Plugin Management_ page as demonstrated below:
!gcp_config.png!
The GCP service account should have permission to launch/access/delete compute instances in particular GCP projects. Check [here|https://cloud.google.com/iam/docs/creating-managing-service-accounts] on how to create service account and [here|https://cloud.google.com/iam/docs/creating-managing-service-account-keys] on how to obtain json file containing private key of the service account

Also make sure to [enable GCP compute engine API|https://cloud.google.com/apis/docs/getting-started#enabling_apis]

Then one can follow the [cloud profiles|Working with Cloud Profiles] guide to create cloud profiles using GCP launchers like below:
!gcp_launcher.png!

{anchor:create build agent instance template}
h2. Create build agent instance template
An instance template is required to set up GCP cloud profile. This instance template should be pre-configured with your build environment as well as QuickBuild build agent. To create an instance template able to be used by GCP cloud profile, please do the following:
# Manually launch a compute instance of desired platform using your GCP account, and install Java Runtime Environment version 8 or higher on the launched instance. You may also want to install other software required by your build to this instance.
# Download QuickBuild build agent package from Grid page, and upload it to launched instance above.
# Login to the compute instance and extract build agent package to your chosen agent installation directory.
# Edit file _<agent install dir>/conf/wrapper.conf_ to define property _wrapper.java.command_ to point to java binary if it is not in system path.
# Edit file _<agent install dir>/conf/node.properties_ to configure QuickBuild server URL. You may also run _<agent install dir>/bin/config.(bat|sh)_ to config node properties such as SSL setting. However this program requires GUI terminal, and if your console does not have that facility, you may run this program at your desktop to populate the node.properties, then transfer this file to launched instance.
# Edit file _<agent install dir>/conf/attributes.properties_ to define necessary user attributes for the build agent.
# For Unix instances, edit file _<agent install dir>/bin/agent.sh_ to uncomment below line and assign an OS user to run the agent in service mode.
{code}
#RUN_AS_USER=
{code}
The service user should own the agent installation directory.
# Run _<agent install dir>/bin/agent.(sh|bat) install_ to install agent as system service.
# Configure GCP firewall of the network associated with the launched instance to allow incoming connections to agent port.
# Restart launched node. After the system comes up, the build agent should be started automatically and will contact QuickBuild server to download necessary plugins. You may check file _<agent install dir>/logs/console.log_ for the progress and possible errors.
# If agent starts up normally, you should be able to see this agent appears at _unauthorized nodes_ list at grid page. Authorize the node and wait for a while to see if it can come active.
# If the agent comes active, stop the compute instance, and create a storage image from the instance disk.
# Create an instance template using the storage image, and specify desired machine type and disk type.
# You can define multiple instance templates for multiple cloud profiles to satisfy different build requirements.