Class PodmanExecutorService


  • public class PodmanExecutorService
    extends Object
    Class that allows very specific execution of Podman related commands.
    • Constructor Detail

      • PodmanExecutorService

        public PodmanExecutorService​(org.apache.maven.plugin.logging.Log log,
                                     PodmanConfiguration podmanConfig,
                                     CommandExecutorDelegate delegate)
        Constructs a new instance of this class.
        Parameters:
        log - Used to access Maven's log system
        podmanConfig - Contains Podman specific configuration, such as tlsVerify and podman's root directory
        delegate - A delegate executor that executed the actual command
    • Method Detail

      • build

        public List<String> build​(SingleImageConfiguration image)
                           throws org.apache.maven.plugin.MojoExecutionException

        Implementation of the 'podman build' command.

        Takes an SingleImageConfiguration class as input and uses it to retrieve the Containerfile to build, whether caching should be used and the build's output directory

        Parameters:
        image - The SingleImageConfiguration containing the configuration of the image to build
        Returns:
        The last line of the build process, usually containing the image hash
        Throws:
        org.apache.maven.plugin.MojoExecutionException - In case the container image could not be built.
      • tag

        public void tag​(String imageHash,
                        String fullImageName)
                 throws org.apache.maven.plugin.MojoExecutionException

        Implementation of the 'podman tag' command.

        Parameters:
        imageHash - The image hash as generated by the build(SingleImageConfiguration) method
        fullImageName - The full name of the image. This will be the target name
        Throws:
        org.apache.maven.plugin.MojoExecutionException - In case the container image could not be tagged.
      • save

        public void save​(String archiveName,
                         String fullImageName)
                  throws org.apache.maven.plugin.MojoExecutionException

        Implementation of the 'podman save' command.

        Note: This is not an export. The result of the save command is a tar ball containing all layers as separate folders

        Parameters:
        archiveName - The target name of the archive, where the image will be saved into.
        fullImageName - The image to save
        Throws:
        org.apache.maven.plugin.MojoExecutionException - In case the container image could not be saved.
      • push

        public void push​(String fullImageName)
                  throws org.apache.maven.plugin.MojoExecutionException

        Implementation of the 'podman push' command.

        Parameters:
        fullImageName - The full name of the image including the registry
        Throws:
        org.apache.maven.plugin.MojoExecutionException - In case the container image could not be pushed.
      • login

        public void login​(String registry,
                          String username,
                          String password)
                   throws org.apache.maven.plugin.MojoExecutionException

        Implementation of the 'podman login' command.

        This command is used to login to a specific registry with a specific username and password

        Parameters:
        registry - The registry to logon to
        username - The username to use
        password - The password to use
        Throws:
        org.apache.maven.plugin.MojoExecutionException - In case the login fails. The Exception does not contain a recognisable password.
      • version

        public void version()
                     throws org.apache.maven.plugin.MojoExecutionException

        Implementation of the 'podman version' command

        Throws:
        org.apache.maven.plugin.MojoExecutionException - In case printing the information fails
      • removeLocalImage

        public void removeLocalImage​(String fullImageName)
                              throws org.apache.maven.plugin.MojoExecutionException

        Implementation of the 'podman rmi' command.

        Removes an image from the local registry

        Parameters:
        fullImageName - The full name of the image to remove from the local registry
        Throws:
        org.apache.maven.plugin.MojoExecutionException - In case the container image could not be removed.