Synopsis
--name is required on the first publish only.
Only an org admin can publish.
--path takes a Rego file or a directory on this machine, and can be given
more than once, so a policy and a shared library are published together from
wherever each is kept. Every --path joins one bundle, by the same rules as
kosli evaluate policy --path: files in dot-directories are left out, and the
bundle can hold at most 100 files and 1 MiB.
Each publish stores the next version, with --comment kept on it. A change to
the files or to --input-schema makes a new version. When the files and the
input schema are the same as the newest version, and that version is pending or
valid, nothing new is stored and that version is reported. A change to only
--name or --description makes no new version.
Kosli validates each version after it is stored, and the command waits up to 30
seconds for the result:
- valid: the version can be evaluated. The command exits 0.
- rejected: the policy is at fault, for example it does not compile. The command prints the reason and exits 1.
- failed: Kosli could not validate the version. Publish again to retry. The
command exits 1.
If the wait expires, the command exits 1 and says how to read the version later.
With
--output json, the version is always printed: with the reason for a rejected or failed one, and as pending when the wait expires.
Flags
Flags inherited from parent commands
Examples Use Cases
These examples all assume that the flags--api-token, --org, --host, (and --flow, --trail when required), are set/provided.
publish the first version of a rego policy from a directory
publish the first version of a rego policy from a directory
publish a new version of an existing rego policy from one file
publish a new version of an existing rego policy from one file
publish a policy written against a set of trails, and print the version as JSON
publish a policy written against a set of trails, and print the version as JSON
show what would be published, without sending it
show what would be published, without sending it