Skip to content
Snippets Groups Projects
Commit 38708a6a authored by Giuseppe Carboni's avatar Giuseppe Carboni
Browse files

Removed unnecessary script for CI

parent 6fe21d90
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
from google.oauth2.credentials import Credentials
from google.auth.transport.requests import Request
from googleapiclient.discovery import build
from googleapiclient.http import MediaFileUpload
import os
TOKEN_FILE = 'token.json'
VM_FILE_PATH = '/home/runner/discos_manager.ova'
SCOPES = [
'https://www.googleapis.com/auth/drive',
'https://www.googleapis.com/auth/drive.file'
]
# Authenticate with the token and eventually update it
creds = Credentials.from_authorized_user_file(TOKEN_FILE, SCOPES)
if creds.expired and creds.refresh_token:
creds.refresh(Request())
# Prepare the files to be uploaded
service = build('drive', 'v3', credentials=creds)
vm_media = MediaFileUpload(VM_FILE_PATH, resumable=True)
service.files().update(
fileId=os.environ.get('DEPLOYED_VM_GDRIVE_ID'),
media_body=vm_media,
fields='id'
).execute()
# Finally update the token file
with open(TOKEN_FILE, 'w') as tokenfile:
tokenfile.write(creds.to_json())
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment