From 7ea9796d9b3472747b41c59fba89dfbcbfeffa62 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Fri, 27 Aug 2021 12:56:59 +0200 Subject: [PATCH] stages/ostree.pull: add remote parameter Add an optional `remote` parameter that can be used to specify the the remote to track for the pulled commits. --- stages/org.osbuild.ostree.pull | 10 ++++++++++ test/data/manifests/fedora-ostree-image.json | 3 ++- test/data/manifests/fedora-ostree-image.mpp.json | 3 ++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/stages/org.osbuild.ostree.pull b/stages/org.osbuild.ostree.pull index 79a324a8..3329abca 100755 --- a/stages/org.osbuild.ostree.pull +++ b/stages/org.osbuild.ostree.pull @@ -26,6 +26,10 @@ SCHEMA_2 = """ "repo": { "description": "Location of the OSTree repo.", "type": "string" + }, + "remote": { + "description": "Add the 'remote' to the ref spec", + "type": "string" } } }, @@ -65,12 +69,18 @@ def parse_input(inputs): def main(tree, inputs, options): source_repo, commits = parse_input(inputs) repo = options["repo"] + remote = options.get("remote") target = os.path.join(tree, repo.lstrip("/")) for commit, data in commits.items(): ref = data.get("ref", commit) + extra_args = [] + if remote: + extra_args.append(f'--remote={remote}') + ostree("pull-local", source_repo, ref, + *extra_args, repo=target) diff --git a/test/data/manifests/fedora-ostree-image.json b/test/data/manifests/fedora-ostree-image.json index 0267fea2..e908c00a 100644 --- a/test/data/manifests/fedora-ostree-image.json +++ b/test/data/manifests/fedora-ostree-image.json @@ -813,7 +813,8 @@ { "type": "org.osbuild.ostree.pull", "options": { - "repo": "/ostree/repo" + "repo": "/ostree/repo", + "remote": "osbuild" }, "inputs": { "commits": { diff --git a/test/data/manifests/fedora-ostree-image.mpp.json b/test/data/manifests/fedora-ostree-image.mpp.json index b06da6c6..0f165568 100644 --- a/test/data/manifests/fedora-ostree-image.mpp.json +++ b/test/data/manifests/fedora-ostree-image.mpp.json @@ -253,7 +253,8 @@ { "type": "org.osbuild.ostree.pull", "options": { - "repo": "/ostree/repo" + "repo": "/ostree/repo", + "remote": "osbuild" }, "inputs": { "commits": {