Class SshCredentialHelper

java.lang.Object
io.jenkins.plugins.kubevirt.SshCredentialHelper

public final class SshCredentialHelper extends Object
Utility class for looking up and validating SSH credentials from the Jenkins credential store.

Centralises the credential lookup logic used during VM provisioning (KubeVirtProvisioningLauncher) so it is not duplicated across multiple classes.

  • Method Summary

    Modifier and Type
    Method
    Description
    static com.cloudbees.plugins.credentials.common.StandardUsernameCredentials
    lookup(String credentialsId)
    Looks up an SSH credential by ID from the Jenkins global credential store.
    static com.cloudbees.plugins.credentials.common.StandardUsernameCredentials
    lookupOrFail(String credentialsId)
    Validates that SSH credentials are configured and resolvable.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • lookup

      public static com.cloudbees.plugins.credentials.common.StandardUsernameCredentials lookup(String credentialsId)
      Looks up an SSH credential by ID from the Jenkins global credential store.
      Parameters:
      credentialsId - The credential ID to look up
      Returns:
      The matching credential, or null if not found
    • lookupOrFail

      public static com.cloudbees.plugins.credentials.common.StandardUsernameCredentials lookupOrFail(String credentialsId) throws IOException
      Validates that SSH credentials are configured and resolvable.
      Parameters:
      credentialsId - The credential ID to validate
      Returns:
      The resolved credential (never null)
      Throws:
      IOException - If the credential ID is blank or cannot be found