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

jib-layer-filter-extension-maven: optionally create separate layers for dependencies from parent POM #76

Merged
merged 14 commits into from
Mar 4, 2021

Conversation

stefanocke
Copy link
Contributor

@stefanocke stefanocke commented Feb 21, 2021

I would like to achieve the following:

  • determine the dependencies (including transitive) that come from the parent pom
  • put them into one or more separate layers

The idea is that the parent pom defines the "company / project standard" which rarely changes.
While the existing jib-layer-filter-extension-maven is already quite useful, it would be still quite cumbersome to write globs for all direct and transitive dependencies.
For example, think about having some Spring Boot starters in the parent pom for all your microservice, but some other Spring Boot starters are optional and only used by specific microservices. You not only would need quite exact globs for the Spring Boot starters then, but also for their manyfold transitive dependencies.

See also GoogleContainerTools/jib#3036 which is required for this pull request to work.

@google-cla google-cla bot added the cla: yes label Feb 21, 2021
@codecov
Copy link

codecov bot commented Feb 21, 2021

Codecov Report

❗ No coverage uploaded for pull request base (master@e9968f7). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #76   +/-   ##
=========================================
  Coverage          ?   84.89%           
  Complexity        ?      154           
=========================================
  Files             ?       14           
  Lines             ?      629           
  Branches          ?       71           
=========================================
  Hits              ?      534           
  Misses            ?       83           
  Partials          ?       12           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e9968f7...ce81a92. Read the comment docs.

@stefanocke stefanocke marked this pull request as draft February 21, 2021 18:01
@stefanocke stefanocke changed the title Optionally create separate layers for dependencies from parent POM jib-layer-filter-extension-maven: optionally create separate layers for dependencies from parent POM Feb 21, 2021
Copy link
Member

@chanseokoh chanseokoh left a comment

Choose a reason for hiding this comment

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

Thank a lot for this! I did a quick scan on this and added comments about some technical stuff. I will continue to look into the PR.

@stefanocke
Copy link
Contributor Author

@chanseokoh , thank you for your detailed review. I will walk through it in the very next days.

@stefanocke
Copy link
Contributor Author

stefanocke commented Feb 26, 2021

Reminder to myself: When resolving parent dependencies, active profiles have to be considered.

... Okay, this does already work, since the active profiles come form the MavenProject. And in the parent project, that is passed into the DependencyResoultionRequest, the activeProfiles are set.

to not depend on "app/libs", which is connfigurable in jib
use source file name for matching instead of filename from extraction
path
Especially on the Artifact side that means that the filename is not
"constructed" anymore by the extension. We make no assumption about the
structure of the source file name or path.
The only assumption that is left is, that Maven will resolve to the same
file path, if the same artifact coordinates are resolved multiple times
within a build / session.
@stefanocke stefanocke marked this pull request as ready for review February 27, 2021 12:05
Copy link
Member

@chanseokoh chanseokoh left a comment

Choose a reason for hiding this comment

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

LGTM in general. Only some minor comments.

Copy link
Member

@chanseokoh chanseokoh left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for this awesome contribution!

I will merge this later this week to give you some time for any last-minute changes, just in case.

@stefanocke
Copy link
Contributor Author

That sounds great. Thank you for supporting this PR and helping to improve it.

@chanseokoh
Copy link
Member

You're welcome. Just asking: are you interested in updating the "Writing Your Own Extensions" doc in a separate PR to add the new JSR350 / Sisu approach (while leaving the JDK service locator method for now)?

@stefanocke
Copy link
Contributor Author

Yes, I think I should do this. Will try in the next days.

@chanseokoh
Copy link
Member

Thanks!

@chanseokoh chanseokoh merged commit 250b7b5 into GoogleContainerTools:master Mar 4, 2021
stefanocke added a commit to stefanocke/jib-extensions that referenced this pull request Mar 6, 2021
stefanocke added a commit to stefanocke/jib-extensions that referenced this pull request Mar 6, 2021
stefanocke added a commit to stefanocke/jib-extensions that referenced this pull request Mar 6, 2021
chanseokoh added a commit that referenced this pull request Apr 9, 2021
…eating parent dependency layers in jib-layer-filter-extension-maven (#81)

* Documentation for
GoogleContainerTools/jib#3036 and
#76

* Update README.md

Co-authored-by: Chanseok Oh <chanseok@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants