diff --git a/ci/accept-third-party-license.sh b/ci/accept-third-party-license.sh index b584deb847b..c40adfb5e65 100755 --- a/ci/accept-third-party-license.sh +++ b/ci/accept-third-party-license.sh @@ -3,11 +3,13 @@ { echo "mcr.microsoft.com/mssql/server:2019-CU16-ubuntu-20.04" echo "ibmcom/db2:11.5.7.0a" + echo "harbor-repo.vmware.com/mcr-proxy-cache/mssql/server:2019-CU16-ubuntu-20.04" echo "harbor-repo.vmware.com/dockerhub-proxy-cache/ibmcom/db2:11.5.7.0a" } > spring-data-jdbc/src/test/resources/container-license-acceptance.txt { echo "mcr.microsoft.com/mssql/server:2022-latest" echo "ibmcom/db2:11.5.7.0a" + echo "harbor-repo.vmware.com/mcr-proxy-cache/mssql/server:2022-latest" echo "harbor-repo.vmware.com/dockerhub-proxy-cache/ibmcom/db2:11.5.7.0a" } > spring-data-r2dbc/src/test/resources/container-license-acceptance.txt diff --git a/spring-data-relational/src/test/java/org/springframework/data/ProxyImageNameSubstitutor.java b/spring-data-relational/src/test/java/org/springframework/data/ProxyImageNameSubstitutor.java index 9cf92153b1c..87a0cf673fa 100644 --- a/spring-data-relational/src/test/java/org/springframework/data/ProxyImageNameSubstitutor.java +++ b/spring-data-relational/src/test/java/org/springframework/data/ProxyImageNameSubstitutor.java @@ -33,14 +33,18 @@ public class ProxyImageNameSubstitutor extends ImageNameSubstitutor { private static final Logger LOG = LoggerFactory.getLogger(ProxyImageNameSubstitutor.class); private static final List NAMES_TO_PROXY_PREFIX = List.of("ryuk", "arm64v8/mariadb", "ibmcom/db2", - "gvenzl/oracle-xe"); + "gvenzl/oracle-free", "gvenzl/oracle-xe"); private static final List NAMES_TO_LIBRARY_PROXY_PREFIX = List.of("mariadb", "mysql", "postgres"); + private static final List NAMES_TO_MCR_PROXY_PREFIX = List.of("mcr.microsoft.com/mssql"); + private static final String PROXY_PREFIX = "harbor-repo.vmware.com/dockerhub-proxy-cache/"; private static final String LIBRARY_PROXY_PREFIX = PROXY_PREFIX + "library/"; + private static final String MCR_PROXY_PREFIX = "harbor-repo.vmware.com/mcr-proxy-cache/"; + @Override public DockerImageName apply(DockerImageName dockerImageName) { @@ -58,6 +62,13 @@ public DockerImageName apply(DockerImageName dockerImageName) { return DockerImageName.parse(transformedName); } + if (NAMES_TO_MCR_PROXY_PREFIX.stream().anyMatch(s -> dockerImageName.asCanonicalNameString().contains(s))) { + + String transformedName = applyMcrProxyPrefix(dockerImageName.asCanonicalNameString()); + LOG.info("Converting " + dockerImageName.asCanonicalNameString() + " to " + transformedName); + return DockerImageName.parse(transformedName); + } + LOG.info("Not changing " + dockerImageName.asCanonicalNameString() + "..."); return dockerImageName; } @@ -80,4 +91,11 @@ private static String applyProxyPrefix(String imageName) { private static String applyProxyAndLibraryPrefix(String imageName) { return LIBRARY_PROXY_PREFIX + imageName; } + + /** + * Apply an MCR-based prefix. + */ + private static String applyMcrProxyPrefix(String imageName) { + return MCR_PROXY_PREFIX + imageName.substring("mcr.microsoft.com/".length()); + } }