Closed rocketeerbkw closed 8 months ago
Fixes an error introduced in #241 where attempting to cleanup tls certificates for an ingress that already doesn't have any tls certificates will fail the build.
The build failure error is: jq: error (at <stdin>:175): Cannot iterate over null (null) which is thrown at https://github.com/uselagoon/build-deploy-tool/blob/main/legacy/build-deploy-docker-compose.sh#L1769. The jq sequence includes .spec.tls[] which is not guaranteed to exist.
jq: error (at <stdin>:175): Cannot iterate over null (null)
jq
.spec.tls[]
The fix is to use []? to make jq treat it as optional.
[]?
Example ingress with a secret that needs to be cleaned
{ "ingressClassName": "nginx", "rules": [ { "host": "redacted", "http": { "paths": [ { "backend": { "service": { "name": "nginx", "port": { "name": "http" } } }, "path": "/", "pathType": "Prefix" } ] } } ], "tls": [ { "hosts": [ "redacted" ], "secretName": "redacted-tls" } ] }
Example ingress with no tls secrets
{ "ingressClassName": "nginx", "rules": [ { "host": "redacted", "http": { "paths": [ { "backend": { "service": { "name": "nginx", "port": { "name": "http" } } }, "path": "/", "pathType": "Prefix" } ] } } ] }
Fixes an error introduced in #241 where attempting to cleanup tls certificates for an ingress that already doesn't have any tls certificates will fail the build.
The build failure error is:
jq: error (at <stdin>:175): Cannot iterate over null (null)
which is thrown at https://github.com/uselagoon/build-deploy-tool/blob/main/legacy/build-deploy-docker-compose.sh#L1769. Thejq
sequence includes.spec.tls[]
which is not guaranteed to exist.The fix is to use
[]?
to makejq
treat it as optional.Example ingress with a secret that needs to be cleaned
Example ingress with no tls secrets