Class PlatformPrecheckService

java.lang.Object
fr.paris.lutece.plugins.releaser.service.platform.PlatformPrecheckService

public final class PlatformPrecheckService extends Object
Verification of a campaign before it starts (step 0) : census of every SNAPSHOT the five steps will release, instant checks of the releaser on each of them, then the plan the step pipeline verifies on the head of their branch, nothing being set nor pushed. The step 0 is stored as a step row numbered 0, left out of the steps of the campaign.
  • Field Details

    • STEP_NUMBER

      public static final int STEP_NUMBER
      Number of the step row holding the verification of the campaign.
      See Also:
  • Method Details

    • getPrecheckStep

      public static PlatformReleaseStep getPrecheckStep(PlatformRelease campaign)
      Returns the step 0 of a campaign, created when missing (campaigns created before the step 0).
      Parameters:
      campaign - the campaign
      Returns:
      the step 0
    • runCensus

      public static PlatformStepResult runCensus(PlatformRelease campaign, ReleaserUser user, Locale locale) throws IOException
      Takes the census of the SNAPSHOT of the campaign : loads the aggregate of every step, runs the instant checks, then stores the result and the plan of the step pipeline in the step 0. A step that cannot be loaded is reported and skipped.
      Parameters:
      campaign - the campaign, loaded with its steps
      user - the releaser user (credentials)
      locale - the locale of the messages
      Returns:
      the result stored in the step 0
      Throws:
      IOException - if the result or the plan cannot be serialized
    • canLaunch

      public static boolean canLaunch(PlatformRelease campaign)
      Whether the step 0 of a campaign can be launched : it is not running.
      Parameters:
      campaign - the campaign, loaded with its steps
      Returns:
      true when it can be launched
    • isCensusRunning

      public static boolean isCensusRunning(int nIdPlatformRelease)
      Whether the census of the step 0 of a campaign is being taken : the step 0 is still READY, but its rows and the local clones are in use.
      Parameters:
      nIdPlatformRelease - the campaign id
      Returns:
      true during the census
    • isCensusThread

      public static boolean isCensusThread()
      Whether the current thread is taking a census : it loads the aggregates itself and must not be refused by the census guard.
      Returns:
      true in the census thread
    • launch

      public static boolean launch(PlatformRelease campaign, ReleaserUser user, Locale locale) throws IOException
      Launches the step 0 : takes the census, then sends the resources not already to fix to the step pipeline.
      Parameters:
      campaign - the campaign, loaded with its steps
      user - the releaser user
      locale - the locale of the messages
      Returns:
      true when the pipeline was launched, false when the census left nothing to send
      Throws:
      IOException - if the result or the plan cannot be serialized
    • getPlanResources

      public static Map<String,PlatformPlanResource> getPlanResources(PlatformReleaseStep step)
      Returns the resources of the plan of the step 0, by "groupId:artifactId" : their branch is shown with the result.
      Parameters:
      step - the step 0, may be null
      Returns:
      the resources, empty when none