diff --git a/jkube-kit/config/image/src/main/java/org/eclipse/jkube/kit/config/image/build/BuildConfiguration.java b/jkube-kit/config/image/src/main/java/org/eclipse/jkube/kit/config/image/build/BuildConfiguration.java index b91a56ba4b..d2ffca8ab8 100644 --- a/jkube-kit/config/image/src/main/java/org/eclipse/jkube/kit/config/image/build/BuildConfiguration.java +++ b/jkube-kit/config/image/src/main/java/org/eclipse/jkube/kit/config/image/build/BuildConfiguration.java @@ -56,21 +56,143 @@ public class BuildConfiguration implements Serializable { public static final String DEFAULT_FILTER = "${*}"; public static final String DEFAULT_CLEANUP = "try"; + // Generic fields applicable to all build strategies + /** + * The base image which should be used for this image. + * + *

If not given this default to busybox:latest and is suitable for a pure data image. + *

+ * This field is applicable for all build strategies. + */ + private String from; + /** + * Extended definition for a base image. This field holds a map of defined in key:value format. + *

The known keys are: + *

+ *

A provided {@link BuildConfiguration#from} takes precedence over the name given here. + * This tag is useful for extensions of this plugin. + *

+ * This field is applicable for all build strategies. + */ + private Map fromExt; + /** + * The exposed ports which is a list of <port> elements, one for each port to expose. + * Whitespace is trimmed from each element and empty elements are ignored. + * + *

The format can be either pure numerical (8080) or with the protocol attached (8080/tcp). + *

+ * This field is applicable for all build strategies. + */ + @Singular + private List ports; + + /** + * Specific pull policy for the base image. This overrides any global image pull policy. + *

+ * This field is applicable for all build strategies. + */ + private String imagePullPolicy; + + /** + * List of <volume%gt; elements to create a container volume. + * Whitespace is trimmed from each element and empty elements are ignored. + *

+ * This field is applicable for all build strategies. + */ + @Singular + private List volumes; + + /** + * List of additional tag elements with which an image is to be tagged after the build. + * Whitespace is trimmed from each element and empty elements are ignored. + *

+ * This field is applicable for all build strategies. + */ + @Singular + private List tags; + + /** + * Environment variables. + *

+ * This field is applicable for all build strategies. + */ + @Singular("putEnv") + private Map env; + + /** + * Labels. + *

+ * This field is applicable for all build strategies. + */ + @Singular + private Map labels; + + /** + * Directory to change to when starting the container. + *

+ * This field is applicable for all build strategies. + */ + private String workdir; + + /** + * A command to execute by default. + *

+ * This field is applicable for all build strategies. + */ + private Arguments cmd; + + /** + * User to which the image should switch to the end (corresponds to the USER Dockerfile directive). + *

+ * This field is applicable for all build strategies. + */ + private String user; + + /** + * An entrypoint allows you to configure a container that will run as an executable. + *

+ * This field is applicable for all build strategies. + */ + private Arguments entryPoint; + + /** + * Specifies the assembly configuration. + *

+ * This field is applicable for all build strategies. + */ + private AssemblyConfiguration assembly; + + /** + * If set to true disables building of the image. + *

+ * This field is applicable for all build strategies. + */ + private Boolean skip; + + // Docker build strategy specific configuration options /** * Path to a directory used for the build's context. You can specify the Dockerfile to use with dockerFile, which by * default is the Dockerfile found in the contextDir. - * The Dockerfile can be also located outside of the contextDir, if provided with an absolute file path. + * The Dockerfile can be also located outside the contextDir, if provided with an absolute file path. + *

+ * This field is applicable only for docker build strategy */ private String contextDir; /** * Path to a Dockerfile which also triggers Dockerfile mode. * The Docker build context directory is set to contextDir if given. * If not the directory by default is the directory in which the Dockerfile is stored. + *

+ * This field is applicable only for docker build strategy */ private String dockerFile; /** * Path to a docker archive to load an image instead of building from scratch. * If a dockerArchive is provided, no {@link BuildConfiguration#dockerFile} must be given. + *

+ * This field is applicable only for docker build strategy */ private String dockerArchive; /** @@ -78,45 +200,24 @@ public class BuildConfiguration implements Serializable { * *

By default properties in the format ${..} are replaced with Maven properties. * When using a single char like @ then this is used as a delimiter (e.g @…​@). + *

+ * This field is applicable only for docker build strategy */ private String filter; - /** - * The base image which should be used for this image. - * - *

If not given this default to busybox:latest and is suitable for a pure data image. - */ - private String from; - /** - * Extended definition for a base image. This field holds a map of defined in key:value format. - *

The known keys are: - *

- *

A provided {@link BuildConfiguration#from} takes precedence over the name given here. - * This tag is useful for extensions of this plugin. - */ - private Map fromExt; /** * The author (MAINTAINER) field for the generated image + *

+ * This field is applicable only for docker build strategy */ private String maintainer; - /** - * The exposed ports which is a list of <port> elements, one for each port to expose. - * Whitespace is trimmed from each element and empty elements are ignored. - * - *

The format can be either pure numerical (8080) or with the protocol attached (8080/tcp). - */ - @Singular - private List ports; /** * Shell to be used for the {@link BuildConfiguration#runCmds}. It contains arg elements which are defining the * executable and its params. + *

+ * This field is applicable only for docker build strategy */ private Arguments shell; - /** - * Specific pull policy for the base image. This overrides any global image pull policy. - */ - private String imagePullPolicy; + /** * Commands to be run during the build process. * @@ -128,6 +229,8 @@ public class BuildConfiguration implements Serializable { * *

This setting is not to be confused with the <run> section for this image which specifies the runtime * behaviour when starting containers. + *

+ * This field is applicable only for docker build strategy */ @Singular private List runCmds; @@ -138,79 +241,45 @@ public class BuildConfiguration implements Serializable { *

  • remove: removes old image or fails if it doesn't
  • *
  • none: No cleanup is requested
  • * + *

    + * This field is applicable only for docker build strategy */ private String cleanup; /** * Don't use Docker’s build cache. + *

    + * This field is applicable only for docker build strategy */ private Boolean nocache; /** * If set to true then it will compress all the {@link BuildConfiguration#runCmds} into a single RUN directive so that * only one image layer is created. + *

    + * This field is applicable only for docker build strategy */ private Boolean optimise; - /** - * List of <volume%gt; elements to create a container volume. - * Whitespace is trimmed from each element and empty elements are ignored. - */ - @Singular - private List volumes; - /** - * List of additional tag elements with which an image is to be tagged after the build. - * Whitespace is trimmed from each element and empty elements are ignored. - */ - @Singular - private List tags; - /** - * Environment variables. - */ - @Singular("putEnv") - private Map env; - /** - * Labels. - */ - @Singular - private Map labels; /** * Map specifying the value of Docker build args which should be used when building the image with an external * Dockerfile which uses build arguments. * *

    The key-value syntax is the same as when defining Maven properties (or labels or env). This argument is * ignored when no external Dockerfile is used. + *

    + * This field is applicable only for docker build strategy */ @Singular private Map args; - /** - * An entrypoint allows you to configure a container that will run as an executable. - */ - private Arguments entryPoint; - /** - * Directory to change to when starting the container. - */ - private String workdir; - /** - * A command to execute by default. - */ - private Arguments cmd; - /** - * User to which the Dockerfile should switch to the end (corresponds to the USER Dockerfile directive). - */ - private String user; /** * Health check configuration. + *

    + * This field is applicable only for docker build strategy */ private HealthCheckConfiguration healthCheck; - /** - * Specifies the assembly configuration. - */ - private AssemblyConfiguration assembly; - /** - * If set to true disables building of the image. - */ - private Boolean skip; /** * The compression mode how the build archive is transmitted to the docker daemon and how docker build archives are * attached to this build as sources. + *

    + * This field is applicable only for docker build strategy */ private ArchiveCompression compression; /** @@ -220,6 +289,8 @@ public class BuildConfiguration implements Serializable { * simple options (e.g.: memory, shmsize). * * @see Docker Engine API v1.40 + *

    + * This field is applicable only for docker build strategy */ private Map buildOptions; /** @@ -229,16 +300,31 @@ public class BuildConfiguration implements Serializable { * simple options (e.g.: fromImage, fromSrc, platform). * * @see Docker Engine API v1.41 + *

    + * This field is applicable only for docker build strategy */ private Map createImageOptions; /** * Path to Dockerfile to use, initialized lazily. + *

    + * This field is applicable only for docker build strategy */ @Setter(AccessLevel.PRIVATE) private File dockerFileFile; + /** + * Path to archive file passed to docker daemon. + * + *

    + * This field is applicable only for docker build strategy + */ @Setter(AccessLevel.PRIVATE) private File dockerArchiveFile; + /** + * Array of images used for build cache resolution. + *

    + * This field is applicable only for docker build strategy + */ @Singular("addCacheFrom") private List cacheFrom;