Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpmbuild: don't clean after builds with user ssh access #3185

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions rpmbuild/copr_rpmbuild/builders/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def __init__(self, task, sourcedir, resultdir, config):
self.isolation = task.get("isolation")
self.macros = macros_for_task(task, config)
self.uniqueext = get_mock_uniqueext()
self.allow_user_ssh = task.get("allow_user_ssh")

def run(self):
open(self.logfile, 'w').close() # truncate logfile
Expand Down Expand Up @@ -113,6 +114,9 @@ def produce_srpm(self, spec, sources, resultdir):

def mock_clean(self):
""" Do a best effort Mock cleanup. """
if self.allow_user_ssh:
return

cmd = MOCK_CALL + [
"-r", self.mock_config_file,
"--uniqueext", self.uniqueext,
Expand Down Expand Up @@ -175,6 +179,12 @@ def produce_rpm(self, spec, sources, resultdir):
for without_opt in self.without_opts:
cmd += ["--without", without_opt]

# This is safe because builds that allow user SSH access are run in
# a separate sandbox which is not shared with any other build (not even
# from the same user)
if self.allow_user_ssh:
cmd += ["--no-cleanup-after"]

process = GentlyTimeoutedPopen(cmd, stdin=subprocess.PIPE,
timeout=self.timeout)

Expand Down