Class BuildContext

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class BuildContext
    extends java.lang.Object
    implements java.io.Closeable
    Build context for the builder process. Includes static build configuration options as well as various services for execution (such as event dispatching, thread execution service, and HTTP client). Informational instances (particularly configuration options such as ContainerConfiguration, ImageConfiguration, and FileEntriesLayer) held in are immutable.
    • Method Detail

      • getEnablePlatformTags

        public boolean getEnablePlatformTags()
      • getAllTargetImageTags

        public com.google.common.collect.ImmutableSet<java.lang.String> getAllTargetImageTags()
        Returns all image tags configured for this build.
        Returns:
        the set of image tags configured for this build
      • getToolName

        public java.lang.String getToolName()
      • getToolVersion

        @Nullable
        public java.lang.String getToolVersion()
      • getExecutorService

        public java.util.concurrent.ExecutorService getExecutorService()
      • getBaseImageLayersCache

        public Cache getBaseImageLayersCache()
        Gets the Cache for base image layers.
        Returns:
        the Cache for base image layers
      • getApplicationLayersCache

        public Cache getApplicationLayersCache()
        Gets the Cache for application layers.
        Returns:
        the Cache for application layers
      • isOffline

        public boolean isOffline()
        Gets whether or not to run the build in offline mode.
        Returns:
        true if the build will run in offline mode; false otherwise
      • getAlwaysCacheBaseImage

        public boolean getAlwaysCacheBaseImage()
        Gets whether or not to force caching the base images.
        Returns:
        true if the user wants to force the build to always pull the image layers.
      • getLayerConfigurations

        public com.google.common.collect.ImmutableList<com.google.cloud.tools.jib.api.buildplan.FileEntriesLayer> getLayerConfigurations()
        Gets the configurations for building the layers.
        Returns:
        the list of layer configurations
      • getRegistryMirrors

        public com.google.common.collect.ImmutableListMultimap<java.lang.String,​java.lang.String> getRegistryMirrors()
        Gets the registry mirrors.
        Returns:
        the registry mirrors
      • newBaseImageRegistryClientFactory

        public RegistryClient.Factory newBaseImageRegistryClientFactory​(java.lang.String serverUrl)
        Creates a new RegistryClient.Factory for the base image repository on the registry serverUrl. Compared to @link #newBaseImageRegistryClientFactory()), this method is useful to try a mirror.
        Parameters:
        serverUrl - the server URL for the registry (for example, gcr.io)
        Returns:
        a new RegistryClient.Factory
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException