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

Avoid error with slash in git branch name #6120

Closed
wants to merge 1 commit into from

Conversation

AlanCoding
Copy link
Member

SUMMARY

Speculative fix for #6119

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME
  • API
AWX VERSION
9.2.0
ADDITIONAL INFORMATION

still needs better replication and confirmation of fix

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

@@ -2252,7 +2252,7 @@ def make_local_copy(project_path, destination_folder, scm_type, scm_revision):
git_repo = git.Repo(project_path)
if not os.path.exists(destination_folder):
os.mkdir(destination_folder, stat.S_IREAD | stat.S_IWRITE | stat.S_IEXEC)
tmp_branch_name = 'awx_internal/{}'.format(uuid4())
tmp_branch_name = 'awx_internal_{}'.format(uuid4())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔
I do not doubt that this fixes the problem, but given that we already include a uuid in the branch name, I'm wondering why removing the forward slash prevents a duplicate file exception ?

Is it because we're always creating an awx_internal directory (because of the slash) and so the uuids don't matter?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I'm guessing that's probably it:

FileExistsError: [Errno 17] File exists: '/var/lib/awx/projects/_71__project_aspectmatter/.git/refs/heads/awx_internal' <----------------------------------------- 

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's how git works, in that it nests these refs under directories when there are slashes. The race condition is where the library we use doesn't account for multi-processing, and tests for existence and creates the directory with a time gap in-between.

@AlanCoding
Copy link
Member Author

Closing in favor of gitpython-developers/GitPython#998

@AlanCoding AlanCoding closed this Mar 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants