Class DeploymentStepUtils
- java.lang.Object
-
- com.atlassian.bitbucket.jenkins.internal.deployments.DeploymentStepUtils
-
public class DeploymentStepUtils extends Object
- Since:
- 3.1.0
-
-
Constructor Summary
Constructors Constructor Description DeploymentStepUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BitbucketDeploymentEnvironment
getEnvironment(DeploymentStep step, Run<?,?> run, TaskListener listener)
Create aBitbucketDeploymentEnvironment
.static String
getOrGenerateEnvironmentKey()
Generates a random UUID to be used as an environment key.static String
getOrGenerateEnvironmentKey(String environmentKey)
Gets the providedenvironmentKey
, stripping away whitespace, or generates a random UUID if a blankenvironmentKey
was provided.static BitbucketDeploymentEnvironmentType
normalizeEnvironmentType(String environmentType)
Converts an environment type String to aBitbucketDeploymentEnvironmentType
.
-
-
-
Method Detail
-
getOrGenerateEnvironmentKey
public static String getOrGenerateEnvironmentKey()
Generates a random UUID to be used as an environment key.- Returns:
- the generated
environmentKey
, or a generated one if the provided one is blank
-
getOrGenerateEnvironmentKey
public static String getOrGenerateEnvironmentKey(@CheckForNull String environmentKey)
Gets the providedenvironmentKey
, stripping away whitespace, or generates a random UUID if a blankenvironmentKey
was provided.- Parameters:
environmentKey
- a unique identifier for the environment, ornull
to have one generated- Returns:
- the provided
environmentKey
, or a generated one if the provided one is blank
-
normalizeEnvironmentType
@CheckForNull public static BitbucketDeploymentEnvironmentType normalizeEnvironmentType(@CheckForNull String environmentType)
Converts an environment type String to aBitbucketDeploymentEnvironmentType
.- Parameters:
environmentType
- theEnum.name()
- Returns:
- the associated
BitbucketDeploymentEnvironmentType
ornull
if there is none that match
-
getEnvironment
public static BitbucketDeploymentEnvironment getEnvironment(DeploymentStep step, Run<?,?> run, TaskListener listener)
Create aBitbucketDeploymentEnvironment
.- Parameters:
step
- theDeploymentStep
being executedrun
- theRun
listener
- theTaskListener
- Returns:
- the
BitbucketDeploymentEnvironment
configured by the provided step
-
-