java.lang.Object
org.springframework.boot.buildpack.platform.build.BuildRequest

public class BuildRequest extends Object
A build request to be handled by the Builder.
Since:
2.3.0
Author:
Phillip Webb, Scott Frederick, Andrey Shlykov, Jeroen Meijer, Rafael Ceccone, Julian Liebig
  • Method Details

    • withBuilder

      public BuildRequest withBuilder(ImageReference builder)
      Return a new BuildRequest with an updated builder.
      Parameters:
      builder - the new builder to use
      Returns:
      an updated build request
    • withTrustBuilder

      public BuildRequest withTrustBuilder(boolean trustBuilder)
      Return a new BuildRequest with an updated trust builder setting.
      Parameters:
      trustBuilder - true if the builder should be treated as trusted, false otherwise
      Returns:
      an updated build request
      Since:
      3.4.0
    • withRunImage

      public BuildRequest withRunImage(ImageReference runImageName)
      Return a new BuildRequest with an updated run image.
      Parameters:
      runImageName - the run image to use
      Returns:
      an updated build request
    • withCreator

      public BuildRequest withCreator(Creator creator)
      Return a new BuildRequest with an updated creator.
      Parameters:
      creator - the new Creator to use
      Returns:
      an updated build request
    • withEnv

      public BuildRequest withEnv(String name, String value)
      Return a new BuildRequest with an additional env variable.
      Parameters:
      name - the variable name
      value - the variable value
      Returns:
      an updated build request
    • withEnv

      public BuildRequest withEnv(Map<String,String> env)
      Return a new BuildRequest with additional env variables.
      Parameters:
      env - the additional variables
      Returns:
      an updated build request
    • withCleanCache

      public BuildRequest withCleanCache(boolean cleanCache)
      Return a new BuildRequest with an updated clean cache setting.
      Parameters:
      cleanCache - if the cache should be cleaned
      Returns:
      an updated build request
    • withVerboseLogging

      public BuildRequest withVerboseLogging(boolean verboseLogging)
      Return a new BuildRequest with an updated verbose logging setting.
      Parameters:
      verboseLogging - if verbose logging should be used
      Returns:
      an updated build request
    • withPullPolicy

      public BuildRequest withPullPolicy(PullPolicy pullPolicy)
      Return a new BuildRequest with the updated image pull policy.
      Parameters:
      pullPolicy - image pull policy PullPolicy
      Returns:
      an updated build request
    • withPublish

      public BuildRequest withPublish(boolean publish)
      Return a new BuildRequest with an updated publish setting.
      Parameters:
      publish - if the built image should be pushed to a registry
      Returns:
      an updated build request
    • withBuildpacks

      public BuildRequest withBuildpacks(BuildpackReference... buildpacks)
      Return a new BuildRequest with an updated buildpacks setting.
      Parameters:
      buildpacks - a collection of buildpacks to use when building the image
      Returns:
      an updated build request
      Since:
      2.5.0
    • withBuildpacks

      public BuildRequest withBuildpacks(List<BuildpackReference> buildpacks)
      Return a new BuildRequest with an updated buildpacks setting.
      Parameters:
      buildpacks - a collection of buildpacks to use when building the image
      Returns:
      an updated build request
      Since:
      2.5.0
    • withBindings

      public BuildRequest withBindings(Binding... bindings)
      Return a new BuildRequest with updated bindings.
      Parameters:
      bindings - a collection of bindings to mount to the build container
      Returns:
      an updated build request
      Since:
      2.5.0
    • withBindings

      public BuildRequest withBindings(List<Binding> bindings)
      Return a new BuildRequest with updated bindings.
      Parameters:
      bindings - a collection of bindings to mount to the build container
      Returns:
      an updated build request
      Since:
      2.5.0
    • withNetwork

      public BuildRequest withNetwork(String network)
      Return a new BuildRequest with an updated network setting.
      Parameters:
      network - the network the build container will connect to
      Returns:
      an updated build request
      Since:
      2.6.0
    • withTags

      public BuildRequest withTags(ImageReference... tags)
      Return a new BuildRequest with updated tags.
      Parameters:
      tags - a collection of tags to be created for the built image
      Returns:
      an updated build request
    • withTags

      public BuildRequest withTags(List<ImageReference> tags)
      Return a new BuildRequest with updated tags.
      Parameters:
      tags - a collection of tags to be created for the built image
      Returns:
      an updated build request
    • withBuildWorkspace

      public BuildRequest withBuildWorkspace(Cache buildWorkspace)
      Return a new BuildRequest with an updated build workspace.
      Parameters:
      buildWorkspace - the build workspace
      Returns:
      an updated build request
      Since:
      3.2.0
    • withBuildCache

      public BuildRequest withBuildCache(Cache buildCache)
      Return a new BuildRequest with an updated build cache.
      Parameters:
      buildCache - the build cache
      Returns:
      an updated build request
    • withLaunchCache

      public BuildRequest withLaunchCache(Cache launchCache)
      Return a new BuildRequest with an updated launch cache.
      Parameters:
      launchCache - the cache
      Returns:
      an updated build request
    • withCreatedDate

      public BuildRequest withCreatedDate(String createdDate)
      Return a new BuildRequest with an updated created date.
      Parameters:
      createdDate - the created date
      Returns:
      an updated build request
    • withApplicationDirectory

      public BuildRequest withApplicationDirectory(String applicationDirectory)
      Return a new BuildRequest with an updated application directory.
      Parameters:
      applicationDirectory - the application directory
      Returns:
      an updated build request
    • withSecurityOptions

      public BuildRequest withSecurityOptions(List<String> securityOptions)
      Return a new BuildRequest with an updated security options.
      Parameters:
      securityOptions - the security options
      Returns:
      an updated build request
      Since:
      3.2.0
    • withImagePlatform

      public BuildRequest withImagePlatform(String platform)
      Return a new BuildRequest with an updated image platform.
      Parameters:
      platform - the image platform
      Returns:
      an updated build request
      Since:
      3.4.0
    • getName

      public ImageReference getName()
      Return the name of the image that should be created.
      Returns:
      the name of the image
    • getApplicationContent

      public TarArchive getApplicationContent(Owner owner)
      Return a TarArchive containing the application content that the buildpack should package. This is typically the contents of the Jar.
      Parameters:
      owner - the owner of the tar entries
      Returns:
      the application content
      See Also:
    • getBuilder

      public ImageReference getBuilder()
      Return the builder that should be used.
      Returns:
      the builder to use
    • isTrustBuilder

      public boolean isTrustBuilder()
      Return whether the builder should be treated as trusted.
      Returns:
      the trust builder flag
      Since:
      3.4.0
    • getRunImage

      public ImageReference getRunImage()
      Return the run image that should be used, if provided.
      Returns:
      the run image
    • getCreator

      public Creator getCreator()
      Return the Creator the builder should use.
      Returns:
      the Creator
    • getEnv

      public Map<String,String> getEnv()
      Return any env variable that should be passed to the builder.
      Returns:
      the builder env
    • isCleanCache

      public boolean isCleanCache()
      Return if caches should be cleaned before packaging.
      Returns:
      if caches should be cleaned
    • isVerboseLogging

      public boolean isVerboseLogging()
      Return if verbose logging output should be used.
      Returns:
      if verbose logging should be used
    • isPublish

      public boolean isPublish()
      Return if the built image should be pushed to a registry.
      Returns:
      if the built image should be pushed to a registry
    • getPullPolicy

      public PullPolicy getPullPolicy()
      Return the image PullPolicy that the builder should use.
      Returns:
      image pull policy
    • getBuildpacks

      public List<BuildpackReference> getBuildpacks()
      Return the collection of buildpacks to use when building the image, if provided.
      Returns:
      the buildpacks
    • getBindings

      public List<Binding> getBindings()
      Return the collection of bindings to mount to the build container.
      Returns:
      the bindings
      Since:
      2.5.0
    • getNetwork

      public String getNetwork()
      Return the network the build container will connect to.
      Returns:
      the network
      Since:
      2.6.0
    • getTags

      public List<ImageReference> getTags()
      Return the collection of tags that should be created.
      Returns:
      the tags
    • getBuildWorkspace

      public Cache getBuildWorkspace()
      Return the build workspace that should be used by the lifecycle.
      Returns:
      the build workspace or null
      Since:
      3.2.0
    • getBuildCache

      public Cache getBuildCache()
      Return the custom build cache that should be used by the lifecycle.
      Returns:
      the build cache
    • getLaunchCache

      public Cache getLaunchCache()
      Return the custom launch cache that should be used by the lifecycle.
      Returns:
      the launch cache
    • getCreatedDate

      public Instant getCreatedDate()
      Return the custom created date that should be used by the lifecycle.
      Returns:
      the created date
    • getApplicationDirectory

      public String getApplicationDirectory()
      Return the application directory that should be used by the lifecycle.
      Returns:
      the application directory
    • getSecurityOptions

      public List<String> getSecurityOptions()
      Return the security options that should be used by the lifecycle.
      Returns:
      the security options or null
      Since:
      3.2.0
    • getImagePlatform

      public ImagePlatform getImagePlatform()
      Return the platform that should be used when pulling images.
      Returns:
      the platform or null
      Since:
      3.4.0
    • forJarFile

      public static BuildRequest forJarFile(File jarFile)
      Factory method to create a new BuildRequest from a JAR file.
      Parameters:
      jarFile - the source jar file
      Returns:
      a new build request instance
    • forJarFile

      public static BuildRequest forJarFile(ImageReference name, File jarFile)
      Factory method to create a new BuildRequest from a JAR file.
      Parameters:
      name - the name of the image that should be created
      jarFile - the source jar file
      Returns:
      a new build request instance
    • of

      public static BuildRequest of(ImageReference name, Function<Owner,TarArchive> applicationContent)
      Factory method to create a new BuildRequest with specific content.
      Parameters:
      name - the name of the image that should be created
      applicationContent - function to provide the application content
      Returns:
      a new build request instance