Package io.jenkins.plugins.armorcode
Class ArmorCodeReleaseGateBuilder
java.lang.Object
hudson.tasks.BuildStepCompatibilityLayer
hudson.tasks.Builder
io.jenkins.plugins.armorcode.ArmorCodeReleaseGateBuilder
- All Implemented Interfaces:
ExtensionPoint,Describable<Builder>,BuildStep,SimpleBuildStep
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDescriptor that tells Jenkins how to display and instantiate this step.Nested classes/interfaces inherited from interface hudson.tasks.BuildStep
BuildStep.PublisherListNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudsonNested 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
ConstructorsConstructorDescriptionArmorCodeReleaseGateBuilder(String product, Object subProducts, String env) Required constructor parameters. -
Method Summary
Modifier and TypeMethodDescriptiongetEnv()intgetMode()intvoidperform(Run<?, ?> run, FilePath workspace, Launcher launcher, TaskListener listener) Executes the release gate check.protected StringpostArmorCodeRequest(TaskListener listener, String token, String buildNumber, String jobName, int current, int end, String apiUrl, String jobUrl) Sends a POST request to ArmorCode's build validation endpoint with the given parameters, then returns the raw JSON response.voidsetMaxRetries(int maxRetries) Optional parameter: how many times to retry the validation check.voidOptional parameter: "block" or "warn" mode.voidsetRetryDelay(int retryDelay) voidsetTargetUrl(String targetUrl) Methods inherited from class hudson.tasks.Builder
all, getDescriptor, prebuildMethods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, getProjectAction, getProjectActions, perform, perform, prebuildMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface hudson.tasks.BuildStep
getProjectAction, getProjectActions, perform, prebuildMethods inherited from interface jenkins.tasks.SimpleBuildStep
perform, perform, requiresWorkspace
-
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
-
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
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
-
getSubProducts
-
getEnv
-
getMaxRetries
public int getMaxRetries() -
getMode
-
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, AbortExceptionExecutes 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:
performin interfaceSimpleBuildStep- Throws:
InterruptedExceptionAbortException
-
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
- Specified by:
getRequiredMonitorServicein interfaceBuildStep- Overrides:
getRequiredMonitorServicein classBuilder
-