Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent accidental image pulls in getDockerArchitectureInfo #17943

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
public class ConditionalPullPolicy
implements ImagePullPolicy
{
private static final boolean TESTCONTAINERS_NEVER_PULL = "true".equalsIgnoreCase(getenv("TESTCONTAINERS_NEVER_PULL"));
public static final boolean TESTCONTAINERS_NEVER_PULL = "true".equalsIgnoreCase(getenv("TESTCONTAINERS_NEVER_PULL"));
private static final ImagePullPolicy defaultPolicy = PullPolicy.defaultPolicy();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.base.Strings.padEnd;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static io.trino.testing.containers.ConditionalPullPolicy.TESTCONTAINERS_NEVER_PULL;
import static java.lang.Boolean.parseBoolean;
import static java.lang.System.getenv;
import static java.util.Locale.ENGLISH;
Expand Down Expand Up @@ -85,6 +86,7 @@ public static void exposeFixedPorts(GenericContainer<?> container)

public static DockerArchitectureInfo getDockerArchitectureInfo(DockerImageName imageName)
{
checkState(!TESTCONTAINERS_NEVER_PULL, "Cannot get arch for image %s without pulling it, and pulling is forbidden", imageName);
DockerClient client = DockerClientFactory.lazyClient();
if (!imageExists(client, imageName)) {
pullImage(client, imageName);
Expand Down