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.
This commit is contained in:
Christian Kellner 2021-08-27 12:56:59 +02:00 committed by Tom Gundersen
parent 4459a37a66
commit 7ea9796d9b
3 changed files with 14 additions and 2 deletions

View file

@ -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)

View file

@ -813,7 +813,8 @@
{
"type": "org.osbuild.ostree.pull",
"options": {
"repo": "/ostree/repo"
"repo": "/ostree/repo",
"remote": "osbuild"
},
"inputs": {
"commits": {

View file

@ -253,7 +253,8 @@
{
"type": "org.osbuild.ostree.pull",
"options": {
"repo": "/ostree/repo"
"repo": "/ostree/repo",
"remote": "osbuild"
},
"inputs": {
"commits": {