Interface IJenkinsService

All Known Implementing Classes:
JenkinsService

public interface IJenkinsService
Jenkins integration : triggers jobs, follows their builds and reads their artifacts.
  • Method Details

    • init

      void init()
      Loads the Jenkins configuration.
    • TriggerPipeline

      String TriggerPipeline(WorkflowReleaseContext context)
      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.HttpAccessException
      Triggers 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 reached
      IOException - if the Jenkins answer cannot be read
      InterruptedException - 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 reached
      IJenkinsService.QueueItemCancelledException - if the item was cancelled before it started : no build will ever run
      IOException - 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 reached
      IOException - 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 URL
      strArtifactPath - 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