abstract class AbstractDockerMojo
extends org.apache.maven.plugin.AbstractMojo
| Modifier and Type | Class and Description |
|---|---|
private static class |
AbstractDockerMojo.SupplierToClassNameFunction |
| Modifier and Type | Field and Description |
|---|---|
private String |
dockerCertPath |
private String |
dockerHost
URL of the docker host as specified in pom.xml.
|
protected org.apache.maven.plugin.MojoExecution |
execution |
private String |
registryUrl |
private int |
retryPushCount
Number of retries for failing pushes, defaults to 5.
|
private int |
retryPushTimeout
Retry timeout for failing pushes, defaults to 10 seconds.
|
private org.sonatype.plexus.components.sec.dispatcher.SecDispatcher |
secDispatcher
https://issues.apache.org/jira/browse/MNG-4384
|
private String |
serverId |
protected org.apache.maven.execution.MavenSession |
session |
private org.apache.maven.settings.Settings |
settings
The system settings for Maven.
|
private boolean |
skipDocker
Flag to skip docker goal, making goal a no-op.
|
private boolean |
skipDockerPush
Flag to skip docker push, making push goal a no-op.
|
| Constructor and Description |
|---|
AbstractDockerMojo() |
| Modifier and Type | Method and Description |
|---|---|
private com.spotify.docker.client.auth.RegistryAuthSupplier |
authSupplier() |
protected com.spotify.docker.client.DockerClient |
buildDockerClient() |
protected com.spotify.docker.client.shaded.com.google.common.base.Optional<com.spotify.docker.client.DockerCertificatesStore> |
dockerCertificates() |
void |
execute() |
protected abstract void |
execute(com.spotify.docker.client.DockerClient dockerClient) |
protected com.spotify.docker.client.DefaultDockerClient.Builder |
getBuilder() |
private String |
getEmail(org.apache.maven.settings.Server server)
Get the email from the server configuration in
~/.m2/settings.xml. |
int |
getRetryPushCount() |
int |
getRetryPushTimeout() |
private com.spotify.docker.client.auth.RegistryAuthSupplier |
googleContainerRegistryAuthSupplier()
Attempt to load a GCR compatible RegistryAuthSupplier based on a few conditions:
First check to see if the environemnt variable DOCKER_GOOGLE_CREDENTIALS is set and points
to a readable file
Otherwise check if the Google Application Default Credentials can be loaded
Note that we use a special environment variable of our own in addition to any environment
variable that the ADC loading uses (GOOGLE_APPLICATION_CREDENTIALS) in case there is a need for
the user to use the latter env var for some other purpose in their build.
|
boolean |
isSkipDocker() |
boolean |
isSkipDockerPush() |
protected String |
rawDockerHost() |
protected com.spotify.docker.client.messages.RegistryAuth |
registryAuth()
Builds the registryAuth object from server details.
|
private String |
serverIdFor(com.spotify.docker.client.messages.RegistryAuth registryAuth) |
@Component(role=org.apache.maven.execution.MavenSession.class) protected org.apache.maven.execution.MavenSession session
@Component(role=org.apache.maven.plugin.MojoExecution.class) protected org.apache.maven.plugin.MojoExecution execution
@Component private org.apache.maven.settings.Settings settings
@Component(role=org.sonatype.plexus.components.sec.dispatcher.SecDispatcher.class,
hint="mng-4384")
private org.sonatype.plexus.components.sec.dispatcher.SecDispatcher secDispatcher
@Parameter(property="dockerHost") private String dockerHost
@Parameter(property="dockerCertPath") private String dockerCertPath
@Parameter(property="serverId") private String serverId
@Parameter(property="registryUrl") private String registryUrl
@Parameter(property="retryPushCount",
defaultValue="5")
private int retryPushCount
@Parameter(property="retryPushTimeout",
defaultValue="10000")
private int retryPushTimeout
@Parameter(property="skipDocker",
defaultValue="false")
private boolean skipDocker
@Parameter(property="skipDockerPush",
defaultValue="false")
private boolean skipDockerPush
public int getRetryPushTimeout()
public int getRetryPushCount()
public boolean isSkipDocker()
public boolean isSkipDockerPush()
public void execute()
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptionprotected com.spotify.docker.client.DefaultDockerClient.Builder getBuilder()
throws com.spotify.docker.client.exceptions.DockerCertificateException
com.spotify.docker.client.exceptions.DockerCertificateExceptionprotected com.spotify.docker.client.DockerClient buildDockerClient()
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptionprotected abstract void execute(com.spotify.docker.client.DockerClient dockerClient)
throws Exception
Exceptionprotected String rawDockerHost()
protected com.spotify.docker.client.shaded.com.google.common.base.Optional<com.spotify.docker.client.DockerCertificatesStore> dockerCertificates()
throws com.spotify.docker.client.exceptions.DockerCertificateException
com.spotify.docker.client.exceptions.DockerCertificateExceptionprivate String getEmail(org.apache.maven.settings.Server server)
~/.m2/settings.xml.
<servers>
<server>
<id>my-private-docker-registry</id>
[...]
<configuration>
<email>foo@bar.com</email>
</configuration>
</server>
</servers>
The above settings.xml would return "foo@bar.com".server - Servernull if not setprotected com.spotify.docker.client.messages.RegistryAuth registryAuth()
throws org.apache.maven.plugin.MojoExecutionException
RegistryAuthorg.apache.maven.plugin.MojoExecutionExceptionprivate com.spotify.docker.client.auth.RegistryAuthSupplier authSupplier()
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionExceptionprivate String serverIdFor(com.spotify.docker.client.messages.RegistryAuth registryAuth)
private com.spotify.docker.client.auth.RegistryAuthSupplier googleContainerRegistryAuthSupplier()
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException - if an IOException occurs while loading the explicitly-requested
credentialsCopyright © 2019. All rights reserved.