Add custom ImageNameSubstitutor implementation that rewrites Docker image names to use Datadog’s internal registry registry.ddbuild.io when running in a CI environment.#9679
Conversation
… image names to use Datadog’s internal registry `registry.ddbuild.io` when running in a CI environment.
BenchmarksStartupParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 66 metrics, 5 unstable metrics. Startup time reports for petclinicgantt
title petclinic - global startup overhead: candidate=1.55.0-SNAPSHOT~dbdbdc19d0, baseline=1.61.0-SNAPSHOT~6282d6bca7
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.06 s) : 0, 1059687
Total [baseline] (10.944 s) : 0, 10944335
Agent [candidate] (1.066 s) : 0, 1066369
Total [candidate] (10.997 s) : 0, 10997364
section appsec
Agent [baseline] (1.243 s) : 0, 1243012
Total [baseline] (11.125 s) : 0, 11125424
Agent [candidate] (1.252 s) : 0, 1251983
Total [candidate] (11.129 s) : 0, 11128915
section iast
Agent [baseline] (1.235 s) : 0, 1234997
Total [baseline] (11.35 s) : 0, 11350371
Agent [candidate] (1.222 s) : 0, 1221744
Total [candidate] (11.317 s) : 0, 11316614
section profiling
Agent [baseline] (1.178 s) : 0, 1178170
Total [baseline] (10.922 s) : 0, 10921878
Agent [candidate] (1.181 s) : 0, 1180776
Total [candidate] (11.024 s) : 0, 11024491
gantt
title petclinic - break down per module: candidate=1.55.0-SNAPSHOT~dbdbdc19d0, baseline=1.61.0-SNAPSHOT~6282d6bca7
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.202 ms) : 0, 1202
crashtracking [candidate] (1.198 ms) : 0, 1198
BytebuddyAgent [baseline] (627.728 ms) : 0, 627728
BytebuddyAgent [candidate] (633.175 ms) : 0, 633175
AgentMeter [baseline] (29.081 ms) : 0, 29081
AgentMeter [candidate] (29.299 ms) : 0, 29299
GlobalTracer [baseline] (256.368 ms) : 0, 256368
GlobalTracer [candidate] (257.631 ms) : 0, 257631
AppSec [baseline] (31.34 ms) : 0, 31340
AppSec [candidate] (31.564 ms) : 0, 31564
Debugger [baseline] (59.279 ms) : 0, 59279
Debugger [candidate] (59.378 ms) : 0, 59378
Remote Config [baseline] (606.66 µs) : 0, 607
Remote Config [candidate] (591.799 µs) : 0, 592
Telemetry [baseline] (8.61 ms) : 0, 8610
Telemetry [candidate] (8.617 ms) : 0, 8617
Flare Poller [baseline] (9.348 ms) : 0, 9348
Flare Poller [candidate] (8.772 ms) : 0, 8772
section appsec
crashtracking [baseline] (1.185 ms) : 0, 1185
crashtracking [candidate] (1.216 ms) : 0, 1216
BytebuddyAgent [baseline] (655.786 ms) : 0, 655786
BytebuddyAgent [candidate] (662.363 ms) : 0, 662363
AgentMeter [baseline] (11.984 ms) : 0, 11984
AgentMeter [candidate] (12.056 ms) : 0, 12056
GlobalTracer [baseline] (257.478 ms) : 0, 257478
GlobalTracer [candidate] (259.417 ms) : 0, 259417
AppSec [baseline] (177.488 ms) : 0, 177488
AppSec [candidate] (177.729 ms) : 0, 177729
Debugger [baseline] (64.923 ms) : 0, 64923
Debugger [candidate] (65.745 ms) : 0, 65745
Remote Config [baseline] (567.612 µs) : 0, 568
Remote Config [candidate] (568.855 µs) : 0, 569
Telemetry [baseline] (9.808 ms) : 0, 9808
Telemetry [candidate] (8.869 ms) : 0, 8869
Flare Poller [baseline] (3.607 ms) : 0, 3607
Flare Poller [candidate] (3.577 ms) : 0, 3577
IAST [baseline] (23.946 ms) : 0, 23946
IAST [candidate] (24.101 ms) : 0, 24101
section iast
crashtracking [baseline] (1.214 ms) : 0, 1214
crashtracking [candidate] (1.184 ms) : 0, 1184
BytebuddyAgent [baseline] (802.406 ms) : 0, 802406
BytebuddyAgent [candidate] (792.463 ms) : 0, 792463
AgentMeter [baseline] (11.558 ms) : 0, 11558
AgentMeter [candidate] (11.299 ms) : 0, 11299
GlobalTracer [baseline] (248.736 ms) : 0, 248736
GlobalTracer [candidate] (246.034 ms) : 0, 246034
AppSec [baseline] (26.476 ms) : 0, 26476
AppSec [candidate] (26.274 ms) : 0, 26274
Debugger [baseline] (62.973 ms) : 0, 62973
Debugger [candidate] (63.251 ms) : 0, 63251
Remote Config [baseline] (535.246 µs) : 0, 535
Remote Config [candidate] (518.328 µs) : 0, 518
Telemetry [baseline] (14.755 ms) : 0, 14755
Telemetry [candidate] (14.79 ms) : 0, 14790
Flare Poller [baseline] (4.826 ms) : 0, 4826
Flare Poller [candidate] (4.861 ms) : 0, 4861
IAST [baseline] (25.35 ms) : 0, 25350
IAST [candidate] (25.098 ms) : 0, 25098
section profiling
ProfilingAgent [baseline] (93.506 ms) : 0, 93506
ProfilingAgent [candidate] (93.835 ms) : 0, 93835
crashtracking [baseline] (1.171 ms) : 0, 1171
crashtracking [candidate] (1.179 ms) : 0, 1179
BytebuddyAgent [baseline] (680.9 ms) : 0, 680900
BytebuddyAgent [candidate] (682.518 ms) : 0, 682518
AgentMeter [baseline] (8.543 ms) : 0, 8543
AgentMeter [candidate] (8.618 ms) : 0, 8618
GlobalTracer [baseline] (214.552 ms) : 0, 214552
GlobalTracer [candidate] (214.872 ms) : 0, 214872
AppSec [baseline] (31.681 ms) : 0, 31681
AppSec [candidate] (31.841 ms) : 0, 31841
Debugger [baseline] (61.157 ms) : 0, 61157
Debugger [candidate] (64.128 ms) : 0, 64128
Remote Config [baseline] (572.287 µs) : 0, 572
Remote Config [candidate] (561.625 µs) : 0, 562
Telemetry [baseline] (12.019 ms) : 0, 12019
Telemetry [candidate] (8.891 ms) : 0, 8891
Flare Poller [baseline] (3.5 ms) : 0, 3500
Flare Poller [candidate] (3.527 ms) : 0, 3527
Profiling [baseline] (94.066 ms) : 0, 94066
Profiling [candidate] (94.384 ms) : 0, 94384
Startup time reports for insecure-bankgantt
title insecure-bank - global startup overhead: candidate=1.55.0-SNAPSHOT~dbdbdc19d0, baseline=1.61.0-SNAPSHOT~6282d6bca7
dateFormat X
axisFormat %s
section tracing
Agent [baseline] (1.054 s) : 0, 1053865
Total [baseline] (8.903 s) : 0, 8902989
Agent [candidate] (1.054 s) : 0, 1054130
Total [candidate] (8.81 s) : 0, 8810206
section iast
Agent [baseline] (1.225 s) : 0, 1224999
Total [baseline] (9.524 s) : 0, 9523987
Agent [candidate] (1.22 s) : 0, 1219968
Total [candidate] (9.515 s) : 0, 9514736
gantt
title insecure-bank - break down per module: candidate=1.55.0-SNAPSHOT~dbdbdc19d0, baseline=1.61.0-SNAPSHOT~6282d6bca7
dateFormat X
axisFormat %s
section tracing
crashtracking [baseline] (1.191 ms) : 0, 1191
crashtracking [candidate] (1.184 ms) : 0, 1184
BytebuddyAgent [baseline] (625.364 ms) : 0, 625364
BytebuddyAgent [candidate] (625.378 ms) : 0, 625378
AgentMeter [baseline] (29.097 ms) : 0, 29097
AgentMeter [candidate] (28.966 ms) : 0, 28966
GlobalTracer [baseline] (255.906 ms) : 0, 255906
GlobalTracer [candidate] (256.073 ms) : 0, 256073
AppSec [baseline] (31.43 ms) : 0, 31430
AppSec [candidate] (31.401 ms) : 0, 31401
Debugger [baseline] (58.429 ms) : 0, 58429
Debugger [candidate] (58.253 ms) : 0, 58253
Remote Config [baseline] (593.005 µs) : 0, 593
Remote Config [candidate] (581.695 µs) : 0, 582
Telemetry [baseline] (8.638 ms) : 0, 8638
Telemetry [candidate] (8.563 ms) : 0, 8563
Flare Poller [baseline] (7.093 ms) : 0, 7093
Flare Poller [candidate] (7.81 ms) : 0, 7810
section iast
crashtracking [baseline] (1.212 ms) : 0, 1212
crashtracking [candidate] (1.19 ms) : 0, 1190
BytebuddyAgent [baseline] (795.22 ms) : 0, 795220
BytebuddyAgent [candidate] (791.827 ms) : 0, 791827
AgentMeter [baseline] (11.267 ms) : 0, 11267
AgentMeter [candidate] (11.292 ms) : 0, 11292
GlobalTracer [baseline] (246.395 ms) : 0, 246395
GlobalTracer [candidate] (246.364 ms) : 0, 246364
AppSec [baseline] (27.283 ms) : 0, 27283
AppSec [candidate] (26.086 ms) : 0, 26086
Debugger [baseline] (61.996 ms) : 0, 61996
Debugger [candidate] (62.099 ms) : 0, 62099
Remote Config [baseline] (521.034 µs) : 0, 521
Remote Config [candidate] (518.809 µs) : 0, 519
Telemetry [baseline] (14.74 ms) : 0, 14740
Telemetry [candidate] (14.725 ms) : 0, 14725
Flare Poller [baseline] (4.976 ms) : 0, 4976
Flare Poller [candidate] (4.852 ms) : 0, 4852
IAST [baseline] (25.304 ms) : 0, 25304
IAST [candidate] (25.101 ms) : 0, 25101
LoadParameters
See matching parameters
SummaryFound 2 performance improvements and 5 performance regressions! Performance is the same for 14 metrics, 15 unstable metrics.
Request duration reports for insecure-bankgantt
title insecure-bank - request duration [CI 0.99] : candidate=1.55.0-SNAPSHOT~dbdbdc19d0, baseline=1.61.0-SNAPSHOT~6282d6bca7
dateFormat X
axisFormat %s
section baseline
no_agent (1.183 ms) : 1172, 1195
. : milestone, 1183,
iast (3.205 ms) : 3161, 3248
. : milestone, 3205,
iast_FULL (5.833 ms) : 5775, 5891
. : milestone, 5833,
iast_GLOBAL (3.421 ms) : 3366, 3475
. : milestone, 3421,
profiling (2.3 ms) : 2280, 2321
. : milestone, 2300,
tracing (1.788 ms) : 1773, 1803
. : milestone, 1788,
section candidate
no_agent (1.192 ms) : 1181, 1204
. : milestone, 1192,
iast (3.265 ms) : 3220, 3310
. : milestone, 3265,
iast_FULL (5.929 ms) : 5869, 5989
. : milestone, 5929,
iast_GLOBAL (3.55 ms) : 3492, 3608
. : milestone, 3550,
profiling (2.164 ms) : 2144, 2185
. : milestone, 2164,
tracing (1.83 ms) : 1814, 1846
. : milestone, 1830,
Request duration reports for petclinicgantt
title petclinic - request duration [CI 0.99] : candidate=1.55.0-SNAPSHOT~dbdbdc19d0, baseline=1.61.0-SNAPSHOT~6282d6bca7
dateFormat X
axisFormat %s
section baseline
no_agent (18.81 ms) : 18615, 19004
. : milestone, 18810,
appsec (19.867 ms) : 19664, 20071
. : milestone, 19867,
code_origins (17.72 ms) : 17545, 17895
. : milestone, 17720,
iast (17.896 ms) : 17716, 18077
. : milestone, 17896,
profiling (18.571 ms) : 18387, 18755
. : milestone, 18571,
tracing (17.793 ms) : 17617, 17968
. : milestone, 17793,
section candidate
no_agent (17.311 ms) : 17137, 17485
. : milestone, 17311,
appsec (19.456 ms) : 19260, 19653
. : milestone, 19456,
code_origins (17.693 ms) : 17520, 17867
. : milestone, 17693,
iast (19.062 ms) : 18867, 19257
. : milestone, 19062,
profiling (18.883 ms) : 18695, 19071
. : milestone, 18883,
tracing (18.74 ms) : 18548, 18932
. : milestone, 18740,
DacapoParameters
See matching parameters
SummaryFound 0 performance improvements and 0 performance regressions! Performance is the same for 12 metrics, 0 unstable metrics. Execution time for tomcatgantt
title tomcat - execution time [CI 0.99] : candidate=1.55.0-SNAPSHOT~dbdbdc19d0, baseline=1.61.0-SNAPSHOT~6282d6bca7
dateFormat X
axisFormat %s
section baseline
no_agent (1.482 ms) : 1470, 1493
. : milestone, 1482,
appsec (2.506 ms) : 2452, 2560
. : milestone, 2506,
iast (2.248 ms) : 2179, 2317
. : milestone, 2248,
iast_GLOBAL (2.292 ms) : 2222, 2361
. : milestone, 2292,
profiling (2.091 ms) : 2035, 2147
. : milestone, 2091,
tracing (2.06 ms) : 2007, 2114
. : milestone, 2060,
section candidate
no_agent (1.473 ms) : 1461, 1484
. : milestone, 1473,
appsec (2.506 ms) : 2451, 2560
. : milestone, 2506,
iast (2.251 ms) : 2182, 2320
. : milestone, 2251,
iast_GLOBAL (2.302 ms) : 2232, 2371
. : milestone, 2302,
profiling (2.095 ms) : 2039, 2151
. : milestone, 2095,
tracing (2.063 ms) : 2009, 2117
. : milestone, 2063,
Execution time for biojavagantt
title biojava - execution time [CI 0.99] : candidate=1.55.0-SNAPSHOT~dbdbdc19d0, baseline=1.61.0-SNAPSHOT~6282d6bca7
dateFormat X
axisFormat %s
section baseline
no_agent (15.368 s) : 15368000, 15368000
. : milestone, 15368000,
appsec (14.904 s) : 14904000, 14904000
. : milestone, 14904000,
iast (17.997 s) : 17997000, 17997000
. : milestone, 17997000,
iast_GLOBAL (17.74 s) : 17740000, 17740000
. : milestone, 17740000,
profiling (14.927 s) : 14927000, 14927000
. : milestone, 14927000,
tracing (15.263 s) : 15263000, 15263000
. : milestone, 15263000,
section candidate
no_agent (15.246 s) : 15246000, 15246000
. : milestone, 15246000,
appsec (14.9 s) : 14900000, 14900000
. : milestone, 14900000,
iast (17.854 s) : 17854000, 17854000
. : milestone, 17854000,
iast_GLOBAL (17.919 s) : 17919000, 17919000
. : milestone, 17919000,
profiling (15.356 s) : 15356000, 15356000
. : milestone, 15356000,
tracing (14.831 s) : 14831000, 14831000
. : milestone, 14831000,
|
...a-agent/instrumentation/jdbc/src/test/groovy/test/DataDogRegistryImageNameSubstitutor.groovy
Show resolved
Hide resolved
bric3
left a comment
There was a problem hiding this comment.
Nice improvement !
By the way since our registry mirrors docker hub do you think we could use the mirror of the build image in .gitlab-ci.yaml ? I remember pull failures in our GL runner.
| name = name.replace( | ||
| 'mcr.microsoft.com/mssql/server:', | ||
| 'registry.ddbuild.io/images/mirror/sqlserver:' | ||
| ) |
There was a problem hiding this comment.
thought: For consistency shouldn't we do that for all images. Also while writing this comment I noticed that the prefix is not exactly the same, i.e. one cannot simply replace mcr.microsoft.com by registry.ddbuild.io/images/mirror.
Also, what about logging / printing image names that are unknown ?
| (POSTGRESQL): "jdbc:postgresql://localhost:5432/" + dbName.get(POSTGRESQL), | ||
| (MYSQL) : "jdbc:mysql://localhost:3306/" + dbName.get(MYSQL), | ||
| (SQLSERVER) : "jdbc:sqlserver://localhost:1433/" + dbName.get(SQLSERVER), | ||
| (ORACLE) : "jdbc:oracle:thin:@//localhost:1521/" + dbName.get(ORACLE), |
There was a problem hiding this comment.
| (POSTGRESQL): "jdbc:postgresql://localhost:5432/" + dbName.get(POSTGRESQL), | |
| (MYSQL) : "jdbc:mysql://localhost:3306/" + dbName.get(MYSQL), | |
| (SQLSERVER) : "jdbc:sqlserver://localhost:1433/" + dbName.get(SQLSERVER), | |
| (ORACLE) : "jdbc:oracle:thin:@//localhost:1521/" + dbName.get(ORACLE), | |
| (POSTGRESQL): "jdbc:postgresql://localhost:5432/${dbName.get(POSTGRESQL)}", | |
| (MYSQL) : "jdbc:mysql://localhost:3306/${dbName.get(MYSQL)}", | |
| (SQLSERVER) : "jdbc:sqlserver://localhost:1433/${dbName.get(SQLSERVER)}", | |
| (ORACLE) : "jdbc:oracle:thin:@//localhost:1521/${dbName.get(ORACLE)}", |
| PortUtils.waitForPortToOpen(mysql.getHost(), mysql.getMappedPort(MySQLContainer.MYSQL_PORT), 5, TimeUnit.SECONDS) | ||
| jdbcUrls.put(MYSQL, "${mysql.getJdbcUrl()}") | ||
| sqlserver = new MSSQLServerContainer(MSSQLServerContainer.IMAGE).acceptLicense().withPassword(jdbcPasswords.get(SQLSERVER)) | ||
| sqlserver = new MSSQLServerContainer("mcr.microsoft.com/mssql/server:2022-latest").acceptLicense().withPassword(jdbcPasswords.get(SQLSERVER)) |
There was a problem hiding this comment.
thought: I think it's fine to keep MSSQLServerContainer.IMAGE.
There was a problem hiding this comment.
problem with MSSQLServerContainer.IMAGE that it is resolved as mcr.microsoft.com/mssql/server:latest, that is actually has same SHA as :2022-latest on Microsoft registry:
2022-latest | Docker Image | sha256:b1395aa51b4ec39981883560f1379ea9eba2a1c0719bf8e6477902769316bb79 | 09/11/2025
latest | Docker Image | sha256:b1395aa51b4ec39981883560f1379ea9eba2a1c0719bf8e6477902769316bb79 | 09/11/2025
But on our DataDog mirror we do not have latest image at all...
Although I can try to add it there (will check and update on that).
There was a problem hiding this comment.
Ah got it ! But if the image is different it's not exactly the same test.
It's weird however that the lastest image is not pulled "automatically" by the registry ?.
|
This pull request has been marked as stale because it has not had activity over the past quarter. It will be closed in 7 days if no further activity occurs. Feel free to reopen the PR if you are still working on it. |
What Does This Do
Implements a custom
ImageNameSubstitutorthat rewrites Docker image names to use Datadog’s internal registry (registry.ddbuild.io) when running in a CI environment.Motivation
Improve CI reliability.
Some tests were failing on CI with the following error:
org.testcontainers.containers.ContainerLaunchException: Container startup failed for image mcr.microsoft.com/mssql/server:latest.Datadog’s internal registry mirrors DockerHub images by default (via
TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX), but not images from other registries.By introducing a custom
ImageNameSubstitutor, we can rewrite image names to use our internal registry in CI, ensuring consistent availability and faster pulls.Additional Notes
Tested locally by toggling the
CIenvironment variable:CIis unset, the image is pulled from the Microsoft registry.CIis set, the image is pulled from the internal registry.