Skip to content

Index

Definition of an Environment on repository level, the following properties are supported:

Key Value Description Notes
name string The name of the environment
wait_timer int The amount of time to wait before allowing deployments to proceed
reviewers list[Actor] Users or Teams that may approve workflow runs that access this environment
prevent_self_review bool Whether a user who triggered a workflow run is prevented from approving it
deployment_branch_policy string Limit which branches can deploy to this environment based on rules or naming patterns all, protected or selected
branch_policies list[BranchOrTag] List of branch or tag patterns which can deploy to this environment only applicable if deployment_branch_policy is set to selected
secrets list[EnvironmentSecret] secrets defined for this environment, see section below for details
variables list[EnvironmentVariable] variables defined for this environment, see section below for details

Jsonnet Function

orgs.newEnvironment('<name>') {
  <key>: <value>
}

Validation rules

  • specifying a non-empty list of branch_policies while deployment_branch_policy is not set to selected triggers a warning

Example usage

orgs.newOrg('OtterdogTest') {
  ...
  _repositories+:: [
    ...
    orgs.newRepo('test-repo') {
      ...
      environments: [
        orgs.newEnvironment('linux') {
          deployment_branch_policy: "protected",
          reviewers+: [
            "@OtterdogTest/eclipsefdn-security",
            "@netomi"
          ],
          prevent_self_review: true,
          wait_timer: 30,
          secrets+: [
            orgs.newEnvSecret('TEST_SECRET') {
              value: "pass:path/to/secret",
            },
          ],
          variables+: [
            orgs.newEnvVariable('TEST_VARIABLE') {
              value: "TESTVALUE",
            },
          ],
        },
      ]
    }
  ]
}