Skip to content

Commit d483066

Browse files
authored
docker: Fix dockerinventory script to group containers by label not ip (#3736)
* docker: Fix dockerinventory script to group containers by label not ip * Update docker inventory * remove debug
1 parent 567fd76 commit d483066

File tree

2 files changed

+26
-16
lines changed

2 files changed

+26
-16
lines changed

ansible/DockerInventory.json

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
"nodeName": "test-docker-alpine320-x64-1",
1616
"port": "32784"
1717
},
18+
{
19+
"nodeName": "test-docker-centos7-x64-1",
20+
"port": "No port"
21+
},
1822
{
1923
"nodeName": "test-docker-fedora39-x64-2",
2024
"port": "32779"
@@ -40,7 +44,7 @@
4044
"port": "32782"
4145
}
4246
],
43-
"containersCount": 9
47+
"containersCount": 10
4448
},
4549
{
4650
"name": "dockerhost-azure-ubuntu2404-x64-1",
@@ -97,6 +101,12 @@
97101
],
98102
"containersCount": 12
99103
},
104+
{
105+
"name": "dockerhost-azure-win2022-x64-1",
106+
"ip": "No ip",
107+
"containers": [],
108+
"containersCount": 0
109+
},
100110
{
101111
"name": "dockerhost-equinix-ubuntu2204-armv8-1",
102112
"ip": "139.178.86.243",
@@ -232,7 +242,7 @@
232242
"containersCount": 15
233243
},
234244
{
235-
"name": "dockerhost-marist-ubuntu2204-s390x-1",
245+
"name": "dockerhost-marist-ubuntu2404-s390x-1",
236246
"ip": "148.100.74.237",
237247
"containers": [
238248
{
@@ -255,7 +265,18 @@
255265
"containersCount": 4
256266
},
257267
{
258-
"name": "dockerhost-osuosl-ubuntu2004-ppc64le-1",
268+
"name": "dockerhost-osuosl-ubuntu2404-aarch64-1",
269+
"ip": "140.211.167.67",
270+
"containers": [
271+
{
272+
"nodeName": "test-docker-ubuntu2404-armv7-1",
273+
"port": "32000"
274+
}
275+
],
276+
"containersCount": 1
277+
},
278+
{
279+
"name": "dockerhost-osuosl-ubuntu2404-ppc64le-1",
259280
"ip": "140.211.168.214",
260281
"containers": [
261282
{
@@ -277,17 +298,6 @@
277298
],
278299
"containersCount": 4
279300
},
280-
{
281-
"name": "dockerhost-osuosl-ubuntu2404-aarch64-1",
282-
"ip": "140.211.167.67",
283-
"containers": [
284-
{
285-
"nodeName": "test-docker-ubuntu2404-armv7-1",
286-
"port": "32000"
287-
}
288-
],
289-
"containersCount": 1
290-
},
291301
{
292302
"name": "dockerhost-skytap-ubuntu2004-ppc64le-1",
293303
"ip": "20.61.136.212",

ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/scripts/updateDockerStaticInventory.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ def main():
6969
for node in nodes:
7070
try:
7171
nodeConfig = server.get_node_config(node["name"])
72-
nodeIP = getIP(nodeConfig)
7372
nodePort = getNodePort(nodeConfig)
74-
if nodeIP == dockerhost["ip"] and node["name"] != dockerhost["name"]:
73+
nodeLabel = getLabel(nodeConfig)
74+
if nodeLabel.find(dockerhost["name"]) > -1:
7575
nodeObject = {"nodeName": node["name"], "port": nodePort}
7676
containers.append(nodeObject)
7777
except jenkins.NotFoundException:

0 commit comments

Comments
 (0)