Class JenkinsService

java.lang.Object
fr.paris.lutece.plugins.releaser.service.JenkinsService
All Implemented Interfaces:
IJenkinsService

public class JenkinsService extends Object implements IJenkinsService
  • Constructor Details

    • JenkinsService

      public JenkinsService()
  • Method Details

    • getService

      public static IJenkinsService getService()
      Gets the service.
      Returns:
      the service
    • init

      public void init()
      Description copied from interface: IJenkinsService
      Loads the Jenkins configuration.
      Specified by:
      init in interface IJenkinsService
    • TriggerPipeline

      public String TriggerPipeline(WorkflowReleaseContext context)
      Description copied from interface: IJenkinsService
      Triggers the configured docker image pipeline for a site and waits for its result, logging in the release console.
      Specified by:
      TriggerPipeline in interface IJenkinsService
      Parameters:
      context - the release context
      Returns:
      the build result (SUCCESS, FAILURE...), null on error
    • triggerJob

      public String triggerJob(String strJobPath, Map<String,String> mapParams) throws fr.paris.lutece.util.httpaccess.HttpAccessException
      Description copied from interface: IJenkinsService
      Triggers a parameterized job.
      Specified by:
      triggerJob in interface IJenkinsService
      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

      public JenkinsBuild waitForBuild(String strQueueUrl) throws fr.paris.lutece.util.httpaccess.HttpAccessException, IOException, InterruptedException
      Description copied from interface: IJenkinsService
      Waits until a queued item becomes a build.
      Specified by:
      waitForBuild in interface IJenkinsService
      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

      public JenkinsBuild getQueuedBuild(String strQueueUrl) throws fr.paris.lutece.util.httpaccess.HttpAccessException, IOException
      Description copied from interface: IJenkinsService
      Reads a queue item once.
      Specified by:
      getQueuedBuild in interface IJenkinsService
      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

      public String getBuildResult(String strBuildUrl) throws fr.paris.lutece.util.httpaccess.HttpAccessException, IOException
      Description copied from interface: IJenkinsService
      Returns the result of a build.
      Specified by:
      getBuildResult in interface IJenkinsService
      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

      public String readArtifact(String strBuildUrl, String strArtifactPath) throws fr.paris.lutece.util.httpaccess.HttpAccessException
      Description copied from interface: IJenkinsService
      Reads an artifact archived by a build.
      Specified by:
      readArtifact in interface IJenkinsService
      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