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 option so reactor builds only pull an image once #504

Closed
jgangemi opened this issue Jul 6, 2016 · 6 comments
Closed

add option so reactor builds only pull an image once #504

jgangemi opened this issue Jul 6, 2016 · 6 comments
Assignees
Labels
Milestone

Comments

@jgangemi
Copy link
Collaborator

jgangemi commented Jul 6, 2016

we have a rather large reactor build at the day job that uses the same container(s) over and over for integration testing. we have autoPull set to always to ensure we always get the latest container when the build starts but then each module in the build pulls the container over and over again which is somewhat needless and increases an already lengthy build time.

an additional option should be added (i'm open to naming) that will allow reactor projects to skip pulling images if it has been pulled by a previous module.

overloading autoPull w/ some additional values is also another option although i feel it could be confusing. i am happy to go w/ whatever the consensus is.

@jgangemi jgangemi self-assigned this Jul 6, 2016
@rhuss
Copy link
Collaborator

rhuss commented Jul 6, 2016

What about adding an AutoPullMode.ONCE ? This would mean always, but only once per build (we could store a Set with fetched images in the MavenSession).

@jgangemi
Copy link
Collaborator Author

jgangemi commented Jul 6, 2016

that works for me - i'll have a PR for this (and hopefully a couple other things, separate of course) in the next few days.

@rhuss
Copy link
Collaborator

rhuss commented Jul 6, 2016

cool ;-)

@jgangemi
Copy link
Collaborator Author

jgangemi commented Jul 7, 2016

i can't find anywhere on the MavenSession that i can do this. the best option i have figured out thus far based on looking at the buildnumber is to get the list of projects in the reactor and set the image name as a property on all the projects.

i know i have come across other plugins that try and offer reactor support but they are all escaping me right now, which means i can't go see what they did.

open to suggestions - i guess the other thing i could do is use a static variable.

@rhuss
Copy link
Collaborator

rhuss commented Jul 7, 2016

I dont recommend static variables because of possible classloader issues (afaik each module becomes its own classloader, so it depends where your class has been loaded).

What I did to share data across different pluging goal executions (in the same module, though) was to put it into the PluginContext.

The same should work with MavenSession for global state, you could use this blueprint:

Set<String> pulledImages = (Map)session.getExecutionProperties().get(SESSION_AUTO_PULLED_IMAGES);
if (pulledImages == null) {
   pulledImages = new HashSet<String>();
   session.getExecutionProperties().put(SESSION_AUTO_PULLED_IMAGES, pulledImages);
}
pulledImages.put(imageName);

You should use only standard types here (e.g. String) again because of classloading issues.

@jgangemi
Copy link
Collaborator Author

jgangemi commented Jul 7, 2016

ah - i wasn't sure if that could be used. maven documentation is pretty crappy in this department.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants