public abstract class AbstractDockerMojo extends org.apache.maven.plugin.AbstractMojo implements ConfigHelper.Customizer, org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
| Modifier and Type | Field and Description |
|---|---|
protected org.eclipse.jkube.kit.config.access.ClusterConfiguration |
access |
protected String |
apiVersion |
protected org.apache.maven.archiver.MavenArchiveConfiguration |
archive |
protected org.eclipse.jkube.kit.config.image.build.RegistryAuthConfiguration |
authConfig |
protected AuthConfigFactory |
authConfigFactory |
protected boolean |
autoCreateCustomNetworks
Whether to create the customs networks (user-defined bridge networks) before starting automatically
|
protected String |
autoPull |
protected Map<String,String> |
buildArgs |
protected String |
buildRecreate
How to recreate the build config and/or image stream created by the build.
|
protected org.eclipse.jkube.kit.config.image.build.OpenShiftBuildStrategy |
buildStrategy
OpenShift build mode when an OpenShift build is performed.
|
protected String |
certPath |
protected org.eclipse.jkube.kit.config.access.ClusterAccess |
clusterAccess |
protected String |
containerNamePattern
Naming pattern for how to name containers when started
|
static String |
CONTEXT_KEY_BUILD_TIMESTAMP |
static String |
CONTEXT_KEY_LOG_DISPATCHER |
static String |
CONTEXT_KEY_START_CALLED |
static String |
DMP_PLUGIN_DESCRIPTOR |
static String |
DOCKER_BUILD_TIMESTAMP |
static String |
DOCKER_EXTRA_DIR |
protected DockerAccessFactory |
dockerAccessFactory |
protected String |
dockerHost
URL to docker daemon
|
protected org.eclipse.jkube.kit.config.resource.ProcessorConfig |
enricher
Enrichers used for enricher build objects
|
protected String |
environment
Environment name where resources are placed.
|
protected String |
filter
Whether to restrict operation to a single image.
|
protected boolean |
forcePull
While creating a BuildConfig, By default, if the builder image specified in the
build configuration is available locally on the node, that image will be used.
|
protected org.eclipse.jkube.kit.config.resource.ProcessorConfig |
generator
Generator specific options.
|
protected ImageConfigResolver |
imageConfigResolver |
protected String |
imagePullPolicy |
protected List<ImageConfiguration> |
images
Image configurations configured directly.
|
protected org.eclipse.jkube.kit.config.service.JKubeServiceHub |
jkubeServiceHub |
protected boolean |
keepContainer |
protected boolean |
keepRunning |
protected org.eclipse.jkube.kit.common.KitLogger |
log |
protected String |
logDate |
protected boolean |
logStdout |
protected DockerMachineConfiguration |
machine |
protected org.apache.maven.shared.filtering.MavenFileFilter |
mavenFileFilter |
protected org.apache.maven.shared.filtering.MavenReaderFilter |
mavenFilterReader |
protected int |
maxConnections |
protected String |
minimalApiVersion |
protected org.eclipse.jkube.kit.config.resource.RuntimeMode |
mode
Whether to perform a Kubernetes build (i.e.
|
protected String |
openshiftPullSecret
The name of pullSecret to be used to pull the base image in case pulling from a protected
registry which requires authentication.
|
protected String |
outputDirectory |
protected org.codehaus.plexus.PlexusContainer |
plexusContainer |
protected String |
profile
Profile to use.
|
protected org.apache.maven.project.MavenProject |
project |
protected org.apache.maven.project.MavenProjectHelper |
projectHelper |
protected String |
pullRegistry |
protected List<org.apache.maven.project.MavenProject> |
reactorProjects |
protected String |
registry |
protected boolean |
removeVolumes |
protected org.apache.maven.repository.RepositorySystem |
repositorySystem |
protected List<ImageConfiguration> |
resolvedImages |
protected File |
resourceDir
Folder where to find project specific files, e.g a custom profile
|
protected org.eclipse.jkube.kit.config.resource.ResourceConfig |
resources
Resource config for getting annotation and labels to be applied to enriched build objects
|
protected org.eclipse.jkube.kit.config.resource.RuntimeMode |
runtimeMode |
protected String |
s2iBuildNameSuffix
The S2I binary builder BuildConfig name suffix appended to the image name to avoid
clashing with the underlying BuildConfig for the Jenkins pipeline
|
protected boolean |
s2iImageStreamLookupPolicyLocal
Allow the ImageStream used in the S2I binary build to be used in standard
Kubernetes resources such as Deployment or StatefulSet.
|
protected ServiceHubFactory |
serviceHubFactory |
protected org.apache.maven.execution.MavenSession |
session |
protected org.apache.maven.settings.Settings |
settings |
protected boolean |
skip |
protected boolean |
skipBuild |
protected Boolean |
skipBuildPom |
protected boolean |
skipExtendedAuth
Skip extended authentication
|
protected boolean |
skipMachine
Whether the usage of docker machine should be skipped competely
|
protected String |
sourceDirectory |
protected boolean |
useColor |
protected boolean |
useProjectClasspath
Should we use the project's compile-time classpath to scan for additional enrichers/generators?
|
protected String |
verbose |
protected int |
watchInterval |
protected WatchMode |
watchMode
Watching mode for rebuilding images
|
protected String |
watchPostExec |
protected String |
watchPostGoal |
| Constructor and Description |
|---|
AbstractDockerMojo() |
| Modifier and Type | Method and Description |
|---|---|
protected ImageConfiguration |
addSimpleDockerfileConfig(ImageConfiguration image,
File dockerfile) |
protected void |
callBuildPlugin(File outputDir,
String buildPluginClass) |
void |
contextualize(org.codehaus.plexus.context.Context context) |
protected JKubeBuildContext |
createMojoParameters() |
protected ImageConfiguration |
createSimpleDockerfileConfig(File dockerFile) |
List<ImageConfiguration> |
customizeConfig(List<ImageConfiguration> configs)
Customization hook called by the base plugin.
|
void |
execute() |
protected void |
executeBuildPlugins() |
protected abstract void |
executeInternal(ServiceHub serviceHub)
Hook for subclass for doing the real job
|
protected org.eclipse.jkube.kit.config.resource.ProcessorConfig |
extractEnricherConfig() |
protected org.eclipse.jkube.kit.config.resource.ProcessorConfig |
extractGeneratorConfig() |
protected boolean |
follow() |
protected File |
getAndEnsureOutputDirectory() |
protected BuildService.BuildContext |
getBuildContext() |
protected org.eclipse.jkube.kit.config.service.BuildService.BuildServiceConfig |
getBuildServiceConfig() |
protected Date |
getBuildTimestamp()
Get the current build timestamp.
|
protected File |
getBuildTimestampFile() |
protected org.eclipse.jkube.kit.config.access.ClusterConfiguration |
getClusterConfiguration() |
protected DockerAccessFactory.DockerAccessContext |
getDockerAccessContext() |
org.eclipse.jkube.maven.enricher.api.EnricherContext |
getEnricherContext() |
protected GavLabel |
getGavLabel() |
protected org.eclipse.jkube.generator.api.GeneratorContext |
getGeneratorContext() |
ImagePullManager |
getImagePullManager(String imagePullPolicy,
String autoPull) |
protected org.eclipse.jkube.kit.config.service.JKubeServiceHub |
getJKubeServiceHub() |
protected LogDispatcher |
getLogDispatcher(ServiceHub hub) |
protected String |
getLogPrefix() |
protected Date |
getReferenceDate() |
protected RegistryService.RegistryConfig |
getRegistryConfig(String specificRegistry) |
protected List<ImageConfiguration> |
getResolvedImages()
Get all images to use.
|
protected ImagePullManager.CacheStore |
getSessionCacheStore() |
protected String |
initImageConfiguration(Date buildTimeStamp) |
protected boolean |
isDockerAccessRequired() |
protected void |
logException(Exception exp) |
protected void |
processDmpPluginDescription(URL pluginDesc,
File outputDir) |
protected boolean |
shouldSkipBecauseOfPomPackaging() |
protected String |
showLogs() |
protected boolean |
useColorForLogging()
Determine whether to enable colorized log messages
|
public static final String DMP_PLUGIN_DESCRIPTOR
public static final String DOCKER_EXTRA_DIR
public static final String CONTEXT_KEY_START_CALLED
public static final String CONTEXT_KEY_LOG_DISPATCHER
public static final String CONTEXT_KEY_BUILD_TIMESTAMP
public static final String DOCKER_BUILD_TIMESTAMP
@Parameter protected org.eclipse.jkube.kit.config.access.ClusterConfiguration access
@Parameter(defaultValue="${project}",
readonly=true)
protected org.apache.maven.project.MavenProject project
@Parameter(defaultValue="${session}",
readonly=true)
protected org.apache.maven.execution.MavenSession session
@Parameter(property="docker.apiVersion") protected String apiVersion
@Parameter(property="docker.verbose",
defaultValue="false")
protected String verbose
@Parameter(property="docker.logDate") protected String logDate
@Parameter(property="docker.logStdout",
defaultValue="false")
protected boolean logStdout
@Parameter(property="docker.host") protected String dockerHost
@Parameter(property="docker.certPath") protected String certPath
@Parameter protected DockerMachineConfiguration machine
@Parameter(property="docker.skip.machine",
defaultValue="false")
protected boolean skipMachine
@Parameter(property="docker.maxConnections",
defaultValue="100")
protected int maxConnections
@Parameter(property="docker.useColor",
defaultValue="true")
protected boolean useColor
@Parameter(property="docker.filter") protected String filter
protected List<ImageConfiguration> resolvedImages
@Parameter(defaultValue="${settings}",
readonly=true)
protected org.apache.maven.settings.Settings settings
@Parameter(property="docker.source.dir",
defaultValue="src/main/docker")
protected String sourceDirectory
@Parameter(property="docker.target.dir",
defaultValue="target/docker")
protected String outputDirectory
@Parameter(defaultValue="${reactorProjects}",
required=true,
readonly=true)
protected List<org.apache.maven.project.MavenProject> reactorProjects
@Parameter(property="docker.autoPull") protected String autoPull
@Parameter(property="docker.imagePullPolicy") protected String imagePullPolicy
@Parameter(property="docker.pull.registry") protected String pullRegistry
@Parameter(property="jkube.profile") protected String profile
However, any given enricher and or generator configuration overrides the information provided by a profile.
@Component protected ImageConfigResolver imageConfigResolver
@Parameter(property="docker.skip.extendedAuth",
defaultValue="false")
protected boolean skipExtendedAuth
@Parameter protected org.apache.maven.archiver.MavenArchiveConfiguration archive
@Component protected org.apache.maven.shared.filtering.MavenFileFilter mavenFileFilter
@Component protected org.apache.maven.shared.filtering.MavenReaderFilter mavenFilterReader
@Parameter protected org.eclipse.jkube.kit.config.image.build.RegistryAuthConfiguration authConfig
@Parameter(property="docker.registry") protected String registry
@Parameter(property="jkube.build.recreate",
defaultValue="none")
protected String buildRecreate
mode == openshift or mode is auto
and openshift is detected. If not set, existing
build config will not be recreated.
The possible values are:
@Component protected org.apache.maven.project.MavenProjectHelper projectHelper
@Component protected org.apache.maven.repository.RepositorySystem repositorySystem
@Component protected ServiceHubFactory serviceHubFactory
@Component protected DockerAccessFactory dockerAccessFactory
@Parameter protected List<ImageConfiguration> images
@Parameter(property="docker.skip.build",
defaultValue="false")
protected boolean skipBuild
@Parameter(property="jkube.build.strategy") protected org.eclipse.jkube.kit.config.image.build.OpenShiftBuildStrategy buildStrategy
@Parameter(property="jkube.build.pullSecret",
defaultValue="pullsecret-jkube")
protected String openshiftPullSecret
@Parameter(property="jkube.skip",
defaultValue="false")
protected boolean skip
@Parameter(property="jkube.mode") protected org.eclipse.jkube.kit.config.resource.RuntimeMode mode
@Parameter(property="jkube.skip.build.pom") protected Boolean skipBuildPom
@Parameter(property="jkube.s2i.buildNameSuffix",
defaultValue="-s2i")
protected String s2iBuildNameSuffix
@Parameter protected org.eclipse.jkube.kit.config.resource.ProcessorConfig generator
<generator-prefix>-<option>.@Parameter(property="jkube.s2i.imageStreamLookupPolicyLocal",
defaultValue="true")
protected boolean s2iImageStreamLookupPolicyLocal
@Parameter(property="jkube.build.forcePull",
defaultValue="false")
protected boolean forcePull
ForcePull to override the local image and refresh it from the registry to which the image stream points.
@Parameter(property="jkube.useProjectClasspath",
defaultValue="false")
protected boolean useProjectClasspath
@Parameter protected org.eclipse.jkube.kit.config.resource.ResourceConfig resources
@Parameter protected org.eclipse.jkube.kit.config.resource.ProcessorConfig enricher
@Parameter(property="jkube.resourceDir",
defaultValue="${basedir}/src/main/jkube")
protected File resourceDir
@Parameter(property="jkube.environment") protected String environment
protected AuthConfigFactory authConfigFactory
protected org.eclipse.jkube.kit.common.KitLogger log
protected String minimalApiVersion
protected org.eclipse.jkube.kit.config.access.ClusterAccess clusterAccess
protected org.eclipse.jkube.kit.config.service.JKubeServiceHub jkubeServiceHub
protected org.eclipse.jkube.kit.config.resource.RuntimeMode runtimeMode
protected org.codehaus.plexus.PlexusContainer plexusContainer
@Parameter(property="docker.watchMode",
defaultValue="both")
protected WatchMode watchMode
@Parameter(property="docker.watchInterval",
defaultValue="5000")
protected int watchInterval
@Parameter(property="docker.keepRunning",
defaultValue="false")
protected boolean keepRunning
@Parameter(property="docker.watchPostGoal") protected String watchPostGoal
@Parameter(property="docker.watchPostExec") protected String watchPostExec
@Parameter(property="docker.keepContainer",
defaultValue="false")
protected boolean keepContainer
@Parameter(property="docker.removeVolumes",
defaultValue="false")
protected boolean removeVolumes
@Parameter(property="docker.containerNamePattern") protected String containerNamePattern
@Parameter(property="docker.autoCreateCustomNetworks",
defaultValue="false")
protected boolean autoCreateCustomNetworks
public void contextualize(org.codehaus.plexus.context.Context context)
throws org.codehaus.plexus.context.ContextException
contextualize in interface org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizableorg.codehaus.plexus.context.ContextExceptionpublic void execute()
throws org.apache.maven.plugin.MojoExecutionException,
org.apache.maven.plugin.MojoFailureException
execute in interface org.apache.maven.plugin.Mojoorg.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureExceptionprotected abstract void executeInternal(ServiceHub serviceHub) throws IOException, org.apache.maven.plugin.MojoExecutionException
serviceHub - context for accessing backendsIOExceptionorg.apache.maven.plugin.MojoExecutionExceptionprotected BuildService.BuildContext getBuildContext() throws org.apache.maven.artifact.DependencyResolutionRequiredException
org.apache.maven.artifact.DependencyResolutionRequiredExceptionprotected JKubeBuildContext createMojoParameters() throws org.apache.maven.artifact.DependencyResolutionRequiredException
org.apache.maven.artifact.DependencyResolutionRequiredExceptionprotected Date getReferenceDate() throws IOException
IOExceptionprotected File getBuildTimestampFile()
protected File getAndEnsureOutputDirectory()
protected Date getBuildTimestamp() throws IOException
IOExceptionprotected void processDmpPluginDescription(URL pluginDesc, File outputDir) throws IOException
IOExceptionprotected RegistryService.RegistryConfig getRegistryConfig(String specificRegistry)
protected void callBuildPlugin(File outputDir, String buildPluginClass) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException
protected ImageConfiguration createSimpleDockerfileConfig(File dockerFile)
protected ImageConfiguration addSimpleDockerfileConfig(ImageConfiguration image, File dockerfile)
protected void logException(Exception exp)
protected DockerAccessFactory.DockerAccessContext getDockerAccessContext()
protected List<ImageConfiguration> getResolvedImages()
protected boolean isDockerAccessRequired()
protected boolean shouldSkipBecauseOfPomPackaging()
protected org.eclipse.jkube.kit.config.service.BuildService.BuildServiceConfig getBuildServiceConfig()
throws org.apache.maven.artifact.DependencyResolutionRequiredException
org.apache.maven.artifact.DependencyResolutionRequiredExceptionpublic List<ImageConfiguration> customizeConfig(List<ImageConfiguration> configs)
customizeConfig in interface ConfigHelper.Customizerconfigs - configuration to customizeprotected String getLogPrefix()
public org.eclipse.jkube.maven.enricher.api.EnricherContext getEnricherContext()
throws org.apache.maven.artifact.DependencyResolutionRequiredException
org.apache.maven.artifact.DependencyResolutionRequiredExceptionprotected org.eclipse.jkube.generator.api.GeneratorContext getGeneratorContext()
throws org.apache.maven.artifact.DependencyResolutionRequiredException
org.apache.maven.artifact.DependencyResolutionRequiredExceptionprotected org.eclipse.jkube.kit.config.service.JKubeServiceHub getJKubeServiceHub()
throws org.apache.maven.artifact.DependencyResolutionRequiredException
org.apache.maven.artifact.DependencyResolutionRequiredExceptionprotected org.eclipse.jkube.kit.config.resource.ProcessorConfig extractGeneratorConfig()
protected org.eclipse.jkube.kit.config.resource.ProcessorConfig extractEnricherConfig()
public ImagePullManager getImagePullManager(String imagePullPolicy, String autoPull)
protected ImagePullManager.CacheStore getSessionCacheStore()
protected void executeBuildPlugins()
protected String initImageConfiguration(Date buildTimeStamp) throws org.apache.maven.artifact.DependencyResolutionRequiredException
org.apache.maven.artifact.DependencyResolutionRequiredExceptionprotected boolean useColorForLogging()
protected org.eclipse.jkube.kit.config.access.ClusterConfiguration getClusterConfiguration()
protected GavLabel getGavLabel()
protected String showLogs()
protected boolean follow()
protected LogDispatcher getLogDispatcher(ServiceHub hub)
Copyright © 2020. All rights reserved.