Class ImageReference

java.lang.Object
io.jenkins.plugins.kubernetes.ephemeral.ImageReference

public class ImageReference extends Object
Container image reference. Image references parsed by this class are always normalized:
  • If no domain component, "docker.io" will be added
  • If domain is "docker.io" and no repo component "library/" will be added
  • If no tag or digest component, "latest" tag will be added
     maven           -> docker.io/library/maven:latest
     docker.io/maven -> docker.io/library/maven:latest
 
  • Method Details

    • parse

      public static Optional<ImageReference> parse(@NonNull String reference)
      Parse an image reference string. The parse reference will be normalized, meaning if no registry/domain component is specified, it will be assumed to be "docker.io".

      This parse image references that are not technically valid. The may purpose is to break it into component pieces so rules can be applied against them. We are not concerned about strict limits as that will ultimately be the responsibility of the cluster.

      Parameters:
      reference - reference string, not null
      Returns:
      image reference or empty if invalid refence format
    • getDomain

      @NonNull public String getDomain()
      Image registry domain.
      Returns:
      registry domain, not null
    • getPath

      @NonNull public String getPath()
      Image path component. Does not include the domain component.
      Returns:
      path, not null
    • getName

      @NonNull public String getName()
      Image name (domain and path). Does not include tag or digest.
      Returns:
      name, not null
    • getTag

      @Nullable public String getTag()
      Image tag name.
      Returns:
      tag name or null
    • getDigest

      @Nullable public String getDigest()
      Image digest.
      Returns:
      image digest or null
    • getReference

      @NonNull public String getReference()
      Get full image reference string (domain + path + tag/digest).
      Returns:
      full image reference string
    • toString

      public String toString()
      Overrides:
      toString in class Object