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

pkglistgen: Support working on git branches #3089

Merged
merged 1 commit into from
May 29, 2024

Conversation

adrianschroeter
Copy link
Member

Following scmsync syntax where a branch can be specified behind the URL fragment hash

Copy link

codecov bot commented May 22, 2024

Codecov Report

Attention: Patch coverage is 0% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 28.01%. Comparing base (34947e2) to head (feb1e3f).

Files Patch % Lines
pkglistgen/tool.py 0.00% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3089      +/-   ##
==========================================
- Coverage   28.02%   28.01%   -0.02%     
==========================================
  Files          86       86              
  Lines       14981    14987       +6     
==========================================
  Hits         4199     4199              
- Misses      10782    10788       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

git_url = split[0]
args = ['git', 'clone', '--recurse-submodules', git_url, cache_dir]
if len(split) == 2:
args.append('--branch')
Copy link
Member

Choose a reason for hiding this comment

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

--single-branch as well (unconditionally)?

Copy link
Member Author

Choose a reason for hiding this comment

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

we can do so ... added another commit for that as it is independend of the branch selection.

pkglistgen/tool.py Outdated Show resolved Hide resolved
@Vogtinator
Copy link
Member

Should it also handle if the URL (any part) changes while the cache dir already exists?
Currently it'll pull and push to the previous location.

@adrianschroeter
Copy link
Member Author

yes, but that can get complex as also the default branch can change server side...

maybe we should do that with a second pull request, to avoid blocking Marco's request.

@Vogtinator
Copy link
Member

yes, but that can get complex as also the default branch can change server side...

That only impacts the initial clone though, so I don't see how that would be complex?

If it's ok to discard the cache dir on mismatches, then git remote get-url origin and git branch --show-current could be used to check for mismatches.

@Vogtinator
Copy link
Member

Without support for cache invalidation it would currently keep pulling and pushing the wrong URL

@adrianschroeter adrianschroeter force-pushed the support_branches branch 2 times, most recently from 954969b to e378573 Compare May 22, 2024 08:36
@adrianschroeter
Copy link
Member Author

I added a 90% switch solution here, but it does not cover the situation when no branch is specified, but default branch switches server side.

I reverted the --single-branch clone option therefore to be able to switch later on.

if fragment:
# FIXME: this is not takeing account default branches, which may change server side
logging.debug(subprocess.check_output(
['git', 'switch', fragment], cwd=cache_dir, encoding='utf-8'))
Copy link
Member

Choose a reason for hiding this comment

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

git switch is experimental and might not be available on ibs-slsa-botmaster

Copy link
Member

Choose a reason for hiding this comment

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

Needs to be fragment[0] anyway

Copy link
Member

Choose a reason for hiding this comment

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

the git on botmaster knows git switch

Copy link
Member

Choose a reason for hiding this comment

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

also git on ibs-slsa-botmaster knows it

@gleidi-suse
Copy link
Contributor

@adrianschroeter @Vogtinator we need this for SLFO stagings. Is there any action to be taken or can this be merged?

@adrianschroeter
Copy link
Member Author

it is fine from my side.

Please speak up if something needs to be changed.

Following scmsync syntax where a branch can be specified behind
the URL fragment hash

Co-authored-by: Fabian Vogt <fabian@ritter-vogt.de>
@Vogtinator Vogtinator merged commit 3f58f3e into openSUSE:master May 29, 2024
11 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants