Script collection for using google drive api.
This script clones an google drive folder to hard drive and can be used e.g. for build pipelines.
Works only with authenticated google service accounts.
- Register a google developer account
- Create an service account
- Add the service account to google drive
- Download Service account auth data (json)
- Configure in a folder the source folder(you can extract it from google drive share link option):
{ "sourceFolder":"aaaaaaaa" }
- Configure in ENV as base64 object the service account json(optional under tmp/google_service_account.json)
{
"type": "service_account",
"project_id": "my id",
"private_key_id": "xyyyyy",
"private_key": "-----BEGIN PRIVATE KEY-----mmmmmmmmmmmmmmmmmJ\n-----END PRIVATE KEY-----\n",
"client_email": "myone.iam.gserviceaccount.com",
"client_id": "2828222",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/myone.iam.gserviceaccount.com",
"universe_domain": "googleapis.com"
}
- Run the script, content will be placed under "content"
- cF : changes the config folder location
- sAF: changes the service account file location