Skip to content

Commit

Permalink
Prevent accidental image pulls in getDockerArchitectureInfo
Browse files Browse the repository at this point in the history
Prevents unwanted image pulls like one fixed by
f0b8a4b.
  • Loading branch information
findepi committed Jun 19, 2023
1 parent b135906 commit eaf893a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
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

0 comments on commit eaf893a

Please sign in to comment.