Skip to content

Commit bdf03f9

Browse files
committed
remote: implement Google Drive
1 parent cc9411d commit bdf03f9

18 files changed

Lines changed: 1141 additions & 0 deletions

.appveyor.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ environment:
1313
secure: 96fJ3r2i2GohbXHwnSs5N4EplQ7q8YmLpPWM0AC+f4s=
1414
CODECOV_TOKEN:
1515
secure: XN4jRtmGE5Bqg8pPZkwNs7kn3UEI73Rkldqc0MGsQISZBm5TNJZOPofDMc1QnUsf
16+
OAUTH2_TOKEN_FILE_KEY:
17+
secure: cL2KgINnnWhfNVy+lEI/QmA31cKwYojGhFRFs1x0PAkA5QRvZxYTlBX+XpjQYF8k2A6tqYMUWztZt0dXlMKqLVf5aCtg7z2I5AWW5dhGeTY=
18+
OAUTH2_TOKEN_FILE_IV:
19+
secure: 6lKZF5KNCpP80lFZ7a8yFkvcwllt2eoEC7LpSS5Mlwg4ilFsjFVSm+zw2GqA7NKw
1620
AZURE_STORAGE_CONTAINER_NAME: appveyor-tests
1721
AZURE_STORAGE_CONNECTION_STRING: DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;
1822
OSS_ENDPOINT: localhost:50004
@@ -63,6 +67,7 @@ before_test:
6367
- aws configure set aws_secret_access_key "%aws_secret_access_key%"
6468
- aws configure set region us-east-2
6569
- openssl enc -d -aes-256-cbc -md md5 -k "%GCP_CREDS%" -in scripts\ci\gcp-creds.json.enc -out scripts\ci\gcp-creds.json & exit 0
70+
- python scripts\ci\decrypt_gdrive_oauth2.py
6671

6772
test_script:
6873
- python -mtests

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include dvc/remote/gdrive/google-dvc-client-id.json

dvc/config.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,9 @@ class Config(object): # pylint: disable=too-many-instance-attributes
235235
Optional(SECTION_GCP_PROJECTNAME): str,
236236
}
237237

238+
SECTION_GDRIVE_SCOPES = "gdrive_scopes"
239+
SECTION_GDRIVE_CREDENTIALPATH = SECTION_AWS_CREDENTIALPATH
240+
238241
# backward compatibility
239242
SECTION_LOCAL = "local"
240243
SECTION_LOCAL_STORAGEPATH = SECTION_AWS_STORAGEPATH
@@ -266,6 +269,7 @@ class Config(object): # pylint: disable=too-many-instance-attributes
266269
Optional(SECTION_AWS_USE_SSL, default=True): BOOL_SCHEMA,
267270
Optional(SECTION_AWS_SSE): str,
268271
Optional(SECTION_GCP_PROJECTNAME): str,
272+
Optional(SECTION_GDRIVE_SCOPES): str,
269273
Optional(SECTION_CACHE_TYPE): SECTION_CACHE_TYPE_SCHEMA,
270274
Optional(SECTION_CACHE_PROTECTED, default=False): BOOL_SCHEMA,
271275
Optional(SECTION_REMOTE_USER): str,
@@ -290,11 +294,18 @@ class Config(object): # pylint: disable=too-many-instance-attributes
290294
Optional(SECTION_STATE_ROW_CLEANUP_QUOTA): And(Use(int), is_percent),
291295
}
292296

297+
SECTION_OAUTH2 = "oauth2"
298+
SECTION_OAUTH2_FLOW_RUNNER = "flow_runner"
299+
SECTION_OAUTH2_SCHEMA = {
300+
Optional(SECTION_OAUTH2_FLOW_RUNNER): Choices("console", "local")
301+
}
302+
293303
SCHEMA = {
294304
Optional(SECTION_CORE, default={}): SECTION_CORE_SCHEMA,
295305
Optional(Regex(SECTION_REMOTE_REGEX)): SECTION_REMOTE_SCHEMA,
296306
Optional(SECTION_CACHE, default={}): SECTION_CACHE_SCHEMA,
297307
Optional(SECTION_STATE, default={}): SECTION_STATE_SCHEMA,
308+
Optional(SECTION_OAUTH2, default={}): SECTION_OAUTH2_SCHEMA,
298309
# backward compatibility
299310
Optional(SECTION_AWS, default={}): SECTION_AWS_SCHEMA,
300311
Optional(SECTION_GCP, default={}): SECTION_GCP_SCHEMA,

dvc/data_cloud.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from dvc.remote import Remote
99
from dvc.remote.s3 import RemoteS3
1010
from dvc.remote.gs import RemoteGS
11+
from dvc.remote.gdrive import RemoteGDrive
1112
from dvc.remote.azure import RemoteAZURE
1213
from dvc.remote.oss import RemoteOSS
1314
from dvc.remote.ssh import RemoteSSH
@@ -33,6 +34,7 @@ class DataCloud(object):
3334
CLOUD_MAP = {
3435
"aws": RemoteS3,
3536
"gcp": RemoteGS,
37+
"gdrive": RemoteGDrive,
3638
"azure": RemoteAZURE,
3739
"oss": RemoteOSS,
3840
"ssh": RemoteSSH,

dvc/remote/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import unicode_literals
22

33
from dvc.remote.azure import RemoteAZURE
4+
from dvc.remote.gdrive import RemoteGDrive
45
from dvc.remote.gs import RemoteGS
56
from dvc.remote.hdfs import RemoteHDFS
67
from dvc.remote.local import RemoteLOCAL
@@ -15,6 +16,7 @@
1516

1617
REMOTES = [
1718
RemoteAZURE,
19+
RemoteGDrive,
1820
RemoteGS,
1921
RemoteHDFS,
2022
RemoteHTTP,

0 commit comments

Comments
 (0)