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 ClassesNested 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidabortRemoteTask(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 likeremoteJenkinsNameand the globally configured remote host,remoteJenkinsURLwhich overrides the address locally orjobwhich can be a full job URL.protected voidfailBuild(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 URLgenerateEffectiveRemoteBuildURL(URL remoteBuildURL, String effectiveRemoteServerAddress) protected static StringgenerateJobUrl(RemoteJenkinsServer remoteServer, String jobNameOrUrl) getAuth2()booleanintbooleanintintgetJob()intbooleanDeprecated.booleangetParameterMap(BuildContext context) intgetPollInterval(RemoteBuildStatus remoteBuildStatus) booleanbooleangetToken()booleanbooleanbooleanbooleanisStepDisabled(PrintStream printStream) booleanbooleanbooleanperform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) voidperform(Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener) Triggers the remote job and, waits until completion ifblockBuildUntilCompleteis set.performTriggerAndGetQueueId(BuildContext context) Triggers the remote job, identifies the queue ID and, returns aHandleto this remote execution.voidperformWaitForBuild(BuildContext context, Handle handle) Checks the remote build status and, waits for completion ifblockBuildUntilCompleteis set.protected Objectprotected static StringremoveHashParameters(String string) protected static StringremoveQueryParameters(String string) protected static StringremoveTrailingSlashes(String string) voidsetAbortTriggeredJob(boolean abortTriggeredJob) voidvoidsetBlockBuildUntilComplete(boolean blockBuildUntilComplete) voidsetDisabled(boolean disabled) voidsetEnhancedLogging(boolean enhancedLogging) voidsetHttpGetReadTimeout(int readTimeout) voidsetHttpPostReadTimeout(int readTimeout) voidvoidsetMaxConn(int maxConn) voidsetOverrideTrustAllCertificates(boolean overrideTrustAllCertificates) voidsetParameters(String parameters) voidsetParameters2(JobParameters parameters2) voidsetPollInterval(int pollInterval) voidsetPreventRemoteBuildQueue(boolean preventRemoteBuildQueue) voidsetRemoteJenkinsName(String remoteJenkinsName) voidsetRemoteJenkinsUrl(String remoteJenkinsUrl) voidsetShouldNotFailBuild(boolean shouldNotFailBuild) voidvoidsetTrustAllCertificates(boolean trustAllCertificates) voidsetUseCrumbCache(boolean useCrumbCache) voidsetUseJobInfoCache(boolean useJobInfoCache) updateBuildInfo(RemoteBuildInfo buildInfo, BuildContext context) Methods inherited from class hudson.tasks.Builder
all, getRequiredMonitorService, prebuildMethods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, getProjectAction, getProjectActions, 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, getRequiredMonitorService, prebuildMethods 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 likeremoteJenkinsNameand the globally configured remote host,remoteJenkinsURLwhich overrides the address locally orjobwhich can be a full job URL.- Parameters:
context- the context of this Builder/BuildStep.- Returns:
RemoteJenkinsServera RemoteJenkinsServer object, never null.- Throws:
AbortException- if no server found and remoteJenkinsUrl empty.MalformedURLException- ifremoteJenkinsNameno valid URL orjoban 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 andshouldNotFailBuildis not set.
-
abortRemoteTask
public void abortRemoteTask(RemoteJenkinsServer remoteServer, Handle handle, BuildContext context) throws IOException, InterruptedException - Throws:
IOExceptionInterruptedException
-
perform
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException, IllegalArgumentException- Specified by:
performin interfaceBuildStep- Overrides:
performin classBuildStepCompatibilityLayer- Throws:
InterruptedExceptionIOExceptionIllegalArgumentException
-
isStepDisabled
-
perform
public void perform(Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws InterruptedException, IOExceptionTriggers the remote job and, waits until completion ifblockBuildUntilCompleteis set.- Specified by:
performin 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 aHandleto 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 ifblockBuildUntilCompleteis 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:
IOExceptionInterruptedException
-
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
jobvalue. 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:
getDescriptorin interfaceDescribable<Builder>- Overrides:
getDescriptorin classBuilder
-
isUseCrumbCache
public boolean isUseCrumbCache() -
isUseJobInfoCache
public boolean isUseJobInfoCache() -
getTrustAllCertificates
public boolean getTrustAllCertificates() -
getOverrideTrustAllCertificates
public boolean getOverrideTrustAllCertificates()
-
getAuth2()instead.