Class RelizaPR

All Implemented Interfaces:
ExtensionPoint, Describable<Builder>, BuildStep, SimpleBuildStep

public class RelizaPR extends Builder implements SimpleBuildStep
Method that denotes that we are sending data for a pull request.

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.

  • Constructor Details

    • RelizaPR

      @DataBoundConstructor public RelizaPR()
      Builder initialization with no required parameters.
  • Method Details

    • setTargetBranch

      @DataBoundSetter public void setTargetBranch(String targetBranch)
      Optional parameter for builder initialization.
      Parameters:
      targetBranch - - Used set the targetBranch.
    • setbaseBranch

      @DataBoundSetter public void setbaseBranch(String baseBranch)
      Optional parameter for builder initialization.
      Parameters:
      baseBranch - - Used set the baseBranch.
    • setState

      @DataBoundSetter public void setState(String state)
      Optional parameter for builder initialization.
      Parameters:
      state - - Used to override given state if needed.
    • setEndpoint

      @DataBoundSetter public void setEndpoint(String endpoint)
      Optional parameter for builder initialization.
      Parameters:
      endpoint - - Used to set the HTML endpoint of the PullRequest
    • settitle

      @DataBoundSetter public void settitle(String title)
      Optional parameter for builder initialization.
      Parameters:
      title - - Used to set the title of the PullRequest
    • setNumber

      @DataBoundSetter public void setNumber(String number)
      Optional parameter for builder initialization.
      Parameters:
      number - - Used to set the title of the PullRequest
    • setProjectId

      @DataBoundSetter public void setProjectId(String projectId)
      Optional parameter for builder initialization.
      Parameters:
      projectId - - UUID of project, only used when supplying custom version.
    • setUri

      @DataBoundSetter public void setUri(String uri)
      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

      @DataBoundSetter public void setMergedDate(String mergedDate)
      Optional parameter for builder initialization.
      Parameters:
      mergedDate - - Used to set the datetime when the pull request was merged
    • setClosedDate

      @DataBoundSetter public void setClosedDate(String closedDate)
      Optional parameter for builder initialization.
      Parameters:
      closedDate - - Used to set the datetime when the pull request was closed
    • setCreatedDate

      @DataBoundSetter public void setCreatedDate(String createdDate)
      Optional parameter for builder initialization.
      Parameters:
      createdDate - - Used to set the datetime when the pull request was created
    • setCommits

      @DataBoundSetter public void setCommits(String commits)
      Sets up optional parameters from buildwrapper initialization.
      Parameters:
      commits - - comma seprated commit shas on the pull request
    • setCommit

      @DataBoundSetter public void setCommit(String commit)
      Sets up optional parameters from buildwrapper initialization.
      Parameters:
      commit - - current commit sha of the pull request
    • setEnvSuffix

      @DataBoundSetter public void setEnvSuffix(String envSuffix)
      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, IOException
      Extracts project details from environment variables to send release metadata to reliza hub.
      Specified by:
      perform in interface SimpleBuildStep
      Throws:
      InterruptedException
      IOException
    • toUUID

      public static UUID toUUID(String projectId, TaskListener listener)
      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

      public static String resolveEnvVar(String envVar, String suffix, EnvVars envVars)
      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 variables
      suffix - - Search for environment variables with this suffix
      envVars - - Map of all environment variables to search through
      Returns:
      Corresponding value from environment variable map