environment¶
Manage the targeted repository’s (deployment) environments.
Added in version 1.1.0.
Part of the github resource type: all functions operate on the
repository the job was dispatched to. The profile parameter
defaults to the profile named in the resource declaration.
- saltext.github.resources.github.modules.environment.list_(*, fields=None, profile=None)[source]¶
List the environments of the targeted repository, as a mapping of environment name to details.
CLI Example:
salt 'my-org/my-repo' environment.list
- fields
Only include these fields in the output. A single field name reduces each entry to the field’s value.
- profile
Profile configuration name to use. Defaults to the resource declaration’s profile.
- saltext.github.resources.github.modules.environment.get(name, *, profile=None)[source]¶
Return the data of a single environment of the targeted repository.
CLI Example:
salt 'my-org/my-repo' environment.get release
- name
Name of the environment.
- profile
Profile configuration name to use. Defaults to the resource declaration’s profile.
- saltext.github.resources.github.modules.environment.set_(name, *, wait_timer=None, prevent_self_review=None, reviewers=None, deployment_branch_policy=None, profile=None)[source]¶
Create or update an environment of the targeted repository, replacing its whole configuration. Unspecified settings are reset to their defaults. Returns the data of the environment.
CLI Example:
salt 'my-org/my-repo' environment.set release \ deployment_branch_policy='{protected_branches: false, custom_branch_policies: true}'
- name
Name of the environment.
- wait_timer
Amount of time to delay a job after it is initially triggered, in minutes.
- prevent_self_review
Prevent a user who created a job from approving it.
- reviewers
People or teams that may review jobs that reference the environment, as a list of mappings with
type(UserorTeam) andid.- deployment_branch_policy
Type of deployment branch policy for this environment, either
null(default) to allow all branches or a mapping withprotected_branchesandcustom_branch_policiesbooleans. Branch name patterns for custom policies are managed separately, seeenvironment.add_branch_policy.- profile
Profile configuration name to use. Defaults to the resource declaration’s profile.
- saltext.github.resources.github.modules.environment.remove(name, *, profile=None)[source]¶
Remove an environment from the targeted repository.
CLI Example:
salt 'my-org/my-repo' environment.remove release
- name
Name of the environment.
- profile
Profile configuration name to use. Defaults to the resource declaration’s profile.
- saltext.github.resources.github.modules.environment.list_branch_policies(environment, *, fields=None, profile=None)[source]¶
List the deployment branch policies of an environment of the targeted repository.
CLI Example:
salt 'my-org/my-repo' environment.list_branch_policies release
- environment
Name of the environment.
- fields
Only include these fields in the output. A single field name reduces each entry to the field’s value.
- profile
Profile configuration name to use. Defaults to the resource declaration’s profile.
- saltext.github.resources.github.modules.environment.add_branch_policy(environment, name, *, typ='branch', profile=None)[source]¶
Add a deployment branch (or tag) policy to an environment of the targeted repository. Returns the data of the created policy.
The environment’s
deployment_branch_policymust havecustom_branch_policiesenabled.CLI Example:
salt 'my-org/my-repo' environment.add_branch_policy release main
- environment
Name of the environment.
- name
Name pattern that branches (or tags) must match in order to deploy to the environment.
- typ
Target of this rule, either
branchortag. Defaults tobranch.- profile
Profile configuration name to use. Defaults to the resource declaration’s profile.
- saltext.github.resources.github.modules.environment.remove_branch_policy(environment, policy_id, *, profile=None)[source]¶
Remove a deployment branch policy from an environment of the targeted repository.
CLI Example:
salt 'my-org/my-repo' environment.remove_branch_policy release 12345
- environment
Name of the environment.
- policy_id
ID of the branch policy.
- profile
Profile configuration name to use. Defaults to the resource declaration’s profile.