Package io.jenkins.plugins.oak9
Class Oak9Builder
- java.lang.Object
-
- hudson.tasks.BuildStepCompatibilityLayer
-
- hudson.tasks.Builder
-
- io.jenkins.plugins.oak9.Oak9Builder
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<Builder>
,BuildStep
,SimpleBuildStep
public class Oak9Builder extends Builder implements SimpleBuildStep
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Oak9Builder.DescriptorImpl
-
Nested 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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Oak9ApiClient
generateHttpClient(Run<?,?> run, TaskListener taskListener)
Generate an API client to injectString
getBaseUrl()
Returns the current base URLString
getCredentialsId()
Fetches the credentials ID selected for the jobint
getMaxSeverity()
The severity at or above which the job will failString
getOrgId()
Fetches the user-specified oak9 Organization IDint
getPollingTimeoutSeconds()
The amount of time to wait for a validation to completeString
getProjectEnvironmentId()
Fetches the Jenkins Project Environment IDString
getProjectId()
Fetches the Jenkins Project IDvoid
perform(Run<?,?> run, FilePath workspace, EnvVars env, Launcher launcher, TaskListener taskListener)
Jenkins plugin entry point.void
setBaseUrl(String baseUrl)
Sets the BaseURL for communication with the oak9 APIvoid
setCredentialsId(String credentialsId)
Sets the credentials ID to be used for the runnervoid
setMaxSeverity(int maxSeverity)
Sets the severity at which the job will failvoid
setOrgId(String orgId)
Sets the oak9 Organization ID for the runnervoid
setPollingTimeoutSeconds(int pollingTimeoutSeconds)
Sets the amount of time to wait for a validation to completevoid
setProjectEnvironmentId(String projectEnvironmentId)
Sets the oak9 project environment ID for the runnervoid
setProjectId(String projectId)
Sets the oak9 project ID for the runner-
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 Detail
-
Oak9Builder
@DataBoundConstructor public Oak9Builder(String orgId, String projectId, String projectEnvironmentId, String credentialsId, int maxSeverity, String baseUrl, int pollingTimeoutSeconds)
Constructor is setup by Jenkins when it instantiates the plugin- Parameters:
orgId
- the oak9-provided org IDprojectId
- the oak9-provided project IDprojectEnvironmentId
- the oak9-provided project environment IDcredentialsId
- the ID to use to fetch the oak9 API Key from Jenkins secretsmaxSeverity
- the severity at which the job will fail (at or above)
-
-
Method Detail
-
setOrgId
@DataBoundSetter public void setOrgId(String orgId)
Sets the oak9 Organization ID for the runner- Parameters:
orgId
- the oak9-provided org ID
-
setProjectId
@DataBoundSetter public void setProjectId(String projectId)
Sets the oak9 project ID for the runner- Parameters:
projectId
- the oak9-provided project ID
-
setProjectEnvironmentId
@DataBoundSetter public void setProjectEnvironmentId(String projectEnvironmentId)
Sets the oak9 project environment ID for the runner- Parameters:
projectEnvironmentId
- the oak9-provided project environment ID
-
setCredentialsId
@DataBoundSetter public void setCredentialsId(String credentialsId)
Sets the credentials ID to be used for the runner- Parameters:
credentialsId
- a string for the credentials ID
-
setMaxSeverity
@DataBoundSetter public void setMaxSeverity(int maxSeverity)
Sets the severity at which the job will fail- Parameters:
maxSeverity
- an integer representing the max severity refer to io.jenkins.plugins.oak9.utils.Severity
-
setBaseUrl
@DataBoundSetter public void setBaseUrl(String baseUrl)
Sets the BaseURL for communication with the oak9 API- Parameters:
baseUrl
- the base URL to use
-
setPollingTimeoutSeconds
@DataBoundSetter public void setPollingTimeoutSeconds(int pollingTimeoutSeconds)
Sets the amount of time to wait for a validation to complete- Parameters:
pollingTimeoutSeconds
- an integer representing the seconds to wait
-
getBaseUrl
public String getBaseUrl()
Returns the current base URL- Returns:
-
getOrgId
public String getOrgId()
Fetches the user-specified oak9 Organization ID- Returns:
- the org ID
-
getProjectId
public String getProjectId()
Fetches the Jenkins Project ID- Returns:
- the Jenkins Project ID
-
getProjectEnvironmentId
public String getProjectEnvironmentId()
Fetches the Jenkins Project Environment ID- Returns:
- the Jenkins Project Environment ID
-
getCredentialsId
public String getCredentialsId()
Fetches the credentials ID selected for the job- Returns:
- The credentials ID selected for the job
-
getMaxSeverity
public int getMaxSeverity()
The severity at or above which the job will fail- Returns:
- the user-provided max severity
-
getPollingTimeoutSeconds
public int getPollingTimeoutSeconds()
The amount of time to wait for a validation to complete- Returns:
- the polling timeout
-
generateHttpClient
public Oak9ApiClient generateHttpClient(Run<?,?> run, TaskListener taskListener)
Generate an API client to inject- Parameters:
run
- the Jenkins runtaskListener
- the Jenkins task listener for logging- Returns:
- a ready-to-use http client
-
perform
public void perform(@NonNull Run<?,?> run, @NonNull FilePath workspace, @NonNull EnvVars env, @NonNull Launcher launcher, @NonNull TaskListener taskListener) throws IOException, InterruptedException
Jenkins plugin entry point.- Specified by:
perform
in interfaceSimpleBuildStep
- Parameters:
run
- the current Jenkins buildworkspace
- FilePath representing the Jenkins workspace for this projectenv
- Environment variableslauncher
- the Jenkins launchertaskListener
- the Jenkins task listener, used primarily for logging and setting task status- Throws:
IOException
- Thrown in the event of a permanent errorInterruptedException
-
-