Skip to content

Commit

Permalink
docker: Fix dockerinventory script to group containers by label not ip (
Browse files Browse the repository at this point in the history
#3736)

* docker: Fix dockerinventory script to group containers by label not ip

* Update docker inventory

* remove debug
  • Loading branch information
Haroon-Khel authored Sep 24, 2024
1 parent 567fd76 commit d483066
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
38 changes: 24 additions & 14 deletions ansible/DockerInventory.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
"nodeName": "test-docker-alpine320-x64-1",
"port": "32784"
},
{
"nodeName": "test-docker-centos7-x64-1",
"port": "No port"
},
{
"nodeName": "test-docker-fedora39-x64-2",
"port": "32779"
Expand All @@ -40,7 +44,7 @@
"port": "32782"
}
],
"containersCount": 9
"containersCount": 10
},
{
"name": "dockerhost-azure-ubuntu2404-x64-1",
Expand Down Expand Up @@ -97,6 +101,12 @@
],
"containersCount": 12
},
{
"name": "dockerhost-azure-win2022-x64-1",
"ip": "No ip",
"containers": [],
"containersCount": 0
},
{
"name": "dockerhost-equinix-ubuntu2204-armv8-1",
"ip": "139.178.86.243",
Expand Down Expand Up @@ -232,7 +242,7 @@
"containersCount": 15
},
{
"name": "dockerhost-marist-ubuntu2204-s390x-1",
"name": "dockerhost-marist-ubuntu2404-s390x-1",
"ip": "148.100.74.237",
"containers": [
{
Expand All @@ -255,7 +265,18 @@
"containersCount": 4
},
{
"name": "dockerhost-osuosl-ubuntu2004-ppc64le-1",
"name": "dockerhost-osuosl-ubuntu2404-aarch64-1",
"ip": "140.211.167.67",
"containers": [
{
"nodeName": "test-docker-ubuntu2404-armv7-1",
"port": "32000"
}
],
"containersCount": 1
},
{
"name": "dockerhost-osuosl-ubuntu2404-ppc64le-1",
"ip": "140.211.168.214",
"containers": [
{
Expand All @@ -277,17 +298,6 @@
],
"containersCount": 4
},
{
"name": "dockerhost-osuosl-ubuntu2404-aarch64-1",
"ip": "140.211.167.67",
"containers": [
{
"nodeName": "test-docker-ubuntu2404-armv7-1",
"port": "32000"
}
],
"containersCount": 1
},
{
"name": "dockerhost-skytap-ubuntu2004-ppc64le-1",
"ip": "20.61.136.212",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ def main():
for node in nodes:
try:
nodeConfig = server.get_node_config(node["name"])
nodeIP = getIP(nodeConfig)
nodePort = getNodePort(nodeConfig)
if nodeIP == dockerhost["ip"] and node["name"] != dockerhost["name"]:
nodeLabel = getLabel(nodeConfig)
if nodeLabel.find(dockerhost["name"]) > -1:
nodeObject = {"nodeName": node["name"], "port": nodePort}
containers.append(nodeObject)
except jenkins.NotFoundException:
Expand Down

0 comments on commit d483066

Please sign in to comment.