Skip to content

Commit bb6b52d

Browse files
authored
Merge branch 'main' into dependabot/github_actions/github/codeql-action-4.35.2
2 parents 0c44c9b + 930c54a commit bb6b52d

8 files changed

Lines changed: 72 additions & 11 deletions

File tree

.github/workflows/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
python -m pip list
2424
- name: Dependabot metadata
2525
id: dependabot-metadata
26-
uses: dependabot/fetch-metadata@v3.0.0
26+
uses: dependabot/fetch-metadata@v3.1.0
2727
with:
2828
github-token: "${{ secrets.GITHUB_TOKEN }}"
2929
- name: Add a label

.github/workflows/dependency-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ jobs:
1717
- name: 'Checkout Repository'
1818
uses: actions/checkout@v6.0.2
1919
- name: 'Dependency Review'
20-
uses: actions/dependency-review-action@v4
20+
uses: actions/dependency-review-action@v5

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ This project was forked from version 1.7.4 of [mbed-tools-ci-scripts](https://gi
1717

1818
[//]: # (begin_release_notes)
1919

20+
"3.4.1" (2026-06-01)
21+
====================
22+
23+
Bugfixes
24+
--------
25+
26+
- Dependency upgrade: jinja2-3.0.3 (#202202230717)
27+
- Dependency upgrade: fetch-metadata-3.1.0 (#20260420065012)
28+
- Dependency upgrade: dependency-review-action-5 (#20260511075632)
29+
- :bug: Ensure that if a fetch fails it retries with authentication in the same way as clone (#20260601135433)
30+
31+
2032
"3.4.0" (2026-04-07)
2133
====================
2234

continuous_delivery_scripts/_version.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
This file is autogenerated, do not modify by hand.
1212
"""
1313

14-
__version__ = "3.4.0"
15-
COMMIT = "593860a336acbead96e80e1a5c55aee240dbf97e"
14+
__version__ = "3.4.1"
15+
COMMIT = "3cb7eefdafb8306ca4750f371325574e1a2ec9c7"
1616
MAJOR = 3
1717
MINOR = 4
18-
PATCH = 0
18+
PATCH = 1

continuous_delivery_scripts/utils/git_helpers.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,13 @@ def is_release_branch(self, branch_name: Optional[str]) -> bool:
196196

197197
def fetch(self) -> None:
198198
"""Fetches latest changes."""
199-
self.repo.git.fetch(all=True, tags=True, force=True)
199+
try:
200+
self.repo.git.fetch(all=True, tags=True, force=True)
201+
except GitCommandError as e:
202+
logger.info("failed fetching repository: %s" % e)
203+
logger.info("Retrying a different way")
204+
self.set_remote_url(self._git_url_ssh_to_https(self.get_remote_url()))
205+
self.repo.git.fetch(all=True, tags=True, force=True)
200206

201207
def get_branch(self, branch_name: str) -> Any:
202208
"""Gets a specific local branch.

docs/utils/git_helpers.html

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,13 @@ <h1 class="title">Module <code>continuous_delivery_scripts.utils.git_helpers</co
229229

230230
def fetch(self) -&gt; None:
231231
&#34;&#34;&#34;Fetches latest changes.&#34;&#34;&#34;
232-
self.repo.git.fetch(all=True, tags=True, force=True)
232+
try:
233+
self.repo.git.fetch(all=True, tags=True, force=True)
234+
except GitCommandError as e:
235+
logger.info(&#34;failed fetching repository: %s&#34; % e)
236+
logger.info(&#34;Retrying a different way&#34;)
237+
self.set_remote_url(self._git_url_ssh_to_https(self.get_remote_url()))
238+
self.repo.git.fetch(all=True, tags=True, force=True)
233239

234240
def get_branch(self, branch_name: str) -&gt; Any:
235241
&#34;&#34;&#34;Gets a specific local branch.
@@ -1319,7 +1325,13 @@ <h2 id="args">Args</h2>
13191325

13201326
def fetch(self) -&gt; None:
13211327
&#34;&#34;&#34;Fetches latest changes.&#34;&#34;&#34;
1322-
self.repo.git.fetch(all=True, tags=True, force=True)
1328+
try:
1329+
self.repo.git.fetch(all=True, tags=True, force=True)
1330+
except GitCommandError as e:
1331+
logger.info(&#34;failed fetching repository: %s&#34; % e)
1332+
logger.info(&#34;Retrying a different way&#34;)
1333+
self.set_remote_url(self._git_url_ssh_to_https(self.get_remote_url()))
1334+
self.repo.git.fetch(all=True, tags=True, force=True)
13231335

13241336
def get_branch(self, branch_name: str) -&gt; Any:
13251337
&#34;&#34;&#34;Gets a specific local branch.
@@ -2278,7 +2290,13 @@ <h2 id="args">Args</h2>
22782290
</summary>
22792291
<pre><code class="python">def fetch(self) -&gt; None:
22802292
&#34;&#34;&#34;Fetches latest changes.&#34;&#34;&#34;
2281-
self.repo.git.fetch(all=True, tags=True, force=True)</code></pre>
2293+
try:
2294+
self.repo.git.fetch(all=True, tags=True, force=True)
2295+
except GitCommandError as e:
2296+
logger.info(&#34;failed fetching repository: %s&#34; % e)
2297+
logger.info(&#34;Retrying a different way&#34;)
2298+
self.set_remote_url(self._git_url_ssh_to_https(self.get_remote_url()))
2299+
self.repo.git.fetch(all=True, tags=True, force=True)</code></pre>
22822300
</details>
22832301
</dd>
22842302
<dt id="continuous_delivery_scripts.utils.git_helpers.GitWrapper.force_pull"><code class="name flex">

news/202202230717.bugfix

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/git_helper/test_git_helpers.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
# Copyright (C) 2020-2026 Arm Limited or its affiliates and Contributors. All rights reserved.
33
# SPDX-License-Identifier: Apache-2.0
44
#
5-
from unittest import TestCase
5+
from unittest import TestCase, mock
6+
7+
from git import GitCommandError
68

79
from continuous_delivery_scripts.utils.configuration import (
810
configuration,
@@ -37,6 +39,30 @@ def test_list_tracked_files(self):
3739
self.assertTrue(len(tracked_files) > 0)
3840
self.assertIn("setup.py", tracked_files)
3941

42+
@mock.patch.object(GitWrapper, "set_remote_url")
43+
@mock.patch.object(
44+
GitWrapper,
45+
"_git_url_ssh_to_https",
46+
return_value="https://test-token:x-oauth-basic@github.com/example/repository.git",
47+
)
48+
@mock.patch.object(
49+
GitWrapper,
50+
"get_remote_url",
51+
return_value="https://github.com/example/repository.git",
52+
)
53+
def test_fetch_retries_with_authentication(self, _get_remote_url, _git_url_ssh_to_https, set_remote_url):
54+
"""Ensures fetch retries with authentication when needed."""
55+
repo = mock.Mock(spec_set=["git"])
56+
repo.git = mock.Mock(spec_set=["fetch"])
57+
repo.git.fetch.side_effect = [GitCommandError("fetch", 128, stderr="fatal"), None]
58+
59+
git = GitWrapper(path=Path("."), repo=repo)
60+
61+
git.fetch()
62+
63+
self.assertEqual(2, repo.git.fetch.call_count)
64+
set_remote_url.assert_called_once_with("https://test-token:x-oauth-basic@github.com/example/repository.git")
65+
4066

4167
class TestGitTempClone(TestCase):
4268
def test_git_clone(self):

0 commit comments

Comments
 (0)