use of org.platformlayer.ops.cas.jenkins.JenkinsClient.BuildId in project platformlayer by platformlayer.
the class JenkinsCasStore method findArtifact.
@Override
public CasStoreObject findArtifact(Md5Hash hash) throws OpsException {
try {
FingerprintInfo fingerprint = client.findByFingerprint(hash.toHex());
if (fingerprint == null) {
return null;
}
BuildId build = fingerprint.getOriginalBuild();
if (build == null) {
build = fingerprint.getFirstUsage();
if (build == null) {
log.warn("Cannot find build for fingerprint: " + hash.toHex());
return null;
}
}
BuildInfo buildInfo = client.findBuildInfo(build);
if (buildInfo == null) {
return null;
}
String fingerprintFileName = fingerprint.getFileName();
ArtifactInfo found = buildInfo.findArtifactByFileName(fingerprintFileName);
if (found == null) {
log.warn("Could not find artifact: " + fingerprint + " in " + buildInfo);
return null;
}
URI url = found.getArtifactUrl();
return new JenkinsCasObject(this, hash, url);
} catch (JenkinsException e) {
throw new OpsException("Error communicating with Jenkins", e);
}
}
Aggregations