Skip to content
This repository was archived by the owner on Jun 19, 2024. It is now read-only.

Refactor ResourceMojo to get rid of GeneratorContextΒ #1528

@rohanKanojia

Description

@rohanKanojia

Right now we're referencing Generators during resource generation in ResourceMojo here:

private List<ImageConfiguration> getResolvedImages(List<ImageConfiguration> images, final Logger log)
throws MojoExecutionException {
List<ImageConfiguration> ret;
ret = ConfigHelper.resolveImages(
log,
images,
(ImageConfiguration image) -> imageConfigResolver.resolve(image, project, session),
null, // no filter on image name yet (TODO: Maybe add this, too ?)
(List<ImageConfiguration> configs) -> {
try {
GeneratorContext ctx = new GeneratorContext.Builder()
.config(extractGeneratorConfig())
.project(project)
.logger(log)
.platformMode(mode)
.strategy(buildStrategy)
.useProjectClasspath(useProjectClasspath)
.build();
return GeneratorManager.generate(configs, ctx, true);
} catch (Exception e) {
throw new IllegalArgumentException("Cannot extract generator: " + e, e);
}
});
Date now = getBuildReferenceDate();
storeReferenceDateInPluginContext(now);
String minimalApiVersion = ConfigHelper.initAndValidate(ret, null /* no minimal api version */,
new ImageNameFormatter(project, now), log);
return ret;

We need ImageConfiguration in order to extract image names and container ports while making pod template. Ideally ResourceMojo should not be aware of ImageConfiguration which should be referenced in BuildMojo. We should find a way to get of of Generators here. Maybe we can make this configuration option for enrichers, too(or think about other solutions). This for sure is less harming than blending in generators here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    group/enricherEnricher relatedstatus/never-stalePin this issue to get never marked as stale by stale-bottarget/JKubeImplementation to be performed in JKube

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions