CircleCI-Public / gcp-cli-orb

Install and configure the Google Cloud CLI (gcloud)
https://circleci.com/orbs/registry/orb/circleci/gcp-cli
MIT License
9 stars 32 forks source link

Gcloud installation not recognized in GKE runners #46

Closed mccall114 closed 1 year ago

mccall114 commented 2 years ago

Orb version

2.4.1

What happened

In the step to install the latest gcloud version, we are seeing this when running on-prem CircleCI runners in our GKE cluster:

if grep 'docker\|lxc' /proc/1/cgroup > /dev/null 2>&1; then
  if [[ $(command -v gcloud) == "" ]]; then
    install
  else
    echo "gcloud CLI is already installed."
  fi
else
  echo "----------------------------------------------------------------------------------------------------"
  echo "this is a machine executor job, replacing default installation of gcloud CLI"
  echo "----------------------------------------------------------------------------------------------------"
  sudo rm -rf /opt/google-cloud-sdk
  install
fi

----------------------------------------------------------------------------------------------------
this is a machine executor job, replacing default installation of gcloud CLI
----------------------------------------------------------------------------------------------------
CircleCI received exit code 0

Expected behavior

We are using an image that has gcloud installed, so we expect it to skip this step. But the code is grepping for docker or lxc (grep 'docker\|lxc' /proc/1/cgroup). In order to work with our GKE runners, we'd need to include containerd (grep 'docker\|lxc\|containerd' /proc/1/cgroup).