Skip to content

Commit

Permalink
Skip the "podman pull" for bootstrap when not needed
Browse files Browse the repository at this point in the history
Relates: #1393
  • Loading branch information
praiskup authored and xsuchy committed Aug 26, 2024
1 parent 2ef13a5 commit 8d980f8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions mock/docs/site-defaults.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@
# full jitter, see python-backoff docs for more info).
#config_opts['bootstrap_image_keep_getting'] = 120 # seconds

# Skip the "podman pull" and rely on the image already being in the local cache.
#config_opts["bootstrap_image_skip_pull"] = False

# anything you specify with 'bootstrap_*' will be copied to bootstrap config
# e.g. config_opts['bootstrap_system_yum_command'] = '/usr/bin/yum-deprecated' will become
# config_opts['system_yum_command'] = '/usr/bin/yum-deprecated' for bootstrap config
Expand Down
7 changes: 6 additions & 1 deletion mock/py/mockbuild/buildroot.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,12 @@ def _fallback(message):
podman = Podman(self, self.bootstrap_image)

with _fallback("Can't initialize from bootstrap image"):
podman.retry_image_pull(self.config["image_keep_getting"])
if not self.config["image_skip_pull"]:
podman.retry_image_pull(self.config["image_keep_getting"])
else:
getLog().info("Using local image %s (pull skipped)",
self.bootstrap_image)

podman.cp(self.make_chroot_path(), self.config["tar_binary"])
file_util.unlink_if_exists(os.path.join(self.make_chroot_path(),
"etc/rpm/macros.image-language-conf"))
Expand Down
1 change: 1 addition & 0 deletions mock/py/mockbuild/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def setup_default_config_opts():
config_opts['use_bootstrap'] = True
config_opts['use_bootstrap_image'] = True
config_opts['bootstrap_image'] = 'fedora:latest'
config_opts['bootstrap_image_skip_pull'] = False
config_opts['bootstrap_image_ready'] = False
config_opts['bootstrap_image_fallback'] = True
config_opts['bootstrap_image_keep_getting'] = 120
Expand Down
5 changes: 5 additions & 0 deletions releng/release-notes-next/bootstrap-skip-image-pull.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
There's a new `config_opts['bootstrap_image_skip_pull']` option that allows you
to skip image pulling (running the `podman pull` command by Mock) when preparing
the bootstrap chroot. This is useful if `podman pull` is failing, for example,
when the registry is temporarily or permanently unavailable, but the local image
exists, or if the image reference is pointing at a local-only image.

0 comments on commit 8d980f8

Please sign in to comment.