Class AbstractImageConfiguration<T extends AbstractImageBuildConfiguration>

    • Field Detail

      • name

        @Parameter
        protected String name
        The name of the image without the target registry. May contain the repository. Must be all lowercase and no special characters. Must be required when customImageNameForMultiStageContainerfile is set to false or not specified.
      • customImageNameForMultiStageContainerfile

        @Parameter(defaultValue="false")
        protected boolean customImageNameForMultiStageContainerfile
        When set to true
      • stages

        @Parameter
        protected StageConfiguration[] stages
        Allows specifying a custom image name per stage in case of a multistage Containerfile. When customImageNameForMultiStageContainerfile is set to true this must be specified.
    • Constructor Detail

      • AbstractImageConfiguration

        public AbstractImageConfiguration()
    • Method Detail

      • getBuild

        public abstract T getBuild()

        Returns the build configuration

        Returns:
        the configuration used for building the image
      • getFinalImageHash

        public final Optional<String> getFinalImageHash()

        Returns an Optional that may or may not hold the image hash

        Returns:
        An Optional that may hold the image hash
      • getImageHashPerStage

        public final Map<String,​String> getImageHashPerStage()
        Returns a Map containing all image hashes per stage as listed in the Containerfile
        Returns:
        Returns a Map of the final image hash for each stage.
      • setFinalImageHash

        public final void setFinalImageHash​(String finalImageHash)

        Sets the image hash to a specific value

        Parameters:
        finalImageHash - The image hash to set. This should be a SHA256 hash.
      • useCustomImageNameForMultiStageContainerfile

        public boolean useCustomImageNameForMultiStageContainerfile()
        Returns whether a custom image name per stage should be used (when using a multistage Containerfile).
        Returns:
        true when certain stages in a multistage Containerfile should have unique names.
      • getStages

        public StageConfiguration[] getStages()
        Returns the stage configuration for naming images
        Returns:
        the configuration for naming images when using a multistage Containerfile.
      • getImageNames

        public List<String> getImageNames()

        Returns a list of image names formatted as the image name [colon] tag.

        Note that registry information is not prepended to this image name

        Returns:
        A list of image names
      • getImageNamesByStage

        public List<String> getImageNamesByStage​(String stageName)
        Returns a list of image names (without the registry) for a specific stage name. The list that is returned is based on the tags that are configured.
        Parameters:
        stageName - The name of the stage to retrieve the image name for
        Returns:
        A list of image names for the specific stage.
      • initAndValidate

        public void initAndValidate​(org.apache.maven.plugin.logging.Log log)
                             throws org.apache.maven.plugin.MojoExecutionException
        Initialises and validates this configuration
        Parameters:
        log - The log class for logging
        Throws:
        org.apache.maven.plugin.MojoExecutionException - In case validation fails.
      • getImageName

        public String getImageName()

        Returns the name of the image without the tag and registry

        Returns:
        The name of the image
      • isValid

        public boolean isValid()
        Returns a boolean indicating whether this configuration is valid
        Returns:
        true if this configuration is valid. False otherwise.
      • setImageName

        public void setImageName​(String name)
        Sets the name of this image.
        Parameters:
        name - The name of this image
      • setCustomImageNameForMultiStageContainerfile

        public void setCustomImageNameForMultiStageContainerfile​(boolean customImageNameForMultiStageContainerfile)
        Sets whether a custom image name should be used for each stage in the Containerfile.
        Parameters:
        customImageNameForMultiStageContainerfile - true if a custom name should be used for each stage in the Containerfile.