in src/main/java/com/amazonaws/codepipeline/jenkinsplugin/AWSCodePipelineSCM.java [206:248]
public boolean checkout(
final AbstractBuild<?, ?> abstractBuild,
final Launcher launcher,
final FilePath workspacePath,
final BuildListener listener,
final File changeLogFile)
throws IOException, InterruptedException {
initializeModel();
final CodePipelineStateModel model = CodePipelineStateService.getModel();
if (model.getJob() == null) {
// This is here for if a customer presses BuildNow, it will still attempt a build.
return true;
}
LoggingHelper.log(listener, "Job '%s' received", model.getJob().getId());
try {
final AcknowledgeJobResult acknowledgeJobResult = getCodePipelineClient().acknowledgeJob(new AcknowledgeJobRequest()
.withJobId(model.getJob().getId())
.withNonce(model.getJob().getNonce()));
if (!acknowledgeJobResult.getStatus().equals(JobStatus.InProgress.name())) {
model.setSkipPutJobResult(true);
throw new AbortException(String.format("Failed to acknowledge job with ID: %s", job.getId()));
}
} catch (final InvalidNonceException e) {
model.setSkipPutJobResult(true);
throw new AbortException(String.format("Job with ID %s was already acknowledged", job.getId()));
}
LoggingHelper.log(listener, "Acknowledged job with ID: %s", model.getJob().getId());
workspacePath.act(new DownloadCallable(
clearWorkspace,
model.getJob(),
model,
awsClientFactory,
JenkinsMetadata.getPluginUserAgentPrefix(),
listener));
return true;
}