Configuring GCS Artifact Credentials

Spinnaker supports using GCS objects as artifacts.

Spinnaker stages that read data from artifacts can consume GCS objects as artifacts.

Prerequisites

You need a Google Cloud Platform (GCP) project to host a bucket in. The next steps assume you’ve already created a project , and installed <code>gcloud</code> . You can check that gcloud is installed and authenticated by running:

  1. gcloud info

Downloading credentials

Spinnaker needs a service account to authenticate as against GCP, with the roles/storage.admin role enabled. If you don’t already have such a service account with the corresponding JSON key downloaded, you can run the following commands to do so:

  1. SERVICE_ACCOUNT_NAME=spin-gcs-artifacts-account
  2. SERVICE_ACCOUNT_DEST=~/.gcp/gcs-artifacts-account.json
  3. gcloud iam service-accounts create \
  4. $SERVICE_ACCOUNT_NAME \
  5. --display-name $SERVICE_ACCOUNT_NAME
  6. SA_EMAIL=$(gcloud iam service-accounts list \
  7. --filter="displayName:$SERVICE_ACCOUNT_NAME" \
  8. --format='value(email)')
  9. PROJECT=$(gcloud config get-value project)
  10. gcloud projects add-iam-policy-binding $PROJECT \
  11. --role roles/storage.admin --member serviceAccount:$SA_EMAIL
  12. mkdir -p $(dirname $SERVICE_ACCOUNT_DEST)
  13. gcloud iam service-accounts keys create $SERVICE_ACCOUNT_DEST \
  14. --iam-account $SA_EMAIL

Once you have run these commands, your GCS JSON key is sitting in a file called $SERVICE_ACCOUNT_DEST.

Editing Your Artifact Settings

All that’s required are the following values:

  1. # Same as in Prerequisites section above
  2. SERVICE_ACCOUNT_DEST=~/.gcp/gcs-artifacts-account.json
  3. ARTIFACT_ACCOUNT_NAME=my-gcs-artifact-account

First, enable artifact support .

Next, add an artifact account:

  1. hal config artifact gcs account add $ARTIFACT_ACCOUNT_NAME \
  2. --json-path $SERVICE_ACCOUNT_DEST

And enable GCS artifact support:

  1. hal config artifact gcs enable

There are more options described here if you need more control over your configuration.

Last modified May 7, 2021: docs(migration): fix imgs and links (9a18ce6)