-
-
Notifications
You must be signed in to change notification settings - Fork 113
feat: Add Google Drive storage backend with custom endpoint support #613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Implement Google Drive storage backend using service account authentication - Add support for custom Google Drive API endpoints for testing - Include comprehensive test setup with mock services - Add configuration options for Google Drive credentials and folder ID - Update documentation with Google Drive configuration examples
Thanks a lot for following up on this so quickly. Two questions before I have a closer look:
|
@@ -225,6 +227,21 @@ func (s *script) init() error { | |||
s.storages = append(s.storages, dropboxBackend) | |||
} | |||
|
|||
if s.c.GoogleDriveCredentialsJSON != "" { | |||
googleDriveConfig := googledrive.Config{ | |||
CredentialsJSON: s.c.GoogleDriveCredentialsJSON, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it also possible to pass the JSON as a string instead of as a file location here? In case yes, we could leverage the existing configuration mechanism so that:
- People can pass a JSON string to
GOOGLE_DRIVE_CREDENTIALS_JSON
if they don't want to / can't mount the file - People can pass a file location using
GOOGLE_DRIVE_CREDENTIALS_JSON_FILE
which is automatically provided by the current configuration package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to aim to only accept FILE, as it is an oddly long string to be putting on an envvar, but gemini got lost at some point and added it for me.
Also, I know _FILE is a pattern everywhere, but I have not seen it on other variables here, should we add it?
Let me know if you think just the JSON is enough, or if you prefer both so I an either remove that logic or fix the envvars and docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I know _FILE is a pattern everywhere, but I have not seen it on other variables here, should we add it?
_FILE
is supported automatically. If you define FOO_BAR
, FOO_BAR_FILE
will be accepted as well. I would also think passing the entire JSON blob as an env var will rarely be done, but like this, it'd be consistent with what's already there.
The tests were mainly copied from dropbox. But they were anchored by messages from storage.go, so I think it would be better to decouple it and fail with any ERROR message. I'm not sure if its a pattern, but the For the lint issue, I was about to ask for your help, but then I asked Gemini and he did this. |
This must mean that now the
Exactly this. Thanks, |
Looking into the tests more closely, I think the underlying problem is that the mock is not fully featured yet. What the test tries to do:
What the test currently does:
This is why there are assertions on the log output which are currently missing from the googledrive test case. An alternative would be looking at the files itself which is what the s3 test case does. |
hey @m90 thanks for your kind review. |
hey @m90, comming back to it =]
I took a better look at dropbox, and it seems like it is the same behavior =/
Without further looking into code, I guess we don't want non-zero exit codes in order to prevent the container from dying due to one backup failure, so the schedule (and possibly other backends) can carry on, am I right? With that guess, I figured it would be good to test this failure on a normal run as well, but it didn't fail, it actually behaved like I was expecting the tests to (keeping the container alive and displaying the error message): screenshot I have yet to learn how to properly debug golang, so my hope is that you can easily spot what is going on 😅 Any ideas? I didn't have much time this weekend 😢 so I couldn't look into the other 2 issues, but:
|
I think the Dropbox tests work as expected. When querying for what files exist, the mock will always return two existing files, which are backdated by these lines:
so the tests go kind of like this
When I change the mock like you shown in the screenshot, I get a failing test (exits 1), which is expected.
Since all test cases use Even if it's not perfect, I think we could get the same done for Google Drive by adding a proper response here: https://github.com/offen/docker-volume-backup/pull/613/files#diff-3af2262cc057a6c13dfc4c4b0924326705ddfee2a56a7492bc7690194437dc73R95-R119 |
Relates to #471