Skip to content

Commit

Permalink
Switch to Broadcom docker proxy.
Browse files Browse the repository at this point in the history
Closes #1822
  • Loading branch information
mp911de committed Jun 20, 2024
1 parent 236d054 commit 13e5414
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 44 deletions.
44 changes: 25 additions & 19 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ pipeline {

steps {
script {
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.docker']) {
sh "PROFILE=all-dbs JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh"
sh "JENKINS_USER_NAME=${p['jenkins.user.name']} ci/clean.sh"
docker.withRegistry(p['docker.proxy.registry'], p['docker.proxy.credentials']) {
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.docker']) {
sh "PROFILE=all-dbs JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh"
sh "JENKINS_USER_NAME=${p['jenkins.user.name']} ci/clean.sh"
}
}
}
}
Expand Down Expand Up @@ -70,9 +72,11 @@ pipeline {
}
steps {
script {
docker.image(p['docker.java.next.image']).inside(p['docker.java.inside.docker']) {
sh "PROFILE=all-dbs JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh"
sh "JENKINS_USER_NAME=${p['jenkins.user.name']} ci/clean.sh"
docker.withRegistry(p['docker.proxy.registry'], p['docker.proxy.credentials']) {
docker.image(p['docker.java.next.image']).inside(p['docker.java.inside.docker']) {
sh "PROFILE=all-dbs JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh"
sh "JENKINS_USER_NAME=${p['jenkins.user.name']} ci/clean.sh"
}
}
}
}
Expand All @@ -99,19 +103,21 @@ pipeline {
}
steps {
script {
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) {
sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' +
"DEVELOCITY_CACHE_USERNAME=${DEVELOCITY_CACHE_USR} " +
"DEVELOCITY_CACHE_PASSWORD=${DEVELOCITY_CACHE_PSW} " +
"GRADLE_ENTERPRISE_ACCESS_KEY=${DEVELOCITY_ACCESS_KEY} " +
"./mvnw -s settings.xml -Pci,artifactory " +
"-Dartifactory.server=${p['artifactory.url']} " +
"-Dartifactory.username=${ARTIFACTORY_USR} " +
"-Dartifactory.password=${ARTIFACTORY_PSW} " +
"-Dartifactory.staging-repository=${p['artifactory.repository.snapshot']} " +
"-Dartifactory.build-name=spring-data-relational " +
"-Dartifactory.build-number=spring-data-relational-${BRANCH_NAME}-build-${BUILD_NUMBER} " +
"-Dmaven.test.skip=true clean deploy -U -B"
docker.withRegistry(p['docker.proxy.registry'], p['docker.proxy.credentials']) {
docker.image(p['docker.java.main.image']).inside(p['docker.java.inside.basic']) {
sh 'MAVEN_OPTS="-Duser.name=' + "${p['jenkins.user.name']}" + ' -Duser.home=/tmp/jenkins-home" ' +
"DEVELOCITY_CACHE_USERNAME=${DEVELOCITY_CACHE_USR} " +
"DEVELOCITY_CACHE_PASSWORD=${DEVELOCITY_CACHE_PSW} " +
"GRADLE_ENTERPRISE_ACCESS_KEY=${DEVELOCITY_ACCESS_KEY} " +
"./mvnw -s settings.xml -Pci,artifactory " +
"-Dartifactory.server=${p['artifactory.url']} " +
"-Dartifactory.username=${ARTIFACTORY_USR} " +
"-Dartifactory.password=${ARTIFACTORY_PSW} " +
"-Dartifactory.staging-repository=${p['artifactory.repository.snapshot']} " +
"-Dartifactory.build-name=spring-data-relational " +
"-Dartifactory.build-number=spring-data-relational-${BRANCH_NAME}-build-${BUILD_NUMBER} " +
"-Dmaven.test.skip=true clean deploy -U -B"
}
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions ci/accept-third-party-license.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
{
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"
echo "docker-hub.usw1.packages.broadcom.com/mssql/server:2022-latest"
echo "docker-hub.usw1.packages.broadcom.com/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"
echo "docker-hub.usw1.packages.broadcom.com/mssql/server:2022-latest"
echo "docker-hub.usw1.packages.broadcom.com/ibmcom/db2:11.5.7.0a"
} > spring-data-r2dbc/src/test/resources/container-license-acceptance.txt
7 changes: 5 additions & 2 deletions ci/pipeline.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ java.main.tag=17.0.9_9-jdk-focal
java.next.tag=21.0.1_12-jdk-jammy

# Docker container images - standard
docker.java.main.image=harbor-repo.vmware.com/dockerhub-proxy-cache/library/eclipse-temurin:${java.main.tag}
docker.java.next.image=harbor-repo.vmware.com/dockerhub-proxy-cache/library/eclipse-temurin:${java.next.tag}
docker.java.main.image=library/eclipse-temurin:${java.main.tag}
docker.java.next.image=library/eclipse-temurin:${java.next.tag}

# Supported versions of MongoDB
docker.mongodb.4.4.version=4.4.25
Expand All @@ -14,6 +14,7 @@ docker.mongodb.7.0.version=7.0.2

# Supported versions of Redis
docker.redis.6.version=6.2.13
docker.redis.7.version=7.2.4

# Supported versions of Cassandra
docker.cassandra.3.version=3.11.16
Expand All @@ -25,6 +26,8 @@ docker.java.inside.docker=-u root -v /var/run/docker.sock:/var/run/docker.sock -
# Credentials
docker.registry=
docker.credentials=hub.docker.com-springbuildmaster
docker.proxy.registry=https://docker-hub.usw1.packages.broadcom.com
docker.proxy.credentials=usw1_packages_broadcom_com-jenkins-token
artifactory.credentials=02bd1690-b54f-4c9f-819d-a77cb7a9822c
artifactory.url=https://repo.spring.io
artifactory.repository.snapshot=libs-snapshot-local
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/**
* An {@link ImageNameSubstitutor} only used on CI servers to leverage internal proxy solution, that needs to vary the
* prefix based on which container image is needed.
*
*
* @author Greg Turnquist
*/
public class ProxyImageNameSubstitutor extends ImageNameSubstitutor {
Expand All @@ -37,14 +37,10 @@ public class ProxyImageNameSubstitutor extends ImageNameSubstitutor {

private static final List<String> NAMES_TO_LIBRARY_PROXY_PREFIX = List.of("mariadb", "mysql", "postgres");

private static final List<String> 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 PROXY_PREFIX = "docker-hub.usw1.packages.broadcom.com/";

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) {

Expand All @@ -62,13 +58,6 @@ 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;
}
Expand All @@ -92,10 +81,4 @@ 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());
}
}

0 comments on commit 13e5414

Please sign in to comment.