cloud-builders-community icon indicating copy to clipboard operation
cloud-builders-community copied to clipboard

Gcloud commands cannot be run from your Make image

Open joe-wroe-dft opened this issue 4 years ago • 0 comments

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)

  1. Add a Makefile to your application that contains a task that runs a gcloud command, e.g.:

In your Makefile

gcloud_help:
    gcloud help
  1. 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
  1. 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

joe-wroe-dft avatar Jan 25 '21 15:01 joe-wroe-dft