Skip to content
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

Extended authentication #663

Merged
merged 5 commits into from
Jan 2, 2017
Merged

Extended authentication #663

merged 5 commits into from
Jan 2, 2017

Conversation

chonton
Copy link
Contributor

@chonton chonton commented Dec 17, 2016

AWS ECR key exchange
closes #637
replaces PR #646

AWS ECR key exchange
closes #637

Signed-off-by: Chas Honton <[email protected]>
@codecov-io
Copy link

codecov-io commented Dec 17, 2016

Current coverage is 47.69% (diff: 80.70%)

Merging #663 into master will increase coverage by 1.13%

@@             master       #663   diff @@
==========================================
  Files           119        122     +3   
  Lines          6065       6267   +202   
  Methods           0          0          
  Messages          0          0          
  Branches       1045       1063    +18   
==========================================
+ Hits           2824       2989   +165   
- Misses         2992       3016    +24   
- Partials        249        262    +13   
Diff Coverage File Path
0% ...java/io/fabric8/maven/docker/AbstractDockerMojo.java
••••••• 72% new ...bric8/maven/docker/access/ecr/AwsSigner4Request.java
••••••• 74% .../io/fabric8/maven/docker/util/AuthConfigFactory.java
•••••••• 83% new ...a/io/fabric8/maven/docker/access/ecr/AwsSigner4.java
••••••••• 92% new ...fabric8/maven/docker/access/ecr/EcrExtendedAuth.java
•••••••••• 100% .../java/io/fabric8/maven/docker/access/AuthConfig.java

Sunburst

Powered by Codecov. Last update cc21086...41c481b

@rhuss
Copy link
Collaborator

rhuss commented Dec 17, 2016

Thanks !

@chonton
Copy link
Contributor Author

chonton commented Dec 17, 2016

Working on unit tests to extend coverage

rhuss added a commit to rhuss/docker-maven-plugin that referenced this pull request Dec 19, 2016
* Simplified some methods
* Added a unit test
* Minor tweaks
* Only one entry point `createAuthConfig()`
Copy link
Collaborator

@rhuss rhuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, with some minor change requests. I submitted a PR to your branch at https://github.com/chonton/docker-maven-plugin/pull/1 (which unfortunately contains also some updates happened on the main branch in the meantime. Also I was not able to update this PR from my branch).

I also added a unit test. It would be awesome if you could some unit tests for AwsSigner4 and EcrExtendedAuth as it seems to be easily testable, but contains some complex logic, too.

}
}

private static void squeezeWhite(StringBuilder dst, String src) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand the method right, this could be replaced by src.replaceAll("\\s+"," ").trim() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}
StringBuilder builder = unique.get(key);
if (builder != null) {
if (builder.length() > 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be simplified by using StringUtils.join()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactored this method. complicated by fact it was trying to accomplish two tasks in same loop.

public AuthConfig createAuthConfig(boolean isPush, boolean skipExtendedAuth, Map authConfig, Settings settings, String user, String registry)
throws MojoExecutionException {

AuthConfig ret = createAuthConfig(isPush, authConfig, settings, user, registry);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rename the original createAuthConfig() to a private method with a distinguished name to clarify that this should be the single entry point.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@chonton
Copy link
Contributor Author

chonton commented Dec 31, 2016

Ping. Any additional changes needed?

@rhuss
Copy link
Collaborator

rhuss commented Jan 2, 2017

Just back from holidays, I will have a look today.

@rhuss
Copy link
Collaborator

rhuss commented Jan 2, 2017

[merge]

@fusesource-ci fusesource-ci merged commit c77945e into fabric8io:master Jan 2, 2017
rhuss added a commit to rhuss/docker-maven-plugin that referenced this pull request Jan 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AWS ECR login credential exchange
4 participants