Gcloud: not found

Hey Guys,

I’m just attempting to activate CI/CD for an second microservice in my stack. I have successfully implemented CI and CD to a GCP kube cluster but I’m hitting a brick wall on my second project.

Using…

image: docker:stable

stages:
  - test
  - build
  - release
  - deploy

services:
  - docker:dind

The pipeline is failing on

gcloud: not found

When I’m attempting to activate the service account. I’ve checked my other project with an identical gitlab-ci.yaml and everything is working as expected. Checking the logs gives me the version of the same runner and I’m at a bit of a loss as to why this isn’t working. Any ideas?

I’ve cleared runner caches etc etc.

For info my gcp init is this:

function init_gcp() {
    echo ${GKE_SERVICE_ACCOUNT} | base64 -d > .gcp-auth.json
    gcloud auth activate-service-account --key-file .gcp-auth.json --project=${GKE_PROJECT}
    gcloud container clusters get-credentials ${GKE_CLUSTER_NAME} --zone ${GKE_ZONE} --project ${GKE_PROJECT}
}

Cheers.

Nick.

Why not using google/cloud-sdk image? It has gcloud command.

https://hub.docker.com/r/google/cloud-sdk/

Yeah I’ve tried that before. Unfortunately getting the gsdk image ready for the rest of the build (being a “lite” image) makes everything else more tricky.

I’m solving now by rolling my own image. What I don’t understand is why my other builds aren’t failing with the same images.