stages/ostree: fix stage to work with inputs
The stage was converted to use inputs, but its schema was not, which means that although the stage requires inputs, they could not be specified. Doh. Change the expected input to `commit`. NB: This stage should be broken up, so *SHOULD NOT* be used in newly created pipelines. Fix a small whitespace change as well.
This commit is contained in:
parent
3735f090e7
commit
9c2d0744a9
1 changed files with 100 additions and 92 deletions
|
|
@ -30,105 +30,114 @@ import osbuild.api
|
|||
from osbuild.util import selinux
|
||||
|
||||
|
||||
SCHEMA = """
|
||||
"required": ["commit", "osname"],
|
||||
"properties": {
|
||||
"commit": {
|
||||
"description": "checksum of the OSTree commit",
|
||||
"type": "string"
|
||||
},
|
||||
"mounts": {
|
||||
"description": "Mount points of the final file system",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "Description of one mount point",
|
||||
SCHEMA_2 = """
|
||||
"inputs": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["commit"],
|
||||
"properties": {
|
||||
"commit": {
|
||||
"type": "object",
|
||||
"required": ["path"],
|
||||
"properties": {
|
||||
"path": {
|
||||
"description": "The path of the mount point",
|
||||
"type": "string"
|
||||
},
|
||||
"mode": {
|
||||
"description": "The mode of the mount point",
|
||||
"type": "integer",
|
||||
"default": 493
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"required": ["osname"],
|
||||
"properties": {
|
||||
"mounts": {
|
||||
"description": "Mount points of the final file system",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "Description of one mount point",
|
||||
"type": "object",
|
||||
"required": ["path"],
|
||||
"properties": {
|
||||
"path": {
|
||||
"description": "The path of the mount point",
|
||||
"type": "string"
|
||||
},
|
||||
"mode": {
|
||||
"description": "The mode of the mount point",
|
||||
"type": "integer",
|
||||
"default": 493
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"osname": {
|
||||
"description": "Name of the stateroot to be used in the deployment",
|
||||
"type": "string"
|
||||
},
|
||||
"kernel_opts": {
|
||||
"description": "Additional kernel command line options",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "A single kernel command line option",
|
||||
},
|
||||
"osname": {
|
||||
"description": "Name of the stateroot to be used in the deployment",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"ref": {
|
||||
"description": "OStree ref to create and use for deployment",
|
||||
"type": "string"
|
||||
},
|
||||
"remotes": {
|
||||
"description": "Configure remotes for the system repository",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "Description of a remote",
|
||||
"type": "object",
|
||||
"required": ["name", "url"],
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "Identifier for the remote",
|
||||
"type": "string"
|
||||
},
|
||||
"url": {
|
||||
"description": "URL of the remote",
|
||||
"type": "string"
|
||||
},
|
||||
"branches": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "Configured branches for the remote",
|
||||
},
|
||||
"kernel_opts": {
|
||||
"description": "Additional kernel command line options",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "A single kernel command line option",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"ref": {
|
||||
"description": "OStree ref to create and use for deployment",
|
||||
"type": "string"
|
||||
},
|
||||
"remotes": {
|
||||
"description": "Configure remotes for the system repository",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "Description of a remote",
|
||||
"type": "object",
|
||||
"required": ["name", "url"],
|
||||
"properties": {
|
||||
"name": {
|
||||
"description": "Identifier for the remote",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"gpgkeys": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "GPG keys for the remote to verify commits",
|
||||
},
|
||||
"url": {
|
||||
"description": "URL of the remote",
|
||||
"type": "string"
|
||||
},
|
||||
"branches": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "Configured branches for the remote",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"gpgkeys": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "GPG keys for the remote to verify commits",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"rootfs": {
|
||||
"description": "Identifier to locate the root file system",
|
||||
"type": "object",
|
||||
"oneOf": [{
|
||||
"required": ["uuid"]
|
||||
}, {
|
||||
"required": ["label"]
|
||||
}],
|
||||
"properties": {
|
||||
"label": {
|
||||
"description": "Identify the root file system by label",
|
||||
"type": "string"
|
||||
},
|
||||
"uuid": {
|
||||
"description": "Identify the root file system by UUID",
|
||||
"type": "string"
|
||||
},
|
||||
"rootfs": {
|
||||
"description": "Identifier to locate the root file system",
|
||||
"type": "object",
|
||||
"oneOf": [{
|
||||
"required": ["uuid"]
|
||||
}, {
|
||||
"required": ["label"]
|
||||
}],
|
||||
"properties": {
|
||||
"label": {
|
||||
"description": "Identify the root file system by label",
|
||||
"type": "string"
|
||||
},
|
||||
"uuid": {
|
||||
"description": "Identify the root file system by UUID",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"populate_var": {
|
||||
"description": "Populate $stateroot/var via systemd-tmpfiles",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
"populate_var": {
|
||||
"description": "Populate $stateroot/var via systemd-tmpfiles",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
|
@ -217,10 +226,10 @@ def populate_var(sysroot):
|
|||
|
||||
|
||||
def parse_input(inputs):
|
||||
commits = inputs["commits"]
|
||||
commits = inputs["commit"]
|
||||
data = commits["data"]
|
||||
refs = data["refs"]
|
||||
assert refs, "Need at least one commit"
|
||||
assert len(refs) == 1, "Need exactly one commit"
|
||||
return commits["path"], data["refs"]
|
||||
|
||||
|
||||
|
|
@ -244,7 +253,7 @@ def main(tree, inputs, options):
|
|||
ostree("pull-local", source_repo, ref,
|
||||
repo=f"{tree}/ostree/repo")
|
||||
|
||||
#NB: if there are multiple commits, we deploy only
|
||||
# NB: if there are multiple commits, we deploy only
|
||||
# the latest one
|
||||
|
||||
ostree("admin", "os-init", osname, sysroot=tree)
|
||||
|
|
@ -268,7 +277,6 @@ def main(tree, inputs, options):
|
|||
os.chmod(path, mount.get("mode", 0o755))
|
||||
mounter.mount(path, path)
|
||||
|
||||
|
||||
ostree("admin", "deploy", ref,
|
||||
*kargs,
|
||||
sysroot=tree,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue