Class RelizaPR
- All Implemented Interfaces:
ExtensionPoint
,Describable<Builder>
,BuildStep
,SimpleBuildStep
Method itself does not require parameters but requires that the Flags class passed during library initialization contains these parameters.
- apiKeyId (required) - flag for instance api id.
- apiKey (required) - flag for instance api key.
- branch (required) - flag to denote name of the base branch for the pull request.
- targetBranch (required) - flag to denote name of the target branch for the pull request.
- state (required) - flag to denote state of the pull request.
- endpoint (required) - flag to denote HTML endpoint of the pull request.
- title (required) - flag to denote title of the pull request.
- number (required) - flag to denote number of the pull request.
- commits (required) - flag to denote comma seprated commit shas on this pull request (Optional when single commit flag is used).
- commit (optional) - flag to denote current commit sha of this pull request.
- createdDate (required) - flag to denote datetime when the pull request was created.
- closedDate (optional) - flag to denote datetime when the pull request was closed.
- mergedDate (optional) - flag to denote datetime when the pull request was merged.
- projectId (optional) - flag to denote project uuid. Required if organization-wide read-write key is used, ignored if project specific api key is used.
returns true if successful API call and null otherwise.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface hudson.tasks.BuildStep
BuildStep.PublisherList
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
Nested classes/interfaces inherited from interface jenkins.tasks.SimpleBuildStep
SimpleBuildStep.LastBuildAction, SimpleBuildStep.LastBuildActionFactory
-
Field Summary
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
perform
(Run<?, ?> run, FilePath workspace, EnvVars envVars, Launcher launcher, TaskListener listener) Extracts project details from environment variables to send release metadata to reliza hub.static String
resolveEnvVar
(String envVar, String suffix, EnvVars envVars) Obtains env variable with envSuffix if it exists, otherwise obtains env variable without envSuffix.void
setbaseBranch
(String baseBranch) Optional parameter for builder initialization.void
setClosedDate
(String closedDate) Optional parameter for builder initialization.void
Sets up optional parameters from buildwrapper initialization.void
setCommits
(String commits) Sets up optional parameters from buildwrapper initialization.void
setCreatedDate
(String createdDate) Optional parameter for builder initialization.void
setEndpoint
(String endpoint) Optional parameter for builder initialization.void
setEnvSuffix
(String envSuffix) Sets up optional parameters from buildwrapper initialization.void
setMergedDate
(String mergedDate) Optional parameter for builder initialization.void
Optional parameter for builder initialization.void
setProjectId
(String projectId) Optional parameter for builder initialization.void
Optional parameter for builder initialization.void
setTargetBranch
(String targetBranch) Optional parameter for builder initialization.void
Optional parameter for builder initialization.void
Optional parameter for builder initialization.static UUID
toUUID
(String projectId, TaskListener listener) String to UUID converter which handles conversion errors.Methods inherited from class hudson.tasks.Builder
all, getDescriptor, getRequiredMonitorService, prebuild
Methods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, getProjectAction, getProjectActions, perform, perform, prebuild
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface hudson.tasks.BuildStep
getProjectAction, getProjectActions, getRequiredMonitorService, perform, prebuild
Methods inherited from interface jenkins.tasks.SimpleBuildStep
perform, perform, requiresWorkspace
-
Constructor Details
-
RelizaPR
@DataBoundConstructor public RelizaPR()Builder initialization with no required parameters.
-
-
Method Details
-
setTargetBranch
Optional parameter for builder initialization.- Parameters:
targetBranch
- - Used set the targetBranch.
-
setbaseBranch
Optional parameter for builder initialization.- Parameters:
baseBranch
- - Used set the baseBranch.
-
setState
Optional parameter for builder initialization.- Parameters:
state
- - Used to override given state if needed.
-
setEndpoint
Optional parameter for builder initialization.- Parameters:
endpoint
- - Used to set the HTML endpoint of the PullRequest
-
settitle
Optional parameter for builder initialization.- Parameters:
title
- - Used to set the title of the PullRequest
-
setNumber
Optional parameter for builder initialization.- Parameters:
number
- - Used to set the title of the PullRequest
-
setProjectId
Optional parameter for builder initialization.- Parameters:
projectId
- - UUID of project, only used when supplying custom version.
-
setUri
Optional parameter for builder initialization.- Parameters:
uri
- - Base uri of api call, only used when supplying custom version. Default set to "https://app.relizahub.com".
-
setMergedDate
Optional parameter for builder initialization.- Parameters:
mergedDate
- - Used to set the datetime when the pull request was merged
-
setClosedDate
Optional parameter for builder initialization.- Parameters:
closedDate
- - Used to set the datetime when the pull request was closed
-
setCreatedDate
Optional parameter for builder initialization.- Parameters:
createdDate
- - Used to set the datetime when the pull request was created
-
setCommits
Sets up optional parameters from buildwrapper initialization.- Parameters:
commits
- - comma seprated commit shas on the pull request
-
setCommit
Sets up optional parameters from buildwrapper initialization.- Parameters:
commit
- - current commit sha of the pull request
-
setEnvSuffix
Sets up optional parameters from buildwrapper initialization.- Parameters:
envSuffix
- - Flag which adds a suffix to all environment variables to differentiate from other withReliza calls.
-
perform
public void perform(Run<?, ?> run, FilePath workspace, EnvVars envVars, Launcher launcher, TaskListener listener) throws InterruptedException, IOExceptionExtracts project details from environment variables to send release metadata to reliza hub.- Specified by:
perform
in interfaceSimpleBuildStep
- Throws:
InterruptedException
IOException
-
toUUID
String to UUID converter which handles conversion errors.- Parameters:
projectId
- - Project UUID.listener
- - TaskListener to log specific error.- Returns:
- Corresponding UUID if conversion succeeded and null otherwise.
-
resolveEnvVar
Obtains env variable with envSuffix if it exists, otherwise obtains env variable without envSuffix. If neither exist null is passed through.- Parameters:
envVar
- - Key to resolve to a value using environment variablessuffix
- - Search for environment variables with this suffixenvVars
- - Map of all environment variables to search through- Returns:
- Corresponding value from environment variable map
-