cloud-builders-community
cloud-builders-community copied to clipboard
Gcloud commands cannot be run from your Make image
gcr.io/cloud-builders-community/make
Expected Behavior
To be able to use a Makefile that contains gcloud commands (such as the gcloud KMS API) when using this image in our pipeline instead of the Google Cloud provided gcr.io/cloud-builders/gcloud
.
Actual Behavior
We set up our pipeline to pull and use the provided gcr.io/cloud-builders-community/make
image. When we run our pipeline which contains the following Make task:
gcloud kms decrypt --location=$(REGION) ... # some more secret flags, shhh!
We find that the gcloud command is not installed on this image.
Steps to Reproduce the Problem
(With the Make image set up correctly in your GCP project)
- Add a Makefile to your application that contains a task that runs a gcloud command, e.g.:
In your Makefile
gcloud_help:
gcloud help
- Add a pipeline step to your cloudbuild.yaml that runs this Make command:
In cloudbuild.yaml
steps:
- id: "cloud help"
name: gcr.io/$PROJECT_ID/make
args:
- gcloud_help
- push and run your pipeline. It should fail with a message similar to the following:
In CloudBuild console
Step #0 - "cloud help": make[1]: gcloud: Command not found