Google Cloud Build
Steps to Setup Google Cloud Build
This (Cloud Build) is a service that executes builds on GCP infrastructure. Cloud Build can import source code from GCS, Cloud Storage Repo’s, GitHub or BitBucket and execute a build as per the configurations and provide artifacts such as Java archives or docker containers.
Using this CI system on Spinnaker, enables Spinnaker to trigger pipelines upon completion on builds.
Prerequisites:
Ensure to have a valid GCP with a Cloud Build API. API can be enabled with the gcloud command as below
Configure Spinnaker for Google Cloud Build Pub/Sub Notifications:
Google Cloud Build sends Build Notifications when the state of your build changes. Create a pipeline trigger to invoke a pipeline based on the status of your build.
Create a Subscription Object for the cloud-builds topics in your project
Configure Google Cloud Build for Spinnaker, using Halyard by executing the following command
Deploy Spinnaker post execute Steps #1 & #2
Steps to Configure Google Cloud Build Pipeline
In your Pipeline configuration, click the Configuration stage on the far left of the pipeline.
Click Automated Triggers.
In the Type field, select Pub/Sub.
In the Pub/Sub System Type field, select google.
In the Subscription Name field, select your $SUBSCRIPTION_NAME value.
In the Attribute Constraints field, enter status in the Key, and SUCCESS (all upper case) in the Value field.
In the Payload Constraints field, you can enter any of the top-level fields from the Build object documentation as the key, and a Java regular expression as the value.
In the Expected Artifacts field, you can add any build artifacts as expected artifacts. For example, if the build produces a Docker image, you can add an expected artifact of type Docker with a value of gcr.io/my-project-id/my- application:tag (replacing my-project-id, my-application, and tag with appropriate values). You can then use the produced image in downstream stages.
Last updated