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

Add the ability to attach a saved image archive as a project artifact #1210

Merged
merged 3 commits into from
Apr 21, 2019

Conversation

wrosenuance
Copy link
Contributor

This PR is to add the ability to attach an image archive produced by docker:save to the project as an artifact. Currently this is not possible and archives have to be attached using something like build-helper-maven-plugin.

To avoid conflict with docker:source, the default attach classifier is archive (or archive-<saveAlias>), instead of docker (or docker-<alias>) as used by that mojo.

@codecov
Copy link

codecov bot commented Apr 18, 2019

Codecov Report

Merging #1210 into master will increase coverage by 0.43%.
The diff coverage is 71.42%.

@@             Coverage Diff              @@
##             master    #1210      +/-   ##
============================================
+ Coverage     53.05%   53.48%   +0.43%     
- Complexity     1532     1553      +21     
============================================
  Files           150      150              
  Lines          7990     7996       +6     
  Branches       1202     1204       +2     
============================================
+ Hits           4239     4277      +38     
+ Misses         3333     3297      -36     
- Partials        418      422       +4
Impacted Files Coverage Δ Complexity Δ
...rc/main/java/io/fabric8/maven/docker/SaveMojo.java 75% <71.42%> (+50.75%) 33 <2> (+21) ⬆️

1 similar comment
@codecov
Copy link

codecov bot commented Apr 18, 2019

Codecov Report

Merging #1210 into master will increase coverage by 0.43%.
The diff coverage is 71.42%.

@@             Coverage Diff              @@
##             master    #1210      +/-   ##
============================================
+ Coverage     53.05%   53.48%   +0.43%     
- Complexity     1532     1553      +21     
============================================
  Files           150      150              
  Lines          7990     7996       +6     
  Branches       1202     1204       +2     
============================================
+ Hits           4239     4277      +38     
+ Misses         3333     3297      -36     
- Partials        418      422       +4
Impacted Files Coverage Δ Complexity Δ
...rc/main/java/io/fabric8/maven/docker/SaveMojo.java 75% <71.42%> (+50.75%) 33 <2> (+21) ⬆️

@codecov
Copy link

codecov bot commented Apr 18, 2019

Codecov Report

Merging #1210 into master will increase coverage by 0.18%.
The diff coverage is 91.66%.

@@             Coverage Diff              @@
##             master    #1210      +/-   ##
============================================
+ Coverage     53.33%   53.51%   +0.18%     
+ Complexity     1595     1554      -41     
============================================
  Files           154      150       -4     
  Lines          8166     7998     -168     
  Branches       1249     1204      -45     
============================================
- Hits           4355     4280      -75     
+ Misses         3379     3296      -83     
+ Partials        432      422      -10
Impacted Files Coverage Δ Complexity Δ
...rc/main/java/io/fabric8/maven/docker/SaveMojo.java 77.02% <91.66%> (+52.78%) 34 <3> (+22) ⬆️
...8/maven/docker/config/BuildImageConfiguration.java 84.44% <0%> (-0.26%) 71% <0%> (-1%)
...config/handler/property/PropertyConfigHandler.java 74.89% <0%> (-0.11%) 119% <0%> (-1%)
...aven/docker/config/handler/property/ConfigKey.java 100% <0%> (ø) 10% <0%> (ø) ⬇️
...abric8/maven/docker/config/ArchiveCompression.java 61.9% <0%> (ø) 8% <0%> (ø) ⬇️
...ven/docker/access/hc/DockerAccessWithHcClient.java 14.23% <0%> (ø) 13% <0%> (ø) ⬇️
...io/fabric8/maven/docker/util/ImageArchiveUtil.java
.../io/fabric8/maven/docker/util/NamePatternUtil.java
...docker/model/ImageArchiveManifestEntryAdapter.java
...aven/docker/model/ImageArchiveManifestAdapter.java
... and 2 more

@codecov
Copy link

codecov bot commented Apr 18, 2019

Codecov Report

Merging #1210 into master will increase coverage by 0.43%.
The diff coverage is 71.42%.

@@             Coverage Diff              @@
##             master    #1210      +/-   ##
============================================
+ Coverage     53.05%   53.48%   +0.43%     
- Complexity     1532     1553      +21     
============================================
  Files           150      150              
  Lines          7990     7996       +6     
  Branches       1202     1204       +2     
============================================
+ Hits           4239     4277      +38     
+ Misses         3333     3297      -36     
- Partials        418      422       +4
Impacted Files Coverage Δ Complexity Δ
...rc/main/java/io/fabric8/maven/docker/SaveMojo.java 75% <71.42%> (+50.75%) 33 <2> (+21) ⬆️

Signed-off-by: William Rose <william.rose@nuance.com>
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, but i have a minor suggestion how to model the configuration.

private boolean saveAttach;

@Parameter(property = "docker.save.classifier")
private String saveClassifier;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder whether we could combine both properties (as I'm always trying to keep the configuration surface small). What's about having a single 'saveAttach' string property, which can be 'true/false' (then a default classifier is select for 'true') or any other value in which case it enables the featue and uses that classifier ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can, although I always worry about making something that looks boolean, but isn't, because of previous mockery.

I could make specifying a non-empty saveClassifier mean "attach with this classifier", and not provide the default logic, since by the time you write <saveAttach>true</saveAttach>, you probably could have written <saveClassifier>archive</saveClassifier>, and we could use %a for the alias (as in <saveClassifier>archive-%a</saveClassifier> or -Ddocker.save.classifier=archive-%a)?

Copy link
Collaborator

Choose a reason for hiding this comment

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

We can, although I always worry about making something that looks boolean, but isn't, because of previous mockery.

I could make specifying a non-empty saveClassifier mean "attach with this classifier", and not provide the default logic, since by the time you write <saveAttach>true</saveAttach>, you probably could have written <saveClassifier>archive</saveClassifier>, and we could use %a for the alias (as in <saveClassifier>archive-%a</saveClassifier> or -Ddocker.save.classifier=archive-%a)?

Fair enough. I think having no default name is fine as adding one is trivial (also saves the user a documentation lookup for finding out what the default would be).

Signed-off-by: William Rose <william.rose@nuance.com>
@wrosenuance
Copy link
Contributor Author

I added a commit to remove saveAttach in favour of just saveClassifier. I didn't squash this with the previous commit yet as I think if you merge PR #1208 I will need to resolve a conflict in the changelog, so I can squash it all then.

wrosenuance added a commit to wrosenuance/docker-maven-plugin that referenced this pull request Apr 20, 2019
…hives.

This PR implements the proposed pattern matching that scans the archive
prior to loading and then creates a tag from the image name loaded from
the archive to the image name configured in the Maven project.

Signed-off-by: William Rose <william.rose@nuance.com>

Add the ability to attach a saved image archive as a project artifact.

Signed-off-by: William Rose <william.rose@nuance.com>

PR fabric8io#1210 Remove saveAttach and just use saveClassifier.

Signed-off-by: William Rose <william.rose@nuance.com>

Issue fabric8io#1207 Specify image name pattern when loading from archives.

This PR implements the proposed pattern matching that scans the archive
prior to loading and then creates a tag from the image name loaded from
the archive to the image name configured in the Maven project.

Signed-off-by: William Rose <william.rose@nuance.com>
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.

Thanks ! lgtm

@rhuss rhuss merged commit 885954a into fabric8io:master Apr 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants