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_START_CALLED |
static String |
DOCKER_BUILD_TIMESTAMP |
protected DockerAccessFactory |
dockerAccessFactory |
protected org.apache.maven.plugin.MojoExecution |
execution |
protected ImageConfigResolver |
imageConfigResolver |
protected String |
imagePullPolicy |
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 String |
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 DockerAccessFactory.DockerAccessContext |
getDockerAccessContext() |
protected GavLabel |
getGavLabel() |
ImagePullManager |
getImagePullManager(String imagePullPolicy,
String autoPull) |
protected LogDispatcher |
getLogDispatcher(ServiceHub hub) |
protected String |
getLogPrefix()
Log prefix to use when doing the logs
|
protected Date |
getReferenceDate() |
protected RegistryService.RegistryConfig |
getRegistryConfig(String specificRegistry) |
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 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") protected String autoPull
@Parameter(property="docker.imagePullPolicy") protected String imagePullPolicy
@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") protected String 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(String specificRegistry) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected Date getBuildTimestamp() throws IOException
IOException
protected Date getReferenceDate() throws IOException
IOException
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 IOException, ExecException, org.apache.maven.plugin.MojoExecutionException
serviceHub
- context for accessing backendsIOException
ExecException
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 GavLabel getGavLabel()
protected LogDispatcher getLogDispatcher(ServiceHub hub)
public ImagePullManager getImagePullManager(String imagePullPolicy, String autoPull)
Copyright © 2021. All rights reserved.