/** * Adds an additional tag to tag the target image with. For example, the following would * containerize to both {@code gcr.io/my-project/my-image:tag} and {@code * gcr.io/my-project/my-image:tag2}: * * <pre>{@code * Containerizer.to(RegistryImage.named("gcr.io/my-project/my-image:tag")).withAdditionalTag("tag2"); * }</pre> * * @param tag the additional tag to push to * @return this */ public Containerizer withAdditionalTag(String tag) { Preconditions.checkArgument(ImageReference.isValidTag(tag)); additionalTags.add(tag); return this; }
/** * Constructs an {@link ImageReference} from the image reference components, consisting of an * optional registry, a repository, and an optional tag. * * @param registry the image registry, or {@code null} to use the default registry (Docker Hub) * @param repository the image repository * @param tag the image tag, or {@code null} to use the default tag ({@code latest}) * @return an {@link ImageReference} built from the given registry, repository, and tag */ public static ImageReference of( @Nullable String registry, String repository, @Nullable String tag) { Preconditions.checkArgument(Strings.isNullOrEmpty(registry) || isValidRegistry(registry)); Preconditions.checkArgument(isValidRepository(repository)); Preconditions.checkArgument(Strings.isNullOrEmpty(tag) || isValidTag(tag)); if (Strings.isNullOrEmpty(registry)) { registry = DOCKER_HUB_REGISTRY; } if (Strings.isNullOrEmpty(tag)) { tag = DEFAULT_TAG; } return new ImageReference(registry, repository, tag); }
/** * Adds an additional tag to tag the target image with. For example, the following would * containerize to both {@code gcr.io/my-project/my-image:tag} and {@code * gcr.io/my-project/my-image:tag2}: * * <pre>{@code * Containerizer.to(RegistryImage.named("gcr.io/my-project/my-image:tag")).withAdditionalTag("tag2"); * }</pre> * * @param tag the additional tag to push to * @return this */ public Containerizer withAdditionalTag(String tag) { Preconditions.checkArgument(ImageReference.isValidTag(tag)); additionalTags.add(tag); return this; }
/** * Adds an additional tag to tag the target image with. For example, the following would * containerize to both {@code gcr.io/my-project/my-image:tag} and {@code * gcr.io/my-project/my-image:tag2}: * * <pre>{@code * Containerizer.to(RegistryImage.named("gcr.io/my-project/my-image:tag")).withAdditionalTag("tag2"); * }</pre> * * @param tag the additional tag to push to * @return this */ public Containerizer withAdditionalTag(String tag) { Preconditions.checkArgument(ImageReference.isValidTag(tag)); additionalTags.add(tag); return this; }
/** * Constructs an {@link ImageReference} from the image reference components, consisting of an * optional registry, a repository, and an optional tag. * * @param registry the image registry, or {@code null} to use the default registry (Docker Hub) * @param repository the image repository * @param tag the image tag, or {@code null} to use the default tag ({@code latest}) * @return an {@link ImageReference} built from the given registry, repository, and tag */ public static ImageReference of( @Nullable String registry, String repository, @Nullable String tag) { Preconditions.checkArgument(Strings.isNullOrEmpty(registry) || isValidRegistry(registry)); Preconditions.checkArgument(isValidRepository(repository)); Preconditions.checkArgument(Strings.isNullOrEmpty(tag) || isValidTag(tag)); if (Strings.isNullOrEmpty(registry)) { registry = DOCKER_HUB_REGISTRY; } if (Strings.isNullOrEmpty(tag)) { tag = DEFAULT_TAG; } return new ImageReference(registry, repository, tag); }
/** * Constructs an {@link ImageReference} from the image reference components, consisting of an * optional registry, a repository, and an optional tag. * * @param registry the image registry, or {@code null} to use the default registry (Docker Hub) * @param repository the image repository * @param tag the image tag, or {@code null} to use the default tag ({@code latest}) * @return an {@link ImageReference} built from the given registry, repository, and tag */ public static ImageReference of( @Nullable String registry, String repository, @Nullable String tag) { Preconditions.checkArgument(Strings.isNullOrEmpty(registry) || isValidRegistry(registry)); Preconditions.checkArgument(isValidRepository(repository)); Preconditions.checkArgument(Strings.isNullOrEmpty(tag) || isValidTag(tag)); if (Strings.isNullOrEmpty(registry)) { registry = DOCKER_HUB_REGISTRY; } if (Strings.isNullOrEmpty(tag)) { tag = DEFAULT_TAG; } return new ImageReference(registry, repository, tag); }