Fix job logs duplicating as service logs
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA. As a benefit of being a GitLab Community Contributor, you receive complimentary access to GitLab Duo.
What does this MR do?
Fixes a bug where job logs were duplicated as service logs when the job and service images are the same.
There was an existing function isNotServiceContainer
to check if a container is a service container but that accepted only a container status. This function was changed to accept also a container and then used in the service log capture to make sure the container is actually a service container before capturing the logs from it.
I'm not sure if this approach is the best since it makes the isNotServiceContainer
function accept any type of argument. Another approach I went with first was not altering the isNotServiceContainer
function and calling it like isNotServiceContainer(api.ContainerStatus{Name: container.Name})
but decided to go with this approach since then the whole service can be passed down to the function and it will determine which fields it needs from it.
What are the relevant issue numbers?
Fixes #39042