This plugin adds Jenkins pipeline steps to interact with the GCP API.
The plugin assumes that you have a GCP account and a project. You will need to create a service account, download the JSON key file locally and upload it to your Jenkins as Secret file. The service account will need to have the necessary permissions to interact with the GCP services you want to use.
- withGCP
- more features to come...
This step will load the credentials file by the id and set the environment variables for the gcloud command to use. In particular, it will set the GOOGLE_APPLICATION_CREDENTIALS
environment variable to the path of the credentials file. And will also attempt to extract the project_id
from the file and set it as CLOUDSDK_CORE_PROJECT
environment variable.
withGCP(credentialsId: "credentials-id") {
// run gcloud commands here
}
Refer to our contribution guidelines
Licensed under MIT, see LICENSE