jenkins.model.Jenkins.getFingerprintMap()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(10.3k)|赞(0)|评价(0)|浏览(189)

本文整理了Java中jenkins.model.Jenkins.getFingerprintMap()方法的一些代码示例,展示了Jenkins.getFingerprintMap()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jenkins.getFingerprintMap()方法的具体详情如下:
包路径:jenkins.model.Jenkins
类名称:Jenkins
方法名:getFingerprintMap

Jenkins.getFingerprintMap介绍

暂无

代码示例

代码示例来源:origin: jenkinsci/jenkins

Fingerprint addRecord(Run build) throws IOException {
  FingerprintMap map = Jenkins.getInstance().getFingerprintMap();
  return map.getOrCreate(produced?build:null, fileName, md5sum);
}

代码示例来源:origin: org.jenkins-ci.plugins/docker-commons

private static @Nonnull Fingerprint forDockerInstance(@CheckForNull Run<?,?> run, 
    @Nonnull String id, @CheckForNull String name, @Nonnull String prefix) throws IOException {
  final Jenkins j = Jenkins.getInstance();
  if (j == null) {
    throw new IOException("Jenkins instance is not ready");
  }
  final String imageName = prefix + (StringUtils.isNotBlank(name) ? name : id);
  return j.getFingerprintMap().getOrCreate(run, imageName, getFingerprintHash(id));
}

代码示例来源:origin: jenkinsci/docker-commons-plugin

private static @Nonnull Fingerprint forDockerInstance(@CheckForNull Run<?,?> run, 
    @Nonnull String id, @CheckForNull String name, @Nonnull String prefix) throws IOException {
  final Jenkins j = Jenkins.getInstance();
  if (j == null) {
    throw new IOException("Jenkins instance is not ready");
  }
  final String imageName = prefix + (StringUtils.isNotBlank(name) ? name : id);
  return j.getFingerprintMap().getOrCreate(run, imageName, getFingerprintHash(id));
}

代码示例来源:origin: jenkinsci/dockerhub-notification-plugin

/**
 * Gets an existing {@link TriggerEntry}, or null if no such thing exists.
 *
 * @param sha the {@link PushNotification#sha()}.
 * @return the entry if found.
 * @throws IOException          if so
 * @throws InterruptedException if so
 */
@CheckForNull
public synchronized TriggerEntry getEntry(String sha) throws IOException, InterruptedException {
  Fingerprint fingerprint = jenkins.getFingerprintMap().get(sha);
  if (fingerprint==null)  return null;
  return fingerprint.getFacet(TriggerEntry.class);
}

代码示例来源:origin: org.jenkins-ci.plugins/docker-commons

/**
 * Gets {@link Fingerprint} for a given docker ID.
 * @param id Docker ID (image or container). Only 64-char full IDs are supported.
 * @return Created fingerprint or null if it is not found
 * @throws IOException Fingerprint loading error
 */
public static @CheckForNull Fingerprint of(@Nonnull String id) throws IOException {
  final Jenkins jenkins = Jenkins.getInstance(); // should be not null
  return jenkins != null ? jenkins.getFingerprintMap().get(getFingerprintHash(id)) : null;
}

代码示例来源:origin: jenkinsci/docker-commons-plugin

/**
 * Gets {@link Fingerprint} for a given docker ID.
 * @param id Docker ID (image or container). Only 64-char full IDs are supported.
 * @return Created fingerprint or null if it is not found
 * @throws IOException Fingerprint loading error
 */
public static @CheckForNull Fingerprint of(@Nonnull String id) throws IOException {
  return Jenkins.getInstance().getFingerprintMap().get(getFingerprintHash(id));
}

代码示例来源:origin: jenkinsci/maven-plugin

public Void call(MavenBuild build) throws IOException, InterruptedException {
    FingerprintMap map = Jenkins.getInstance().getFingerprintMap();
    for (Entry<String, String> e : p.entrySet())
      map.getOrCreate(build, e.getKey(), e.getValue()).add(build);
    for (Entry<String, String> e : u.entrySet())
      map.getOrCreate(null, e.getKey(), e.getValue()).add(build);
    Map<String,String> all = new HashMap<String, String>(u);
    all.putAll(p);
    // add action
    FingerprintAction fa = build.getAction(FingerprintAction.class);
    if (fa!=null)   fa.add(all);
    else            build.getActions().add(new FingerprintAction(build,all));
    return null;
  }
}

代码示例来源:origin: jenkinsci/dockerhub-notification-plugin

@Nonnull
private synchronized TriggerEntry getOrCreateEntry(@Nonnull final PushNotification pushNotification) throws IOException, InterruptedException {
  Fingerprint fingerprint = jenkins.getFingerprintMap().getOrCreate(null, pushNotification.getRepoName(), pushNotification.sha());
  TriggerEntry entry = fingerprint.getFacet(TriggerEntry.class);
  if (entry==null)    fingerprint.getFacets().add(entry=new TriggerEntry(fingerprint,pushNotification));
  return entry;
}

代码示例来源:origin: org.jenkins-ci.plugins/s3

Fingerprint addRecord(AbstractBuild<?,?> build) throws IOException {
  FingerprintMap map = Jenkins.getInstance().getFingerprintMap();
  return map.getOrCreate(produced?build:null, artifact.getName(), md5sum);
}

代码示例来源:origin: jenkinsci/maven-plugin

/**
 * Creates {@link FingerprintAction} for {@link MavenModuleSetBuild}
 * by aggregating all fingerprints from module builds.
 */
public static void aggregate(MavenModuleSetBuild mmsb) throws IOException {
  Map<String,String> records = new HashMap<>();
  for (List<MavenBuild> builds : mmsb.getModuleBuilds().values()) {
    for (MavenBuild build : builds) {
      FingerprintAction fa = build.getAction(FingerprintAction.class);
      if(fa!=null)
        records.putAll(fa.getRecords());
    }
  }
  if(!records.isEmpty()) {
    FingerprintMap map = Jenkins.getInstance().getFingerprintMap();
    for (Entry<String, String> e : records.entrySet())
      map.getOrCreate(null, e.getKey(), e.getValue()).add(mmsb);
    mmsb.addAction(new FingerprintAction(mmsb,records));
  }
}

代码示例来源:origin: org.jenkins-ci.plugins/credentials

/**
 * Retrieves the {@link Fingerprint} for a specific credential.
 *
 * @param c the credential.
 * @return the {@link Fingerprint} or {@code null} if the credential has no fingerprint associated with it.
 * @throws IOException if the credential's fingerprint hash could not be computed.
 * @since 2.1.1
 */
@CheckForNull
public static Fingerprint getFingerprintOf(@NonNull Credentials c) throws IOException {
  try {
    MessageDigest md5 = MessageDigest.getInstance("MD5");
    DigestOutputStream out = new DigestOutputStream(new NullOutputStream(), md5);
    try {
      FINGERPRINT_XML.toXML(c, new OutputStreamWriter(out, Charset.forName("UTF-8")));
    } finally {
      IOUtils.closeQuietly(out);
    }
    return Jenkins.getActiveInstance().getFingerprintMap().get(Util.toHexString(md5.digest()));
  } catch (NoSuchAlgorithmException e) {
    throw new IllegalStateException("JLS mandates MD5 as a supported digest algorithm");
  }
}

代码示例来源:origin: org.jenkins-ci.plugins/credentials

/**
 * Creates a fingerprint that can be used to track the usage of a specific credential.
 *
 * @param c the credential to fingerprint.
 * @return the Fingerprint.
 * @throws IOException if the credential's fingerprint hash could not be computed.
 * @since 2.1.1
 */
@NonNull
public static Fingerprint getOrCreateFingerprintOf(@NonNull Credentials c) throws IOException {
  String pseudoFilename = String.format("Credential id=%s name=%s",
      c instanceof IdCredentials ? ((IdCredentials) c).getId() : "unknown", CredentialsNameProvider.name(c));
  try {
    MessageDigest md5 = MessageDigest.getInstance("MD5");
    DigestOutputStream out = new DigestOutputStream(new NullOutputStream(), md5);
    try {
      FINGERPRINT_XML.toXML(c, new OutputStreamWriter(out, Charset.forName("UTF-8")));
    } finally {
      IOUtils.closeQuietly(out);
    }
    return Jenkins.getActiveInstance().getFingerprintMap().getOrCreate(null, pseudoFilename, md5.digest());
  } catch (NoSuchAlgorithmException e) {
    throw new IllegalStateException("JLS mandates MD5 as a supported digest algorithm");
  }
}

代码示例来源:origin: jenkinsci/credentials-plugin

/**
 * Retrieves the {@link Fingerprint} for a specific credential.
 *
 * @param c the credential.
 * @return the {@link Fingerprint} or {@code null} if the credential has no fingerprint associated with it.
 * @throws IOException if the credential's fingerprint hash could not be computed.
 * @since 2.1.1
 */
@CheckForNull
public static Fingerprint getFingerprintOf(@NonNull Credentials c) throws IOException {
  try {
    MessageDigest md5 = MessageDigest.getInstance("MD5");
    DigestOutputStream out = new DigestOutputStream(new NullOutputStream(), md5);
    try {
      FINGERPRINT_XML.toXML(c, new OutputStreamWriter(out, Charset.forName("UTF-8")));
    } finally {
      IOUtils.closeQuietly(out);
    }
    return Jenkins.getActiveInstance().getFingerprintMap().get(Util.toHexString(md5.digest()));
  } catch (NoSuchAlgorithmException e) {
    throw new IllegalStateException("JLS mandates MD5 as a supported digest algorithm");
  }
}

代码示例来源:origin: jenkinsci/credentials-plugin

/**
 * Creates a fingerprint that can be used to track the usage of a specific credential.
 *
 * @param c the credential to fingerprint.
 * @return the Fingerprint.
 * @throws IOException if the credential's fingerprint hash could not be computed.
 * @since 2.1.1
 */
@NonNull
public static Fingerprint getOrCreateFingerprintOf(@NonNull Credentials c) throws IOException {
  String pseudoFilename = String.format("Credential id=%s name=%s",
      c instanceof IdCredentials ? ((IdCredentials) c).getId() : "unknown", CredentialsNameProvider.name(c));
  try {
    MessageDigest md5 = MessageDigest.getInstance("MD5");
    DigestOutputStream out = new DigestOutputStream(new NullOutputStream(), md5);
    try {
      FINGERPRINT_XML.toXML(c, new OutputStreamWriter(out, Charset.forName("UTF-8")));
    } finally {
      IOUtils.closeQuietly(out);
    }
    return Jenkins.getActiveInstance().getFingerprintMap().getOrCreate(null, pseudoFilename, md5.digest());
  } catch (NoSuchAlgorithmException e) {
    throw new IllegalStateException("JLS mandates MD5 as a supported digest algorithm");
  }
}

代码示例来源:origin: jenkinsci/external-workspace-manager-plugin

/**
 * Registers a fingerprint for the given workspace's id.
 *
 * @param exws the workspace to register the fingerprint for
 * @throws IOException if fingerprint load operation fails
 */
private void registerFingerprint(ExternalWorkspace exws) throws IOException {
  FingerprintMap map = Jenkins.getActiveInstance().getFingerprintMap();
  Fingerprint f = map.getOrCreate(run, exws.getDisplayName(), exws.getId());
  if (f.getFacet(WorkspaceBrowserFacet.class) == null) {
    f.getFacets().add(new WorkspaceBrowserFacet(f, System.currentTimeMillis(), exws));
  }
  f.save();
}

代码示例来源:origin: jenkinsci/pipeline-maven-plugin

FingerprintMap fingerprintMap = Jenkins.getInstance().getFingerprintMap();
for (Map.Entry<String, String> artifactToFingerprint : artifactsToFingerPrint.entrySet()) {
  String artifactPathInFingerprintZone = artifactToFingerprint.getKey();

代码示例来源:origin: jenkinsci/copyartifact-plugin

if (fingerprints != null) {
  Map<String, String> fingerprintsShallow = new HashMap<>();
  FingerprintMap map = Jenkins.get().getFingerprintMap();
  for (Map.Entry<String, String> entry : fingerprints.entrySet()) {
    String name = entry.getKey().replaceFirst(".+/", "");

代码示例来源:origin: jenkinsci/pipeline-maven-plugin

FingerprintMap fingerprintMap = Jenkins.getInstance().getFingerprintMap();
for (Map.Entry<String, String> artifactToFingerprint : artifactsToFingerPrint.entrySet()) {
  String artifactPathInArchiveZone = artifactToFingerprint.getKey();

代码示例来源:origin: org.jenkins-ci.plugins/s3

FingerprintMap map = Jenkins.getInstance().getFingerprintMap();

代码示例来源:origin: jenkinsci/copyartifact-plugin

throw new AbortException("Jenkins instance no longer exists.");
FingerprintMap map = jenkins.getFingerprintMap();

相关文章

Jenkins类方法