Package org.platformlayer.ops.cas.jenkins.JenkinsClient

Examples of org.platformlayer.ops.cas.jenkins.JenkinsClient.FingerprintInfo


  }

  @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;
      }
View Full Code Here


      }
    } catch (JenkinsException e) {
      throw new OpsException("Error communicating with Jenkins", e);
    }

    FingerprintInfo found = null;

    List<FingerprintInfo> fingerprints = buildInfo.getFingerprints();
    for (FingerprintInfo fingerprint : fingerprints) {
      if (fileName.equals(fingerprint.getFileName())) {
        found = fingerprint;
      }
    }

    if (found == null) {
      for (FingerprintInfo fingerprint : fingerprints) {
        String fingerprintFileName = fingerprint.getFileName();
        if (fingerprintFileName.contains(":")) {
          // Strip the maven prefix
          fingerprintFileName = fingerprintFileName.substring(fingerprintFileName.indexOf(':') + 1);
        }

        if (fileName.equals(fingerprintFileName)) {
          found = fingerprint;
        }
      }
    }

    if (found == null) {
      log.warn("Could not find fingerprinted file with name: " + fileName + " in " + buildInfo);
      return null;
    }

    String hash = found.getHash();
    if (hash == null) {
      throw new IllegalStateException();
    }

    // We return the hash in the hope that we've already copied the artifact!
View Full Code Here

TOP

Related Classes of org.platformlayer.ops.cas.jenkins.JenkinsClient.FingerprintInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.