]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
setup_container_runtime.sh: refresh bash path after podman removal 2559/head
authorDavid Galloway <david.galloway@ibm.com>
Thu, 26 Mar 2026 16:08:43 +0000 (12:08 -0400)
committerDavid Galloway <david.galloway@ibm.com>
Thu, 26 Mar 2026 16:08:43 +0000 (12:08 -0400)
If we remove podman in the "Found a very old podman; removing" function, we subsequently run `command -v podman` later in the script but we're hitting a stale cache.

e.g.,

```
+ setup_container_runtime
++ id -nu
+ loginctl enable-linger jenkins-build
+ command -v podman
/usr/bin/podman
+ podman system info
++ podman version -f '{{ lt .Client.Version "4" }}'
+ '[' true = true ']'
+ echo 'Found a very old podman; removing'
Found a very old podman; removing
+ command -v dnf
+ command -v apt
/usr/bin/apt
+ sudo apt remove -y podman

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
The following packages were automatically installed and are no longer required:
  buildah catatonit cmake cmake-data conmon containernetworking-plugins
  cython3 dh-elpa-helper dh-exec dh-python docutils-common emacsen-common
  fonts-glyphicons-halflings fuse-overlayfs golang golang-1.18 golang-1.18-doc
  golang-1.18-go golang-1.18-src golang-doc
  golang-github-containernetworking-plugin-dnsname
  golang-github-containers-common golang-github-containers-image golang-go
  golang-src gperf javahelper jsonnet junit4 libaio-dev libavahi-glib1
  libbabeltrace-ctf-dev libbabeltrace-dev libbabeltrace1 libblkid-dev
  libc6-dbg libcap-dev libcap-ng-dev libcryptsetup-dev libcunit1 libcunit1-dev
  libcurl4-openssl-dev libdouble-conversion3 libevent-2.1-7 libevent-dev
  libevent-extra-2.1-7 libevent-openssl-2.1-7 libevent-pthreads-2.1-7
  libfmt-dev libfmt8 libfuse-dev libfuse2 libgcrypt20-dev libgmp-dev
  libgmpxx4ldbl libgnutls-dane0 libgnutls-openssl27 libgnutls28-dev
  libgnutlsxx28 libgoogle-perftools-dev libgoogle-perftools4 libgpg-error-dev
  libhamcrest-java libibverbs-dev libidn2-dev libjs-bootstrap libjs-d3
  libjs-eonasdan-bootstrap-datetimepicker libjs-jquery-hotkeys libjs-moment
  libjs-moment-timezone libjs-mustache libjs-rickshaw libjsoncpp25
  libkeyutils-dev libldap-dev libldap2-dev liblmdb-dev liblttng-ust-common1
  liblttng-ust-ctl5 liblttng-ust-dev liblttng-ust-python-agent1 liblttng-ust1
  liblua5.3-0 liblua5.3-dev liblz4-dev libnbd-dev libnbd0 libnl-3-dev
  libnl-genl-3-dev libnl-route-3-dev libnspr4-dev libnss3-dev libnuma-dev
  liboath-dev liboath0 libostree-1-1 libp11-kit-dev libpcre2-16-0
  libpcre2-32-0 libpcre2-dev libpcre2-posix3 libpython3-all-dev libqt5core5a
  libqt5dbus5 libqt5network5 librabbitmq-dev librabbitmq4 librdkafka++1
  librdkafka-dev librdkafka1 librdmacm-dev libre2-dev libreadline-dev
  librhash0 libselinux1-dev libsepol-dev libsnappy-dev libsnappy1v5
  libsqlite3-dev libtasn1-6-dev libtcmalloc-minimal4 libthrift-0.16.0
  libthrift-dev libudev-dev libunbound8 libunwind-dev liburcu-dev
  libutf8proc-dev libutf8proc2 libxmlsec1-dev libxmlsec1-gcrypt
  libxmlsec1-gnutls libxmlsec1-nss libxslt1-dev libyaml-cpp-dev libyaml-cpp0.7
  libzstd-dev nasm nettle-dev ninja-build nlohmann-json3-dev prometheus
  python3-alabaster python3-all python3-all-dev python3-cheroot
  python3-cherrypy3 python3-coverage python3-dateutil python3-docutils
  python3-grpcio python3-imagesize python3-isodate python3-jaraco.classes
  python3-jaraco.collections python3-jaraco.functools python3-jaraco.text
  python3-jmespath python3-lxml python3-natsort python3-onelogin-saml2
  python3-pluggy python3-portend python3-prettytable python3-protobuf
  python3-py python3-roman python3-snowballstemmer python3-sphinx
  python3-tempora python3-toml python3-wcwidth python3-xmlsec
  python3-xmltodict python3-zc.lockfile sgml-base slirp4netns socat
  sphinx-common tox uidmap uuid-dev valgrind xfslibs-dev xml-core xmlstarlet
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  podman
0 upgraded, 0 newly installed, 1 to remove and 6 not upgraded.
After this operation, 36.6 MB disk space will be freed.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 218554 files and directories currently installed.)
Removing podman (3.4.4+ds1-1ubuntu1.22.04.3) ...
Processing triggers for man-db (2.10.2-1) ...
+ command -v podman
/usr/bin/podman
+ command -v podman
/usr/bin/podman
++ podman version -f '{{ lt .Client.Version "5.6.1" }}'
/tmp/jenkins512750246180841280.sh: line 29: /usr/bin/podman: No such file or directory
+ '[' '' = true ']'
++ podman version -f '{{ ge .Client.Version "4" }}'
/tmp/jenkins512750246180841280.sh: line 36: /usr/bin/podman: No such file or directory
+ '[' '' = true ']'
+ podman rm -f ceph_build
/tmp/jenkins512750246180841280.sh: line 66: /usr/bin/podman: No such file or directory
```

Signed-off-by: David Galloway <david.galloway@ibm.com>
scripts/setup_container_runtime.sh

index 4f6fb2998e4b5a77579062c10cf4b42b27549acc..567a354cc93aaa1a059e3c26efc5012fd733acbc 100755 (executable)
@@ -8,6 +8,8 @@ function setup_container_runtime () {
       echo "Found a very old podman; removing"
       command -v dnf && sudo dnf remove -y podman
       command -v apt && sudo apt remove -y podman
+      # Clear bash's command path cache after removing old podman
+      hash -r
     fi
   fi