podman-gitlab-runner icon indicating copy to clipboard operation
podman-gitlab-runner copied to clipboard

Improve install_command test

Open gardar opened this issue 3 years ago • 1 comments

https://github.com/jonasbb/podman-gitlab-runner/blob/02d3f9e85004ceb169e15ea0acbb12c38bfd27ab/prepare.sh#L71-L76

I think the install_command test could be improved as the packages listed under the dependencies don't all contain binaries that are equal to the name of the package. The ca-certificates package for example does not contain any binary called ca-certificates (at least not on archlinux/debian/redhat) which causes the ca-certificates package to be installed in every job. This can count for a significant amount of time, especially on yum based distros that have a lot of repos enabled.

Possible solutions:

  • Adding a second argument to install_command for a file to check (or perhaps a command to run).
  • Check if a package is installed instead of relying on the existence of a certain file/binary. This would need to be distro specific but it would be possible to use dpkg/rpm/etc. instead of apt/yum/dnf (using rpm is significantly faster than relying on yum/dnf).

gardar avatar Jun 28 '22 16:06 gardar

It is indeed unfortunate that this always tries to install the package, but I am not aware how to check these things properly in a distro-agnostic version. Another problem I see is that the install command gets executed multiple times instead of installing all missing packages at once. If someone wants to improve the situation, I am happy to merge that.

jonasbb avatar Jun 28 '22 21:06 jonasbb