Refactor the VmwHarborProxyImageNameSubstitutor class to detect the Jenkins CI environment.

This commit is contained in:
John Blum
2023-05-12 19:24:40 -07:00
parent 9d266b4acb
commit 7d5f55ef87

View File

@@ -53,12 +53,19 @@ public class VmwHarborProxyImageNameSubstitutor extends ImageNameSubstitutor {
originalDockerImageName = originalDockerImageName.substring(TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX.length() - 1);
resolvedDockerImageName = String.format(TESTCONTAINERS_HUB_IMAGE_NAME_TEMPLATE, originalDockerImageName);
}
else if (isJenkinsEnvironment()) {
resolvedDockerImageName = String.format(TESTCONTAINERS_HUB_IMAGE_NAME_TEMPLATE, originalDockerImageName);
}
logInfo("Resolved Docker Image Name [{}]", resolvedDockerImageName);
return DockerImageName.parse(resolvedDockerImageName);
}
private boolean isJenkinsEnvironment() {
return Boolean.TRUE.equals(Boolean.getBoolean("jenkins"));
}
@Override
protected String getDescription() {
return "VMware Harbor Proxy Image Name Substitutor";