public class Utils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
checkRegistryEndpoint(DefaultBuildStep buildstep)
Checks Registry endpoint values for empty or null values.
|
static String |
createBasicAuthHeader(String username,
String password)
Creates authorization header for basic security.
|
static hudson.util.FormValidation |
doCheckHost(hudson.model.Item context,
boolean useCustomRegistry,
String host,
String port,
String tokenCredentialId)
Helping method for checking custom Registry endpoint input.
|
static List<String> |
getFilesMatchingWildcard(String wildcard,
String startDir)
Retrieves list of file paths matching the wildcard.
|
static List<String> |
getFilesMatchingWildcardList(List<String> marFilesWildcards,
String workspace)
Retrieves list of file paths matching the list of wildcards.
|
static com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials |
lookupCredentials(hudson.model.Item context,
String credentialId)
Resolves jenkins credentials by id.
|
static String |
resolveParameter(String parameter,
hudson.model.Run<?,?> run,
hudson.model.TaskListener listener)
Resolves single Jenkins parameter from build based on job environment.
|
static List<String> |
resolveParameters(List<String> parameters,
hudson.model.Run<?,?> run,
hudson.model.TaskListener listener)
Resolves Jenkins parameters from build based on job environment and returns them as List
containing resolved parameters or original value.
|
public static String createBasicAuthHeader(String username, String password) throws UnsupportedEncodingException
username - usernamepassword - passwordUnsupportedEncodingException - when encoding failedpublic static hudson.util.FormValidation doCheckHost(@AncestorInPath
hudson.model.Item context,
boolean useCustomRegistry,
String host,
String port,
String tokenCredentialId)
useCustomRegistry - if custom Registry endpoint should be usedhost - host to Registryport - port to RegistrytokenCredentialId - credentials token idpublic static void checkRegistryEndpoint(DefaultBuildStep buildstep) throws hudson.AbortException
buildstep - build step that extend DefaultBuildStephudson.AbortException - if some required fields are nullpublic static List<String> resolveParameters(List<String> parameters, hudson.model.Run<?,?> run, hudson.model.TaskListener listener) throws IOException, InterruptedException
parameters - list of parametersrun - specific jenkins job runlistener - listener of the same job runIOException - when there is a problem of getting build environmentInterruptedException - interrupted exceptionpublic static String resolveParameter(String parameter, hudson.model.Run<?,?> run, hudson.model.TaskListener listener) throws IOException, InterruptedException
parameter - parameterrun - specific jenkins job runlistener - listener of the same job runIOException - when there is a problem of getting build environmentInterruptedException - interrupted exceptionpublic static com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials lookupCredentials(@AncestorInPath
hudson.model.Item context,
String credentialId)
credentialId - idpublic static List<String> getFilesMatchingWildcardList(List<String> marFilesWildcards, String workspace) throws hudson.AbortException
marFilesWildcards - wildcardsworkspace - project workspace pathhudson.AbortException - if there are no files matching wildcardpublic static List<String> getFilesMatchingWildcard(String wildcard, String startDir) throws hudson.AbortException
wildcard - wildcardstartDir - search root folder pathhudson.AbortException - if there are no files matching wildcardCopyright © 2016–2022 CA Technologies. All rights reserved.