saltext.github.utils.gh.statecores.deploy_keys¶
State core managing repository deploy keys.
- saltext.github.utils.gh.statecores.deploy_keys.present(conn, name, key, repo_name, *, read_only=False, owner=None, test=False)[source]¶
Ensure a deploy key with this title and public key is present in a repository.
Since deploy keys are immutable in the GitHub API, a key whose
keyorread_onlysetting differs is replaced (removed and recreated).- conn
GitHubConnectionto use.- name
Display title of the deploy key.
- key
SSH public key.
- repo_name
Name of the repository.
- read_only
Deny write access to the repository for this key. Defaults to false.
- owner
Owner of the repository. Defaults to the connection’s owner.
- test
Only project the changes without applying them (
testmode).
- saltext.github.utils.gh.statecores.deploy_keys.actions_present(conn, name, secret_name, repo_name, *, keygen, read_only=False, rotate=False, owner=None, test=False)[source]¶
Ensure a generated SSH keypair is distributed to a repository: the public half as a deploy key, the private half as an Actions secret. The keypair is generated in memory and never persisted; only the public key’s fingerprint is reported.
Since secret values are write-only in the GitHub API, an existing pair cannot be verified to match and is left untouched unless
rotateis set. A pair with a missing half is regenerated.- conn
GitHubConnectionto use.- name
Display title of the deploy key.
- secret_name
Name of the Actions secret holding the private key. GitHub treats secret names case-insensitively.
- repo_name
Name of the repository.
- keygen
Callable generating the keypair, returning a mapping with
private_key(OpenSSH PEM format) andpublic_key(OpenSSH single-line format), likessh_pki.create_private_keydoes. Only invoked when a new pair needs to be distributed.- read_only
Deny write access to the repository for this key. Defaults to false.
- rotate
Generate and distribute a new keypair even when both halves are present. Defaults to false.
- owner
Owner of the repository. Defaults to the connection’s owner.
- test
Only project the changes without applying them (
testmode).
- saltext.github.utils.gh.statecores.deploy_keys.absent(conn, name, repo_name, *, owner=None, test=False)[source]¶
Ensure no deploy key with this title is present in a repository.
- conn
GitHubConnectionto use.- name
Display title of the deploy key.
- repo_name
Name of the repository.
- owner
Owner of the repository. Defaults to the connection’s owner.
- test
Only project the changes without applying them (
testmode).