It is best to use a “service account” to authenticate gcloud / gsutil with GCS. Basic steps: use the generated JSON private key as instructed here:
https://cloud.google.com/storage/docs/authentication
Copy this key to the place where the Jenkins user can read it, and how the Jenkins user starts
gcloud auth activate-service-account ...
(see https://cloud.google.com/storage/docs/authentication#service_accounts ). Please note that JSON key file support is fairly new, and you will need an updated version of gcloud.
From there, your Jenkins process should have access to GCS, as usual.
The key file should have the following format:
{ "private_key_id": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "private_key": "-----BEGIN PRIVATE KEY-----\n ... \n-----END PRIVATE KEY-----\n", "client_email": " ...@developer.gserviceaccount.com ", "client_id": "..." "type": "service_account" }
source share