summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Westphahl <simon.westphahl@bmw.de>2022-08-10 09:16:02 +0200
committerSimon Westphahl <simon.westphahl@bmw.de>2022-08-18 10:34:40 +0200
commita97d9f594eb2e284d4a3592a6e987bd152fa1efc (patch)
treeae53e214b3976d0fd36b2c280c65853e555250d7
parentbb1b0d5c1108b2b4d21559535e9c120b732e99b2 (diff)
downloadzuul-a97d9f594eb2e284d4a3592a6e987bd152fa1efc.tar.gz
Set remote URL after config was updated
To avoid issues with outdated Github access tokens in the Git config we only update the remote URL on the repo object after the config update was successful. This also adds a missing repo lock when building the repo state. Change-Id: I8e1b5b26f03cb75727d2b2e3c9310214a3eac447
-rw-r--r--zuul/merger/merger.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/zuul/merger/merger.py b/zuul/merger/merger.py
index c3e20e21b..34b495fcc 100644
--- a/zuul/merger/merger.py
+++ b/zuul/merger/merger.py
@@ -733,10 +733,8 @@ class Repo(object):
return
log = get_annotated_logger(self.log, zuul_event_id)
log.debug("Set remote url to %s", redact_url(url))
+ self._git_set_remote_url(self.createRepoObject(zuul_event_id), url)
self.remote_url = url
- self._git_set_remote_url(
- self.createRepoObject(zuul_event_id),
- self.remote_url)
def mapLine(self, commit, filename, lineno, zuul_event_id=None):
repo = self.createRepoObject(zuul_event_id)
@@ -1244,11 +1242,13 @@ class Merger(object):
item['connection'], item['project'], repo_state,
item['ref'], item['newrev'])
item = items[-1]
- repo = self.getRepo(item['connection'], item['project'])
# A list of branch names the last item appears in.
item_in_branches = []
if item.get('newrev'):
- item_in_branches = repo.contains(item['newrev'])
+ lock = repo_locks.getRepoLock(item['connection'], item['project'])
+ with lock:
+ repo = self.getRepo(item['connection'], item['project'])
+ item_in_branches = repo.contains(item['newrev'])
return (True, repo_state, item_in_branches)
def getFiles(self, connection_name, project_name, branch, files, dirs=[]):