Skip to content
Snippets Groups Projects
Commit 95d2b2b1 authored by Qinusty's avatar Qinusty
Browse files

git.py: Update git plugin to fail temporarily on clone failures

The git plugin will now make use of the fail_temporarily parameter
to Plugin.call(), allowing failures to trigger a retry.
parent c2c7d2a7
No related branches found
No related tags found
No related merge requests found
Pipeline #26562458 failed
......@@ -113,7 +113,8 @@ class GitMirror():
#
with self.source.tempdir() as tmpdir:
self.source.call([self.source.host_git, 'clone', '--mirror', '-n', self.url, tmpdir],
fail="Failed to clone git repository {}".format(self.url))
fail="Failed to clone git repository {}".format(self.url),
fail_temporarily=True)
try:
shutil.move(tmpdir, self.mirror)
......@@ -124,6 +125,7 @@ class GitMirror():
def fetch(self):
self.source.call([self.source.host_git, 'fetch', 'origin', '--prune'],
fail="Failed to fetch from remote git repository: {}".format(self.url),
fail_temporarily=True,
cwd=self.mirror)
def has_ref(self):
......@@ -157,7 +159,8 @@ class GitMirror():
# case we're just checking out a specific commit and then removing the .git/
# directory.
self.source.call([self.source.host_git, 'clone', '--no-checkout', '--shared', self.mirror, fullpath],
fail="Failed to create git mirror {} in directory: {}".format(self.mirror, fullpath))
fail="Failed to create git mirror {} in directory: {}".format(self.mirror, fullpath),
fail_temporarily=True)
self.source.call([self.source.host_git, 'checkout', '--force', self.ref],
fail="Failed to checkout git ref {}".format(self.ref),
......@@ -170,7 +173,8 @@ class GitMirror():
fullpath = os.path.join(directory, self.path)
self.source.call([self.source.host_git, 'clone', '--no-checkout', self.mirror, fullpath],
fail="Failed to clone git mirror {} in directory: {}".format(self.mirror, fullpath))
fail="Failed to clone git mirror {} in directory: {}".format(self.mirror, fullpath),
fail_temporarily=True)
self.source.call([self.source.host_git, 'remote', 'set-url', 'origin', self.url],
fail='Failed to add remote origin "{}"'.format(self.url),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment