osmith submitted this change.

View Change

Approvals: pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified osmith: Looks good to me, approved fixeria: Looks good to me, but someone else must approve
OBS: sync_obs_projects: fix for OSC 1.12.1

Since the Docker image used by sync_obs_projects was changed from Debian
12 to 13, several "osc" commands have in their output:

fatal: not a git repository (or any of the parent directories): .git

Work around this by switching to the temp directory and initializing a
git repository there, with an "origin" remote that osc also expects to
exist.

Fixes: 6ac535b8 ("OBS: set default distro to debian 13")
Change-Id: I1236a065e2998fb46343df3968f7bb4dabeea55a
---
M scripts/obs/sync_obs_projects.py
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/scripts/obs/sync_obs_projects.py b/scripts/obs/sync_obs_projects.py
index d494ed4..a82a47c 100755
--- a/scripts/obs/sync_obs_projects.py
+++ b/scripts/obs/sync_obs_projects.py
@@ -334,6 +334,12 @@

os.makedirs(lib.config.path_temp, exist_ok=True)

+ # OSC 1.12.1 from Debian Trixie fails if the current working dir isn't a
+ # git repository or is missing an "origin" remote
+ os.chdir(lib.config.path_temp)
+ lib.run_cmd(["git", "init"])
+ lib.run_cmd(["git", "remote", "add", "origin", "."])
+
# Get destination OBS projects
lib.osc.set_apiurl(lib.args.to_apiurl, None)
dest_projects = lib.osc.get_projects()

To view, visit change 41393. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I1236a065e2998fb46343df3968f7bb4dabeea55a
Gerrit-Change-Number: 41393
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>