use of com.hubspot.deploy.ExternalArtifact in project Singularity by HubSpot.
the class SingularityExecutorTaskProcessBuilder method call.
@Override
public ProcessBuilder call() throws Exception {
if (task.getTaskInfo().hasContainer() && task.getTaskInfo().getContainer().hasDocker()) {
executorUtils.sendStatusUpdate(task.getDriver(), task.getTaskInfo().getTaskId(), TaskState.TASK_STARTING, String.format("Pulling image... (executor pid: %s)", executorPid), task.getLog());
try {
dockerUtils.pull(task.getTaskInfo().getContainer().getDocker().getImage());
} catch (DockerException e) {
throw new ProcessFailedException("Could not pull docker image", e);
}
}
executorUtils.sendStatusUpdate(task.getDriver(), task.getTaskInfo().getTaskId(), TaskState.TASK_STARTING, String.format("Staging files... (executor pid: %s)", executorPid), task.getLog());
taskArtifactFetcher = Optional.of(artifactFetcher.buildTaskFetcher(executorData, task));
taskArtifactFetcher.get().fetchFiles(executorData.getEmbeddedArtifacts(), executorData.getS3Artifacts(), executorData.getS3ArtifactSignaturesOrEmpty(), executorData.getExternalArtifacts());
task.getArtifactVerifier().checkSignatures(executorData.getS3ArtifactSignaturesOrEmpty());
List<ArtifactList> artifactLists = new ArrayList<>();
artifactLists.addAll(checkArtifactsForArtifactLists(executorData.getS3Artifacts()));
artifactLists.addAll(checkArtifactsForArtifactLists(executorData.getS3ArtifactSignaturesOrEmpty()));
artifactLists.addAll(checkArtifactsForArtifactLists(executorData.getExternalArtifacts()));
if (!artifactLists.isEmpty()) {
List<EmbeddedArtifact> embeddedArtifacts = new ArrayList<>();
List<S3Artifact> s3Artifacts = new ArrayList<>();
List<S3ArtifactSignature> s3ArtifactSignatures = new ArrayList<>();
List<ExternalArtifact> externalArtifacts = new ArrayList<>();
for (ArtifactList artifactList : artifactLists) {
embeddedArtifacts.addAll(artifactList.getEmbeddedArtifacts());
s3Artifacts.addAll(artifactList.getS3Artifacts());
s3ArtifactSignatures.addAll(artifactList.getS3ArtifactSignatures());
externalArtifacts.addAll(artifactList.getExternalArtifacts());
}
task.getLog().info("Found {} artifact lists with {} embedded, {} s3, {} external, fetching...", artifactLists.size(), embeddedArtifacts.size(), s3Artifacts.size() + s3ArtifactSignatures.size(), externalArtifacts.size());
taskArtifactFetcher.get().fetchFiles(embeddedArtifacts, s3Artifacts, s3ArtifactSignatures, externalArtifacts);
task.getArtifactVerifier().checkSignatures(s3ArtifactSignatures);
}
ProcessBuilder processBuilder = buildProcessBuilder(task.getTaskInfo(), executorData, task.getTaskDefinition().getServiceLogFileName());
task.getTaskLogManager().setup();
return processBuilder;
}
Aggregations