public abstract class AbstractDockerMojo extends org.apache.maven.plugin.AbstractMojo implements org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable, ConfigHelper.Customizer
Modifier and Type | Field and Description |
---|---|
protected String |
autoPull |
static String |
CONTEXT_KEY_BUILD_TIMESTAMP |
static String |
CONTEXT_KEY_LOG_DISPATCHER |
static String |
CONTEXT_KEY_PREVIOUSLY_PULLED |
static String |
CONTEXT_KEY_START_CALLED |
static String |
DOCKER_BUILD_TIMESTAMP |
protected DockerAccessFactory |
dockerAccessFactory |
protected org.apache.maven.plugin.MojoExecution |
execution |
protected ImageConfigResolver |
imageConfigResolver |
protected boolean |
keepContainer |
protected Logger |
log |
protected org.apache.maven.project.MavenProject |
project |
protected String |
registry |
protected boolean |
removeVolumes |
protected ServiceHubFactory |
serviceHubFactory |
protected org.apache.maven.execution.MavenSession |
session |
protected org.apache.maven.settings.Settings |
settings |
protected boolean |
skipExtendedAuth
Skip extended authentication
|
protected boolean |
useColor |
protected boolean |
verbose |
Constructor and Description |
---|
AbstractDockerMojo() |
Modifier and Type | Method and Description |
---|---|
void |
contextualize(org.codehaus.plexus.context.Context context) |
List<ImageConfiguration> |
customizeConfig(List<ImageConfiguration> imageConfigs) |
void |
execute()
Entry point for this plugin.
|
protected abstract void |
executeInternal(ServiceHub serviceHub)
Hook for subclass for doing the real job
|
protected Date |
getBuildTimestamp()
Get the current build timestamp.
|
protected File |
getBuildTimestampFile() |
protected String |
getConfiguredRegistry(ImageConfiguration imageConfig,
String specificRegistry)
Try to get the registry from various configuration parameters
|
protected DockerAccessFactory.DockerAccessContext |
getDockerAccessContext() |
protected LogDispatcher |
getLogDispatcher(ServiceHub hub) |
protected String |
getLogPrefix()
Log prefix to use when doing the logs
|
protected PomLabel |
getPomLabel() |
protected Date |
getReferenceDate() |
protected RegistryService.RegistryConfig |
getRegistryConfig() |
protected List<ImageConfiguration> |
getResolvedImages()
Get all images to use.
|
protected List<VolumeConfiguration> |
getVolumes()
Get all volumes which are defined separately from the images
|
protected boolean |
isDockerAccessRequired()
Override this if your mojo doesnt require access to a Docker host (like creating and attaching
docker tar archives)
|
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 CONTEXT_KEY_PREVIOUSLY_PULLED
public static final String DOCKER_BUILD_TIMESTAMP
@Parameter(defaultValue="${project}", readonly=true) protected org.apache.maven.project.MavenProject project
@Parameter(defaultValue="${settings}", readonly=true) protected org.apache.maven.settings.Settings settings
@Parameter(property="session") protected org.apache.maven.execution.MavenSession session
@Parameter(property="mojoExecution") protected org.apache.maven.plugin.MojoExecution execution
@Component protected ImageConfigResolver imageConfigResolver
@Component protected ServiceHubFactory serviceHubFactory
@Component protected DockerAccessFactory dockerAccessFactory
@Parameter(property="docker.autoPull", defaultValue="on") protected String autoPull
@Parameter(property="docker.keepContainer", defaultValue="false") protected boolean keepContainer
@Parameter(property="docker.removeVolumes", defaultValue="false") protected boolean removeVolumes
@Parameter(property="docker.useColor", defaultValue="true") protected boolean useColor
@Parameter(property="docker.verbose", defaultValue="false") protected boolean verbose
@Parameter(property="docker.registry") protected String registry
@Parameter(property="docker.skip.extendedAuth", defaultValue="false") protected boolean skipExtendedAuth
protected Logger log
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
executeInternal(ServiceHub)
which must be implemented by subclass.execute
in interface org.apache.maven.plugin.Mojo
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
protected DockerAccessFactory.DockerAccessContext getDockerAccessContext()
protected RegistryService.RegistryConfig getRegistryConfig() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected Date getBuildTimestamp() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected Date getReferenceDate() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected File getBuildTimestampFile()
protected String getLogPrefix()
public List<ImageConfiguration> customizeConfig(List<ImageConfiguration> imageConfigs)
customizeConfig
in interface ConfigHelper.Customizer
protected boolean isDockerAccessRequired()
true
as the default valueprotected abstract void executeInternal(ServiceHub serviceHub) throws DockerAccessException, org.apache.maven.plugin.MojoExecutionException
serviceHub
- context for accessing backendsDockerAccessException
org.apache.maven.plugin.MojoExecutionException
protected List<ImageConfiguration> getResolvedImages()
protected List<VolumeConfiguration> getVolumes()
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.Contextualizable
org.codehaus.plexus.context.ContextException
protected PomLabel getPomLabel()
protected LogDispatcher getLogDispatcher(ServiceHub hub)
protected String getConfiguredRegistry(ImageConfiguration imageConfig, String specificRegistry)
imageConfig
- image config which might contain the registryspecificRegistry
- specific registryCopyright © 2018. All rights reserved.