Class ArmorCodeReleaseGateBuilder

java.lang.Object
hudson.tasks.BuildStepCompatibilityLayer
hudson.tasks.Builder
io.jenkins.plugins.armorcode.ArmorCodeReleaseGateBuilder
All Implemented Interfaces:
ExtensionPoint, Describable<Builder>, BuildStep, SimpleBuildStep

public class ArmorCodeReleaseGateBuilder extends Builder implements SimpleBuildStep
  • Constructor Details

    • ArmorCodeReleaseGateBuilder

      @DataBoundConstructor public ArmorCodeReleaseGateBuilder(String product, Object subProducts, String env)
      Required constructor parameters.
      Parameters:
      product - The ArmorCode product (group) ID.
      subProducts - The ArmorCode sub-product (subgroup) ID.
      env - The environment (e.g. "Production", "Staging").
  • Method Details

    • setTargetUrl

      @DataBoundSetter public void setTargetUrl(String targetUrl)
    • setMaxRetries

      @DataBoundSetter public void setMaxRetries(int maxRetries)
      Optional parameter: how many times to retry the validation check.
      Parameters:
      maxRetries - The maximum number of retries (default 30).
    • setMode

      @DataBoundSetter public void setMode(String mode)
      Optional parameter: "block" or "warn" mode. - "block" (default) fails the build on SLA failure. - "warn" marks the build UNSTABLE but continues.
      Parameters:
      mode - The validation mode ("block" or "warn").
    • getProduct

      public String getProduct()
    • getSubProducts

      public Object getSubProducts()
    • getEnv

      public String getEnv()
    • getMaxRetries

      public int getMaxRetries()
    • getMode

      public String getMode()
    • getTargetUrl

      public String getTargetUrl()
    • setRetryDelay

      @DataBoundSetter public void setRetryDelay(int retryDelay)
    • getRetryDelay

      public int getRetryDelay()
    • perform

      public void perform(@NonNull Run<?,?> run, @NonNull FilePath workspace, @NonNull Launcher launcher, @NonNull TaskListener listener) throws InterruptedException, AbortException
      Executes the release gate check. Polls ArmorCode up to maxRetries times, parsing the status each time. Depending on the mode, the build either fails or continues if an SLA violation is found.
      Specified by:
      perform in interface SimpleBuildStep
      Throws:
      InterruptedException
      AbortException
    • postArmorCodeRequest

      protected String postArmorCodeRequest(@NonNull TaskListener listener, String token, String buildNumber, String jobName, int current, int end, String apiUrl, String jobUrl) throws Exception
      Sends a POST request to ArmorCode's build validation endpoint with the given parameters, then returns the raw JSON response.
      Throws:
      Exception
    • getRequiredMonitorService

      public BuildStepMonitor getRequiredMonitorService()
      Specified by:
      getRequiredMonitorService in interface BuildStep
      Overrides:
      getRequiredMonitorService in class Builder