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

Fix for 'src_path_content' in upstream does not exist #85

Merged
merged 2 commits into from
Nov 13, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
dockerfiles: ./Dockerfile.generator
image: cwt-generator
tags: latest 1 ${{ github.sha }} 1.5.9
tags: latest 1 ${{ github.sha }} 1.5.10

- name: Push cwt-generator image to Quay.io
id: push-to-quay
Expand Down
13 changes: 11 additions & 2 deletions container_workflow_tool/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,17 @@ def handle_dangling_symlinks(self, src_parent, dest_parent):
src_path_content = os.path.join(src_parent, dest_path_rel)
self.logger.debug(f"unlink {dest_file}")
os.unlink(dest_file)
src_full = os.path.join(os.path.dirname(src_path_content),
os.readlink(src_path_content))
# Catch exception in case of 'os.readlink(src_path_content)' does not exist.
# This code is used during update upstream -> downstream.
# The row `os.unlink` above delete dest_file in case we delete it in upstream PR
# But `os.readlink(src_path_content)` fail with traceback because of file does not exist
try:
src_full = os.path.join(os.path.dirname(src_path_content),
os.readlink(src_path_content))
except FileNotFoundError:
self.logger.debug(f"Source file {src_path_content} does not exist."
f"It was deleted by upstream PR")
continue
if os.path.isdir(src_full):
# In this case, when the source directory includes another symlinks outside
# of this directory, those wouldn't be fixed, so let's run the same function
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def get_dir(system_path=None, virtual_path=None):

setup(
name='container-workflow-tool',
version="1.5.9",
version="1.5.10",
description='A python3 tool to make rebuilding images easier by automating several steps of the process.',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down