> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# circleci/gcp-cli

Easily install and configure the Google Cloud CLI (gcloud CLI).
Supports the Docker and Machine executors.


## Commands

### install

Install the gcloud CLI. When installing within the Docker executor, the
install will only occur if the CLI isn't already installed. If installing in
a Linux machine image, it will remove the pre-installed version and instead
install the version specified by this orb.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `components` | string |  | The list of gcloud components to install. Space separated. See https://cloud.google.com/sdk/docs/components for additional info.
 |
| `skip_installation` | boolean | false | Useful flag to use when the executor already contains a valid gcloud installation.
 |
| `version` | string | latest | The version of the gcloud CLI to install. If left to "latest", the latest version will be installed. Otherwise, provide the full version number as it appears in the URL on this page: https://cloud.google.com/sdk/docs/downloads-versioned-archives"
 |

### setup

Install and initialize the gcloud CLI. When installing within the Docker executor, the
install will only occur if the CLI isn't already installed. If installing in
a Linux machine image, it will remove the pre_installed version and instead
install the version specified by this orb.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `components` | string |  | The list of gcloud components to install. Space separated. See https://cloud.google.com/sdk/docs/components for additional info.
 |
| `gcloud_service_key` | env_var_name | GCLOUD_SERVICE_KEY | Name of environment variable storing the full service key JSON file
for the Google project.
 |
| `gcp_cred_config_file_path` | string | ~/gcp_cred_config.json | Output location of OIDC credentials. |
| `google_compute_region` | env_var_name | GOOGLE_COMPUTE_REGION | Name of environment variable storing the Google compute region to set as
default for the gcloud CLI.
 |
| `google_compute_zone` | env_var_name | GOOGLE_COMPUTE_ZONE | Name of environment variable storing the Google compute zone to set as
default for the gcloud CLI.
 |
| `google_project_id` | env_var_name | GOOGLE_PROJECT_ID | Name of environment variable storing the Google project ID to set as
default for the gcloud CLI.
 |
| `google_project_number` | env_var_name | GOOGLE_PROJECT_NUMBER | Name of environment variable storing the Google project number
used to configure OIDC.
 |
| `service_account_email` | env_var_name | OIDC_SERVICE_ACCOUNT_EMAIL | Environment variable containing OIDC service account email. |
| `skip_install` | boolean | false | Set to true, if want to install step |
| `use_oidc` | boolean | false | Set to true to enable OIDC |
| `version` | string | latest | The version of the gcloud CLI to install. If left to "latest", the latest version will be installed. Otherwise, provide the full version number as it appears in the URL on this page: https://cloud.google.com/sdk/docs/downloads-versioned-archives
 |
| `workload_identity_pool_id` | env_var_name | OIDC_WIP_ID | Environment variable containing OIDC configured workload identity pool is stored.
 |
| `workload_identity_pool_provider_id` | env_var_name | OIDC_WIP_PROVIDER_ID | Environment variable containing OIDC configured workload identity pool provider ID is stored.
 |

## Executors

### default

The default executor is the CircleCI Python Convenience Image.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `version` | string | 3.13 | Python version to use. Take into account the versions of Python available
from CircleCI (https://hub.docker.com/r/cimg/python/tags) as well as what
is supported by gcloud CLI itself (https://cloud.google.com/sdk/docs/install).
 |

### google

The official Google Docker image with gcloud SDK and CLI pre-installed.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `sdk-version` | string | latest | What version of the Google Cloud SDK Docker image? For full options, see https://hub.docker.com/r/google/cloud-sdk/tags
 |

### machine

CircleCI's machine executor:
https://circleci.com/docs/2.0/executor-types/#using-machine


| Parameter | Type | Default | Description |
|---|---|---|---|
| `image` | string | ubuntu-2204:current | Which machine executor image to use. For details, see
https://circleci.com/docs/2.0/configuration-reference/#machine
 |

## Examples

### setup

Install and initalize the gcloud CLI.

```yaml
version: '2.1'
orbs:
  gcp-cli: circleci/gcp-cli@3.2.2
jobs:
  use-gcp:
    executor: gcp-cli/default
    steps:
      - gcp-cli/setup:
          version: 404.0.0
workflows:
  install_and_configure_cli:
    jobs:
      - use-gcp:
          context: myContext
```