Class RemoteBuildConfiguration
java.lang.Object
hudson.tasks.BuildStepCompatibilityLayer
hudson.tasks.Builder
org.jenkinsci.plugins.ParameterizedRemoteTrigger.RemoteBuildConfiguration
- All Implemented Interfaces:
ExtensionPoint
,Describable<Builder>
,BuildStep
,Serializable
,SimpleBuildStep
- Author:
- Maurice W.
- See Also:
-
Nested Class Summary
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
abortRemoteTask
(RemoteJenkinsServer remoteServer, Handle handle, BuildContext context) doGet
(String urlString, BuildContext context, RemoteBuildStatus remoteBuildStatus) Orchestrates all calls to the remote server.Tries to identify the effective Remote Host configuration based on the different parameters likeremoteJenkinsName
and the globally configured remote host,remoteJenkinsURL
which overrides the address locally orjob
which can be a full job URL.protected void
failBuild
(Exception e, PrintStream logger) Convenience function to mark the build as failed.findRemoteHost
(String displayName) Lookup up the globally configured Remote Jenkins Server based on display nameprotected static URL
generateEffectiveRemoteBuildURL
(URL remoteBuildURL, String effectiveRemoteServerAddress) protected static String
generateJobUrl
(RemoteJenkinsServer remoteServer, String jobNameOrUrl) getAuth2()
boolean
int
boolean
int
int
getJob()
int
boolean
Deprecated.boolean
getParameterMap
(BuildContext context) int
getPollInterval
(RemoteBuildStatus remoteBuildStatus) boolean
boolean
getToken()
boolean
boolean
boolean
boolean
isStepDisabled
(PrintStream printStream) boolean
boolean
boolean
perform
(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) void
perform
(Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener) Triggers the remote job and, waits until completion ifblockBuildUntilComplete
is set.performTriggerAndGetQueueId
(BuildContext context) Triggers the remote job, identifies the queue ID and, returns aHandle
to this remote execution.void
performWaitForBuild
(BuildContext context, Handle handle) Checks the remote build status and, waits for completion ifblockBuildUntilComplete
is set.protected Object
protected static String
removeHashParameters
(String string) protected static String
removeQueryParameters
(String string) protected static String
removeTrailingSlashes
(String string) void
setAbortTriggeredJob
(boolean abortTriggeredJob) void
void
setBlockBuildUntilComplete
(boolean blockBuildUntilComplete) void
setDisabled
(boolean disabled) void
setEnhancedLogging
(boolean enhancedLogging) void
setHttpGetReadTimeout
(int readTimeout) void
setHttpPostReadTimeout
(int readTimeout) void
void
setMaxConn
(int maxConn) void
setOverrideTrustAllCertificates
(boolean overrideTrustAllCertificates) void
setParameters
(String parameters) void
setParameters2
(JobParameters parameters2) void
setPollInterval
(int pollInterval) void
setPreventRemoteBuildQueue
(boolean preventRemoteBuildQueue) void
setRemoteJenkinsName
(String remoteJenkinsName) void
setRemoteJenkinsUrl
(String remoteJenkinsUrl) void
setShouldNotFailBuild
(boolean shouldNotFailBuild) void
void
setTrustAllCertificates
(boolean trustAllCertificates) void
setUseCrumbCache
(boolean useCrumbCache) void
setUseJobInfoCache
(boolean useJobInfoCache) updateBuildInfo
(RemoteBuildInfo buildInfo, BuildContext context) Methods inherited from class hudson.tasks.Builder
all, getRequiredMonitorService, prebuild
Methods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, getProjectAction, getProjectActions, 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, prebuild
Methods inherited from interface jenkins.tasks.SimpleBuildStep
perform, perform, requiresWorkspace
-
Constructor Details
-
RemoteBuildConfiguration
@DataBoundConstructor public RemoteBuildConfiguration()
-
-
Method Details
-
readResolve
-
setTrustAllCertificates
@DataBoundSetter public void setTrustAllCertificates(boolean trustAllCertificates) -
setOverrideTrustAllCertificates
@DataBoundSetter public void setOverrideTrustAllCertificates(boolean overrideTrustAllCertificates) -
setAbortTriggeredJob
@DataBoundSetter public void setAbortTriggeredJob(boolean abortTriggeredJob) -
setMaxConn
@DataBoundSetter public void setMaxConn(int maxConn) -
setRemoteJenkinsName
-
setRemoteJenkinsUrl
-
setAuth2
-
setParameters2
-
setShouldNotFailBuild
@DataBoundSetter public void setShouldNotFailBuild(boolean shouldNotFailBuild) -
setPreventRemoteBuildQueue
@DataBoundSetter public void setPreventRemoteBuildQueue(boolean preventRemoteBuildQueue) -
setHttpGetReadTimeout
@DataBoundSetter public void setHttpGetReadTimeout(int readTimeout) -
setHttpPostReadTimeout
@DataBoundSetter public void setHttpPostReadTimeout(int readTimeout) -
setPollInterval
@DataBoundSetter public void setPollInterval(int pollInterval) -
setBlockBuildUntilComplete
@DataBoundSetter public void setBlockBuildUntilComplete(boolean blockBuildUntilComplete) -
setJob
-
setToken
-
setParameters
-
setEnhancedLogging
@DataBoundSetter public void setEnhancedLogging(boolean enhancedLogging) -
setDisabled
@DataBoundSetter public void setDisabled(boolean disabled) -
setUseJobInfoCache
@DataBoundSetter public void setUseJobInfoCache(boolean useJobInfoCache) -
setUseCrumbCache
@DataBoundSetter public void setUseCrumbCache(boolean useCrumbCache) -
getParameterMap
- Throws:
AbortException
-
evaluateEffectiveRemoteHost
@NonNull public RemoteJenkinsServer evaluateEffectiveRemoteHost(BasicBuildContext context) throws IOException Tries to identify the effective Remote Host configuration based on the different parameters likeremoteJenkinsName
and the globally configured remote host,remoteJenkinsURL
which overrides the address locally orjob
which can be a full job URL.- Parameters:
context
- the context of this Builder/BuildStep.- Returns:
RemoteJenkinsServer
a RemoteJenkinsServer object, never null.- Throws:
AbortException
- if no server found and remoteJenkinsUrl empty.MalformedURLException
- ifremoteJenkinsName
no valid URL orjob
an URL but nor valid.IOException
-
getLock
-
findRemoteHost
Lookup up the globally configured Remote Jenkins Server based on display name- Parameters:
displayName
- Name of the configuration you are looking for- Returns:
- A deep-copy of the RemoteJenkinsServer object configured globally
-
removeTrailingSlashes
-
removeQueryParameters
-
removeHashParameters
-
failBuild
Convenience function to mark the build as failed. It's intended to only be called from this.perform().- Parameters:
e
- exception that caused the build to fail.logger
- build listener.- Throws:
IOException
- if the build fails andshouldNotFailBuild
is not set.
-
abortRemoteTask
public void abortRemoteTask(RemoteJenkinsServer remoteServer, Handle handle, BuildContext context) throws IOException, InterruptedException - Throws:
IOException
InterruptedException
-
perform
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException, IllegalArgumentException- Specified by:
perform
in interfaceBuildStep
- Overrides:
perform
in classBuildStepCompatibilityLayer
- Throws:
InterruptedException
IOException
IllegalArgumentException
-
isStepDisabled
-
perform
public void perform(Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws InterruptedException, IOExceptionTriggers the remote job and, waits until completion ifblockBuildUntilComplete
is set.- Specified by:
perform
in interfaceSimpleBuildStep
- Throws:
InterruptedException
- if any thread has interrupted the current thread.IOException
- if there is an error retrieving the remote build data, or, if there is an error retrieving the remote build status, or, if there is an error retrieving the console output of the remote build, or, if the remote build does not succeed.
-
performTriggerAndGetQueueId
public Handle performTriggerAndGetQueueId(@NonNull BuildContext context) throws IOException, InterruptedException Triggers the remote job, identifies the queue ID and, returns aHandle
to this remote execution.- Parameters:
context
- the context of this Builder/BuildStep.- Returns:
- Handle to further tracking of the remote build status.
- Throws:
IOException
- if there is an error triggering the remote job.InterruptedException
- if any thread has interrupted the current thread.
-
performWaitForBuild
public void performWaitForBuild(BuildContext context, Handle handle) throws IOException, InterruptedException Checks the remote build status and, waits for completion ifblockBuildUntilComplete
is set.- Parameters:
context
- the context of this Builder/BuildStep.handle
- the handle to the remote execution.- Throws:
InterruptedException
- if any thread has interrupted the current thread.IOException
- if any HTTP error or business logic error
-
updateBuildInfo
@NonNull public RemoteBuildInfo updateBuildInfo(@NonNull RemoteBuildInfo buildInfo, @NonNull BuildContext context) throws IOException, InterruptedException - Throws:
IOException
InterruptedException
-
generateEffectiveRemoteBuildURL
protected static URL generateEffectiveRemoteBuildURL(URL remoteBuildURL, String effectiveRemoteServerAddress) throws AbortException - Throws:
AbortException
-
doGet
public ConnectionResponse doGet(String urlString, BuildContext context, RemoteBuildStatus remoteBuildStatus) throws IOException, InterruptedException Orchestrates all calls to the remote server. Also takes care of any credentials or failed-connection retries.- Parameters:
urlString
- the URL that needs to be called.context
- the context of this Builder/BuildStep.remoteBuildStatus
- the build status of a remote build.- Returns:
- JSONObject a valid JSON object, or null.
- Throws:
InterruptedException
- if any thread has interrupted the current thread.IOException
- if any HTTP error occurred.
-
isAbortTriggeredJob
public boolean isAbortTriggeredJob() -
getMaxConn
public int getMaxConn() -
getRemoteJenkinsName
- Returns:
- the configured remote Jenkins name. That's the ID of a globally configured remote host.
-
getRemoteJenkinsUrl
- Returns:
- the configured remote Jenkins URL. This is not necessarily the
effective Jenkins URL, e.g. if a full URL is specified for
job
!
-
getHttpGetReadTimeout
public int getHttpGetReadTimeout() -
getHttpPostReadTimeout
public int getHttpPostReadTimeout() -
getOverrideAuth
public boolean getOverrideAuth()Deprecated.since 2.3.0-SNAPSHOT - usegetAuth2()
instead.- Returns:
- true, if the authorization is overridden in the job configuration, otherwise false.
-
getAuth2
-
getShouldNotFailBuild
public boolean getShouldNotFailBuild() -
getPreventRemoteBuildQueue
public boolean getPreventRemoteBuildQueue() -
getPollInterval
-
getBlockBuildUntilComplete
public boolean getBlockBuildUntilComplete() -
getJob
- Returns:
- the configured
job
value. Can be a job name or full job URL.
-
getToken
-
getEnhancedLogging
public boolean getEnhancedLogging() -
getParameters2
-
getConnectionRetryLimit
public int getConnectionRetryLimit() -
isDisabled
public boolean isDisabled() -
generateJobUrl
protected static String generateJobUrl(RemoteJenkinsServer remoteServer, String jobNameOrUrl) throws AbortException - Throws:
AbortException
-
getDescriptor
- Specified by:
getDescriptor
in interfaceDescribable<Builder>
- Overrides:
getDescriptor
in classBuilder
-
isUseCrumbCache
public boolean isUseCrumbCache() -
isUseJobInfoCache
public boolean isUseJobInfoCache() -
getTrustAllCertificates
public boolean getTrustAllCertificates() -
getOverrideTrustAllCertificates
public boolean getOverrideTrustAllCertificates()
-
getAuth2()
instead.