Package io.jenkins.plugins.kubevirt
Class SshCredentialHelper
java.lang.Object
io.jenkins.plugins.kubevirt.SshCredentialHelper
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 TypeMethodDescriptionstatic com.cloudbees.plugins.credentials.common.StandardUsernameCredentialsLooks up an SSH credential by ID from the Jenkins global credential store.static com.cloudbees.plugins.credentials.common.StandardUsernameCredentialslookupOrFail(String credentialsId) Validates that SSH credentials are configured and resolvable.
-
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
nullif 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
-