Interface IJenkinsService
- All Known Implementing Classes:
JenkinsService
public interface IJenkinsService
Jenkins integration : triggers jobs, follows their builds and reads their artifacts.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA queue item cancelled before it started : no build will run. -
Method Summary
Modifier and TypeMethodDescriptiongetBuildResult(String strBuildUrl) Returns the result of a build.getQueuedBuild(String strQueueUrl) Reads a queue item once.voidinit()Loads the Jenkins configuration.readArtifact(String strBuildUrl, String strArtifactPath) Reads an artifact archived by a build.triggerJob(String strJobPath, Map<String, String> mapParams) Triggers a parameterized job.TriggerPipeline(WorkflowReleaseContext context) Triggers the configured docker image pipeline for a site and waits for its result, logging in the release console.waitForBuild(String strQueueUrl) Waits until a queued item becomes a build.
-
Method Details
-
init
void init()Loads the Jenkins configuration. -
TriggerPipeline
Triggers the configured docker image pipeline for a site and waits for its result, logging in the release console.- Parameters:
context- the release context- Returns:
- the build result (SUCCESS, FAILURE...), null on error
-
triggerJob
String triggerJob(String strJobPath, Map<String, String> mapParams) throws fr.paris.lutece.util.httpaccess.HttpAccessExceptionTriggers a parameterized job.- Parameters:
strJobPath- the job path relative to the Jenkins base URL (ex :job/lutece-release-platform-step)mapParams- the build parameters- Returns:
- the URL of the queue item
- Throws:
fr.paris.lutece.util.httpaccess.HttpAccessException- if Jenkins cannot be reached or refuses the request
-
waitForBuild
JenkinsBuild waitForBuild(String strQueueUrl) throws fr.paris.lutece.util.httpaccess.HttpAccessException, IOException, InterruptedException Waits until a queued item becomes a build.- Parameters:
strQueueUrl- the URL of the queue item- Returns:
- the build
- Throws:
fr.paris.lutece.util.httpaccess.HttpAccessException- if Jenkins cannot be reachedIOException- if the Jenkins answer cannot be readInterruptedException- if the wait is interrupted
-
getQueuedBuild
JenkinsBuild getQueuedBuild(String strQueueUrl) throws fr.paris.lutece.util.httpaccess.HttpAccessException, IOException Reads a queue item once.- Parameters:
strQueueUrl- the URL of the queue item- Returns:
- the build once Jenkins has started it, null while the item is still queued
- Throws:
fr.paris.lutece.util.httpaccess.HttpAccessException- if Jenkins cannot be reachedIJenkinsService.QueueItemCancelledException- if the item was cancelled before it started : no build will ever runIOException- if the Jenkins answer cannot be read
-
getBuildResult
String getBuildResult(String strBuildUrl) throws fr.paris.lutece.util.httpaccess.HttpAccessException, IOException Returns the result of a build.- Parameters:
strBuildUrl- the build URL- Returns:
- the result (SUCCESS, FAILURE, UNSTABLE, ABORTED), null while the build is running
- Throws:
fr.paris.lutece.util.httpaccess.HttpAccessException- if Jenkins cannot be reachedIOException- if the Jenkins answer cannot be read
-
readArtifact
String readArtifact(String strBuildUrl, String strArtifactPath) throws fr.paris.lutece.util.httpaccess.HttpAccessException Reads an artifact archived by a build.- Parameters:
strBuildUrl- the build URLstrArtifactPath- the artifact path relative to the workspace (ex :step-report.json)- Returns:
- the artifact content
- Throws:
fr.paris.lutece.util.httpaccess.HttpAccessException- if Jenkins cannot be reached or the artifact does not exist
-