Class PodmanExecutorService
- java.lang.Object
-
- nl.lexemmens.podman.service.PodmanExecutorService
-
public class PodmanExecutorService extends Object
Class that allows very specific execution of Podman related commands.
-
-
Constructor Summary
Constructors Constructor Description PodmanExecutorService(org.apache.maven.plugin.logging.Log log, PodmanConfiguration podmanConfig, CommandExecutorDelegate delegate)Constructs a new instance of this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>build(SingleImageConfiguration image)Implementation of the 'podman build' command.voidlogin(String registry, String username, String password)Implementation of the 'podman login' command.voidpush(String fullImageName)Implementation of the 'podman push' command.voidremoveLocalImage(String fullImageName)Implementation of the 'podman rmi' command.voidsave(String archiveName, String fullImageName)Implementation of the 'podman save' command.voidtag(String imageHash, String fullImageName)Implementation of the 'podman tag' command.voidversion()Implementation of the 'podman version' command
-
-
-
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 systempodmanConfig- Contains Podman specific configuration, such as tlsVerify and podman's root directorydelegate- 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
SingleImageConfigurationclass as input and uses it to retrieve the Containerfile to build, whether caching should be used and the build's output directory- Parameters:
image- TheSingleImageConfigurationcontaining 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 thebuild(SingleImageConfiguration)methodfullImageName- 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 tousername- The username to usepassword- 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.MojoExecutionExceptionImplementation 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.
-
-