Skip to content

Commit 384cd2b

Browse files
committed
check the commit is remotly available
before asking koji to pull a commit it may not be able to retrieve Signed-off-by: Gaëtan Lehmann <[email protected]>
1 parent aef25be commit 384cd2b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

scripts/koji/koji_build.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ def check_git_repo(dirpath):
3636
with cd(dirpath):
3737
return subprocess.run(['git', 'diff-index', '--quiet', 'HEAD', '--']).returncode == 0
3838

39+
def check_commit_is_available(hash):
40+
subprocess.check_output(['git', 'branch', '-r', '--contains', hash])
41+
3942
def get_repo_and_commit_info(dirpath):
4043
with cd(dirpath):
4144
remote = subprocess.check_output(['git', 'config', '--get', 'remote.origin.url']).decode().strip()
@@ -171,6 +174,8 @@ def main():
171174
remote, hash = get_repo_and_commit_info(git_repos[0])
172175
if test_build or pre_build:
173176
hash = push_bumped_release(git_repos[0], target, test_build, pre_build)
177+
else:
178+
check_commit_is_available(hash)
174179
url = koji_url(remote, hash)
175180
command = (
176181
['koji', 'build']
@@ -187,6 +192,8 @@ def main():
187192
remote, hash = get_repo_and_commit_info(d)
188193
if test_build or pre_build:
189194
hash = push_bumped_release(d, target, test_build, pre_build)
195+
else:
196+
check_commit_is_available(hash)
190197
urls.append(koji_url(remote, hash))
191198
command = ['koji', 'chain-build', target] + (' : '.join(urls)).split(' ') + (['--nowait'] if is_nowait else [])
192199
print(' '.join(command), flush=True)

0 commit comments

Comments
 (0)