run-builder: inspect network to get gateway IP
Instead of inferring the gateway ip via the the network device for
the podman bridge, where the name can change, use podman network
inspect.
```js
The json looks like this:
[
{
"cniVersion": "0.4.0",
"name": "org.osbuild.koji",
"plugins": [
{
"bridge": "cni-podman1",
"hairpinMode": true,
"ipMasq": true,
"ipam": {
"ranges": [
[
{
"gateway": "10.89.0.1",
"subnet": "10.89.0.0/24"
}
]
],
"routes": [
{
"dst": "0.0.0.0/0"
}
],
"type": "host-local"
},
"isGateway": true,
"type": "bridge"
},
{
"capabilities": {
"portMappings": true
},
"type": "portmap"
},
{
"backend": "",
"type": "firewall"
},
{
"domainName": "dns.podman",
"type": "dnsname"
}
]
}
]
```
So the podman format for this is very obviously:
{{ (index (index (index .plugins 0).ipam.ranges 0) 0).gateway }}
This commit is contained in:
parent
dda203419c
commit
6087e2d90e
1 changed files with 4 additions and 1 deletions
|
|
@ -19,10 +19,13 @@ else
|
|||
exit 2
|
||||
fi
|
||||
|
||||
GATEWAY_IP=$(podman network inspect org.osbuild.koji --format '{{ (index (index (index .plugins 0).ipam.ranges 0) 0).gateway }}')
|
||||
echo "Gateway IP is $GATEWAY_IP"
|
||||
|
||||
${CONTAINER_RUNTIME} run --rm -i -t --name org.osbuild.koji.builder --network org.osbuild.koji \
|
||||
-v "${SHARE_DIR}:/share:z" \
|
||||
-v "${DATA_DIR}:/mnt:z" \
|
||||
-v "${PWD}/container/builder/osbuild-koji.conf:/etc/koji-osbuild/builder.conf:z" \
|
||||
--hostname org.osbuild.koji.kojid \
|
||||
--add-host=composer:$(ip route show dev cni-podman0 | cut -d\ -f7) \
|
||||
--add-host=composer:${GATEWAY_IP} \
|
||||
koji.builder
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue