use of io.fabric8.maven.docker.log.LogOutputSpecFactory in project docker-maven-plugin by fabric8io.
the class LogOutputSpecFactoryTest method createSpec.
private LogOutputSpec createSpec(String prefix) {
LogOutputSpecFactory factory = new LogOutputSpecFactory(false, false, null);
LogConfiguration logConfig = new LogConfiguration.Builder().prefix(prefix).build();
RunImageConfiguration runConfig = new RunImageConfiguration.Builder().log(logConfig).build();
ImageConfiguration imageConfiguration = new ImageConfiguration.Builder().alias(ALIAS).name(NAME).runConfig(runConfig).build();
return factory.createSpec(CONTAINER_ID, imageConfiguration);
}
use of io.fabric8.maven.docker.log.LogOutputSpecFactory in project docker-maven-plugin by fabric8io.
the class RunServiceTest method setup.
@Before
public void setup() {
tracker = new ContainerTracker();
properties = new Properties();
LogOutputSpecFactory logOutputSpecFactory = new LogOutputSpecFactory(true, true, null);
runService = new RunService(docker, queryService, tracker, logOutputSpecFactory, log);
}
use of io.fabric8.maven.docker.log.LogOutputSpecFactory in project docker-maven-plugin by fabric8io.
the class AbstractDockerMojo method execute.
/**
* Entry point for this plugin. It will set up the helper class and then calls
* {@link #executeInternal(ServiceHub)}
* which must be implemented by subclass.
*
* @throws MojoExecutionException
* @throws MojoFailureException
*/
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (!skip) {
log = new AnsiLogger(getLog(), useColor, verbose, !settings.getInteractiveMode(), getLogPrefix());
authConfigFactory.setLog(log);
LogOutputSpecFactory logSpecFactory = new LogOutputSpecFactory(useColor, logStdout, logDate);
ConfigHelper.validateExternalPropertyActivation(project, images);
// The 'real' images configuration to use (configured images + externally resolved images)
this.minimalApiVersion = initImageConfiguration(getBuildTimestamp());
DockerAccess access = null;
try {
if (isDockerAccessRequired()) {
DockerAccessFactory.DockerAccessContext dockerAccessContext = getDockerAccessContext();
access = dockerAccessFactory.createDockerAccess(dockerAccessContext);
}
ServiceHub serviceHub = serviceHubFactory.createServiceHub(project, session, access, log, logSpecFactory);
executeInternal(serviceHub);
} catch (DockerAccessException | ExecException exp) {
logException(exp);
throw new MojoExecutionException(log.errorMessage(exp.getMessage()), exp);
} catch (MojoExecutionException exp) {
logException(exp);
throw exp;
} finally {
if (access != null) {
access.shutdown();
}
}
}
}
Aggregations