-
Notifications
You must be signed in to change notification settings - Fork 39
Add support for autodiscovering default credentials #292
Add support for autodiscovering default credentials #292
Conversation
447916e
to
b9908cb
Compare
Fixed spotless linting errors. |
Are there any tips for debugging these test failures? All the tests pass locally, so need to try and figure out the problem in the build system. |
b9908cb
to
e0ebef5
Compare
Pushed a rebased copy of the changes on top of latest main. |
@markallanson thank you for this PR. It would be great to have the forth mode of "no credentials", which is useful for e.g. working through some proxies, fake-gcs-server, etc. Would you consider adding it? |
I am open to this. Will take a look at the links and implement something the same. |
e0ebef5
to
afe80e2
Compare
This PR has been updated to introduce a new property, When this property is set to |
3c415e9
to
9ce904f
Compare
I have revised the code to avoid the PMD warning regarding inline constants. |
I'll tackle the remaining PMD violations on Monday - they appear to be mostly in code I didn't change as part of this PR, but am happy to fix them. |
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.
Thanks @markallanson! Took a first look at the PR. Overall I agree with the changes and new configs.
Few chores to fix issues on CI:
- Run
./gradlew :spotlessApply
and reformat as needed - Run
./gradlew :pmdTest
before pushing to validate changes. - Avoid using import static of constants, instead use
GcsSinkConfig.<CONSTANT>
on methods to reduce number of imports. - Consider creating a new test class for credentials e.g. GcsSinkConfigCredentialsTest -- and move the ~6 tests related to credentials there.
src/test/java/io/aiven/kafka/connect/gcs/config/GcsSinkConfigTest.java
Outdated
Show resolved
Hide resolved
src/test/java/io/aiven/kafka/connect/gcs/config/GcsSinkConfigTest.java
Outdated
Show resolved
Hide resolved
src/test/java/io/aiven/kafka/connect/gcs/config/GcsSinkConfigTest.java
Outdated
Show resolved
Hide resolved
9ce904f
to
323f706
Compare
@jeqo Addressed all your comments I believe. Thanks for the feedback and helping us get this through, it's very appreciated! |
@jeqo It looks like the default credentials test is failing. Without being able to see any detailed information about the failure I have to assume this is because there's no google credentials in the gitlab runner's environment so the google cloud sdk is throwing a missing credentials error ( In order to avoid going around in circles, can you please let me know which of the two options you'd prefer I use:
|
@markallanson you're right, it's failing because no default credentials were found. |
323f706
to
d1eabbd
Compare
Ok done - converted back to using mocks. |
src/test/java/io/aiven/kafka/connect/gcs/config/GcsSinkCredentialsConfigTest.java
Show resolved
Hide resolved
d1eabbd
to
0be4883
Compare
PR Aiven-Open#228 removed support for autodiscovered credentials by replacing the same configuration with a NoCredentials implementation. This change introduces a new property, `gcs.credentials.default` which matches that supported by the TieredStorageManager for configuring autodiscovery of default credentials. When this property is set to `false`, or omitted entirely the NoCredentials option will be used, but when it is defined and set to `true` it will autodiscover credentials. Closes Aiven-Open#291
0be4883
to
357ba87
Compare
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.
LGMT, thanks @markallanson !
This change reversed one made in PR #228 that broke automatic credential discovery and instead replaced it with a "No Credentials" implementation.
Autodiscovery is a better default, and matches the behaviour documented by the properties
gcs.credentials.path
andgcs.credentials.json
which stateCloses #291