stages/ostree.deploy: support an ostree input
This will allow a user to specify an input directly to the deploy stage rather than requiring a ostree.pull stage to be called first. Adding inputs will also be useful when we soon add support for deploying from a container rather than just deploying from an existing ostree commit in a repo.
This commit is contained in:
parent
c6c9454f6f
commit
3cc733d7cd
3 changed files with 39 additions and 30 deletions
|
|
@ -81,6 +81,17 @@ SCHEMA_2 = """
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"inputs": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["commits"],
|
||||||
|
"additionalProperties": false,
|
||||||
|
"properties": {
|
||||||
|
"commits": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": true
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
@ -93,7 +104,7 @@ def make_fs_identifier(desc):
|
||||||
raise ValueError("unknown rootfs type")
|
raise ValueError("unknown rootfs type")
|
||||||
|
|
||||||
|
|
||||||
def main(tree, options):
|
def main(tree, inputs, options):
|
||||||
osname = options["osname"]
|
osname = options["osname"]
|
||||||
rootfs = options.get("rootfs")
|
rootfs = options.get("rootfs")
|
||||||
mounts = options.get("mounts", [])
|
mounts = options.get("mounts", [])
|
||||||
|
|
@ -101,6 +112,14 @@ def main(tree, options):
|
||||||
ref = options["ref"]
|
ref = options["ref"]
|
||||||
remote = options.get("remote")
|
remote = options.get("remote")
|
||||||
|
|
||||||
|
# If provided an input then do the pull into the tree
|
||||||
|
if len(inputs) != 0:
|
||||||
|
source_repo, commits = ostree.parse_input_commits(inputs["commits"])
|
||||||
|
target_repo = f"{tree}/ostree/repo"
|
||||||
|
for commit, data in commits.items():
|
||||||
|
loopref = data.get("ref", commit)
|
||||||
|
ostree.pull_local(source_repo, target_repo, remote, loopref)
|
||||||
|
|
||||||
if remote:
|
if remote:
|
||||||
ref = f"{remote}:{ref}"
|
ref = f"{remote}:{ref}"
|
||||||
|
|
||||||
|
|
@ -128,5 +147,6 @@ def main(tree, options):
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
stage_args = osbuild.api.arguments()
|
stage_args = osbuild.api.arguments()
|
||||||
r = main(stage_args["tree"],
|
r = main(stage_args["tree"],
|
||||||
|
stage_args["inputs"],
|
||||||
stage_args["options"])
|
stage_args["options"])
|
||||||
sys.exit(r)
|
sys.exit(r)
|
||||||
|
|
|
||||||
|
|
@ -1040,24 +1040,6 @@
|
||||||
{
|
{
|
||||||
"type": "org.osbuild.ostree.init-fs"
|
"type": "org.osbuild.ostree.init-fs"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "org.osbuild.ostree.pull",
|
|
||||||
"options": {
|
|
||||||
"repo": "/ostree/repo",
|
|
||||||
"remote": "osbuild"
|
|
||||||
},
|
|
||||||
"inputs": {
|
|
||||||
"commits": {
|
|
||||||
"type": "org.osbuild.ostree",
|
|
||||||
"origin": "org.osbuild.pipeline",
|
|
||||||
"references": {
|
|
||||||
"name:ostree-commit": {
|
|
||||||
"ref": "fedora/x86_64/osbuild"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "org.osbuild.ostree.os-init",
|
"type": "org.osbuild.ostree.os-init",
|
||||||
"options": {
|
"options": {
|
||||||
|
|
@ -1108,6 +1090,17 @@
|
||||||
"systemd.journald.forward_to_console=1",
|
"systemd.journald.forward_to_console=1",
|
||||||
"luks.uuid=aedd1eef-f24e-425e-a9f3-bb5a1c996a95"
|
"luks.uuid=aedd1eef-f24e-425e-a9f3-bb5a1c996a95"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"inputs": {
|
||||||
|
"commits": {
|
||||||
|
"type": "org.osbuild.ostree",
|
||||||
|
"origin": "org.osbuild.pipeline",
|
||||||
|
"references": {
|
||||||
|
"name:ostree-commit": {
|
||||||
|
"ref": "fedora/x86_64/osbuild"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -40,17 +40,6 @@ pipelines:
|
||||||
source-epoch: 1659397331
|
source-epoch: 1659397331
|
||||||
stages:
|
stages:
|
||||||
- type: org.osbuild.ostree.init-fs
|
- type: org.osbuild.ostree.init-fs
|
||||||
- type: org.osbuild.ostree.pull
|
|
||||||
options:
|
|
||||||
repo: /ostree/repo
|
|
||||||
remote: osbuild
|
|
||||||
inputs:
|
|
||||||
commits:
|
|
||||||
type: org.osbuild.ostree
|
|
||||||
origin: org.osbuild.pipeline
|
|
||||||
references:
|
|
||||||
name:ostree-commit:
|
|
||||||
ref: fedora/x86_64/osbuild
|
|
||||||
- type: org.osbuild.ostree.os-init
|
- type: org.osbuild.ostree.os-init
|
||||||
options:
|
options:
|
||||||
osname: fedora
|
osname: fedora
|
||||||
|
|
@ -83,6 +72,13 @@ pipelines:
|
||||||
- systemd.log_target=console
|
- systemd.log_target=console
|
||||||
- systemd.journald.forward_to_console=1
|
- systemd.journald.forward_to_console=1
|
||||||
- luks.uuid=aedd1eef-f24e-425e-a9f3-bb5a1c996a95
|
- luks.uuid=aedd1eef-f24e-425e-a9f3-bb5a1c996a95
|
||||||
|
inputs:
|
||||||
|
commits:
|
||||||
|
type: org.osbuild.ostree
|
||||||
|
origin: org.osbuild.pipeline
|
||||||
|
references:
|
||||||
|
name:ostree-commit:
|
||||||
|
ref: fedora/x86_64/osbuild
|
||||||
- type: org.osbuild.ostree.fillvar
|
- type: org.osbuild.ostree.fillvar
|
||||||
options:
|
options:
|
||||||
deployment:
|
deployment:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue