I'm looking to run a gcloud
command as part of one of my jobs. Of course, when I initially ran the job I got the error 'command not found'. CircleCI suggests using the gcloud-cli
orb to install and initialise the gcloud cli.
My workflow looks like this:
workflows:
build and deploy:
jobs:
- gcp-cli/install_and_initialize_cli:
gcloud-service-key: insert_key_as_env_variable
google-project-id: my_project_id
google-compute-zone: my_compute_zone
- build_job:
requires:
- gcp-cli/install_and_initialize_cli
The gcp-cli/install_and_initialize_cli
step works perfectly well but when I run the build_job
it says gcloud
command not found. I assumed that running the gcp-cli orb would make the gcloud-cli available for all downstream jobs.
Is there a way to make the gcloud-cli available to downstream jobs? I have tried to persist/attach workspaces but with no success (doesn't mean this isn't a possible solution).
The other possible solution is to find a way to run the gcp-cli orb as part of my build_job
, but I can't quite figure out how to do that either.
For reference my (very stripped down) build_job
:
build_job:
docker:
- image: circleci/node
steps:
- run: gcloud auth configure-docker // FAILS HERE - moved to top on purpose
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: Install Docker Compose
command: |
curl -L https://github.com/docker/compose/releases/download/1.19.0/docker-compose-`uname -s`-`uname -m` > ~/docker-compose
chmod +x ~/docker-compose
sudo mv ~/docker-compose /usr/local/bin/docker-compose
- setup_remote_docker
....