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

Add request id to prefix of iib temporary file #500

Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions iib/workers/tasks/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ def _overwrite_from_index(
# of the manifest-tool to create the manifest list locally which means this workaround
# can be removed.
if output_pull_spec_registry == from_index_registry:
temp_dir = tempfile.TemporaryDirectory(prefix='iib-')
temp_dir = tempfile.TemporaryDirectory(prefix=f'iib-{request_id}-')
new_index_src = f'oci:{temp_dir.name}'
log.info(
'The registry used by IIB (%s) is also the registry where from_index (%s) will '
Expand Down Expand Up @@ -856,7 +856,7 @@ def handle_add_request(
_update_index_image_build_state(request_id, prebuild_info)
present_bundles: List[BundleImage] = []
present_bundles_pull_spec: List[str] = []
with tempfile.TemporaryDirectory(prefix='iib-') as temp_dir:
with tempfile.TemporaryDirectory(prefix=f'iib-{request_id}-') as temp_dir:
if from_index:
msg = 'Checking if bundles are already present in index image'
log.info(msg)
Expand Down Expand Up @@ -1071,7 +1071,7 @@ def handle_rm_request(

from_index_resolved = prebuild_info['from_index_resolved']

with tempfile.TemporaryDirectory(prefix='iib-') as temp_dir:
with tempfile.TemporaryDirectory(prefix=f'iib-{request_id}-') as temp_dir:
with set_registry_token(overwrite_from_index_token, from_index_resolved, append=True):
image_is_fbc = is_image_fbc(from_index_resolved)

Expand Down
2 changes: 1 addition & 1 deletion iib/workers/tasks/build_create_empty_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def handle_create_empty_index_request(

_update_index_image_build_state(request_id, prebuild_info)

with tempfile.TemporaryDirectory(prefix='iib-') as temp_dir:
with tempfile.TemporaryDirectory(prefix=f'iib-{request_id}-') as temp_dir:
set_request_state(request_id, 'in_progress', 'Checking operators present in index image')

operators = _get_present_operators(from_index_resolved, temp_dir)
Expand Down
2 changes: 1 addition & 1 deletion iib/workers/tasks/build_fbc_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def handle_fbc_operation_request(

_update_index_image_build_state(request_id, prebuild_info)

with tempfile.TemporaryDirectory(prefix='iib-') as temp_dir:
with tempfile.TemporaryDirectory(prefix=f'iib-{request_id}-') as temp_dir:
opm_registry_add_fbc_fragment(
request_id,
temp_dir,
Expand Down
2 changes: 1 addition & 1 deletion iib/workers/tasks/build_merge_index_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def handle_merge_request(
target_index_resolved = prebuild_info['target_index_resolved']
dockerfile_name = 'index.Dockerfile'

with tempfile.TemporaryDirectory(prefix='iib-') as temp_dir:
with tempfile.TemporaryDirectory(prefix=f'iib-{request_id}-') as temp_dir:
with set_registry_token(overwrite_target_index_token, target_index, append=True):
source_fbc = is_image_fbc(source_from_index_resolved)
target_fbc = is_image_fbc(target_index_resolved)
Expand Down
2 changes: 1 addition & 1 deletion iib/workers/tasks/build_recursive_related_bundles.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def process_parent_bundle_image(
# Pull the bundle_image to ensure steps later on don't fail due to registry timeouts
podman_pull(bundle_image_resolved)

with tempfile.TemporaryDirectory(prefix='iib-') as temp_dir:
with tempfile.TemporaryDirectory(prefix=f'iib-{request_id}-') as temp_dir:
manifests_path = os.path.join(temp_dir, 'manifests')
_copy_files_from_image(bundle_image_resolved, '/manifests', manifests_path)
metadata_path = os.path.join(temp_dir, 'metadata')
Expand Down
2 changes: 1 addition & 1 deletion iib/workers/tasks/build_regenerate_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def handle_regenerate_bundle_request(
# Pull the from_bundle_image to ensure steps later on don't fail due to registry timeouts
podman_pull(from_bundle_image_resolved)

with tempfile.TemporaryDirectory(prefix='iib-') as temp_dir:
with tempfile.TemporaryDirectory(prefix=f'iib-{request_id}-') as temp_dir:
manifests_path = os.path.join(temp_dir, 'manifests')
_copy_files_from_image(from_bundle_image_resolved, '/manifests', manifests_path)
metadata_path = os.path.join(temp_dir, 'metadata')
Expand Down