Skip to content
GitmoapAPIBeta
Schema

CreateEnvironmentRequest

Creates an environment.

Shape

  • slugEnvironmentSlug (string)
  • concurrencyConcurrencyPolicy or nulloptional
    • The ConcurrencyPolicy schema
    • exclusivebooleanoptionaldefault falseWhether deploys to this environment run one at a time. Off by default.
    • max_lock_wait_secondsinteger · int32optional0–∞default 0How long a queued deploy waits for its turn before failing, in seconds: from 60 (shorter values are rounded up) to 21600. 0, the default, means it waits for as long as the pipeline's timeout allows.
    • modeConcurrencyModequeueskipcancel_previousoptionalWhat happens when a run wants to deploy while another run holds the lock: queue (the default) waits its turn, skip skips the step, and cancel_previous cancels the other run. cancel_previous is available on environments only, not on a step's resource group.
  • display_namestring or nulloptional
  • protectionEnvironmentProtection or nulloptionalThe environment's protection. When absent, a production environment requires one approval from the people given access on the owning group and deploys only from the default branch; other tiers are left unprotected.
    • The EnvironmentProtection schema
    • accept_fromAcceptFrompeople_signed_inpeoplepeople_and_service_accountspeople_and_agentsoptionalWhich kinds of approval count. A deployment approved by a bot is rarely what anyone meant, so the default is people, signed in.
    • allowed_refsarray of stringoptionalGlobs the ref a run was started from must match for it to deploy here, in the same pattern language as branch rules. Empty allows any ref.
    • allowed_scopesarray of ScopeRef or nulloptionalThe only groups and repositories allowed to deploy to this environment. Absent means the group or repository that owns it and everything beneath it.
    • approversarray of ApproverRefoptionalWho may approve: people, teams, or a role at a group or repository. Authority to approve a deployment comes from being named here, never from a role alone.
    • prevent_self_approvalbooleanoptionaldefault falseWhether the person who started the run is barred from approving its deployment. What counts is who started the run, not who wrote the commit: deploying somebody else's commit is still your deploy.
    • requiredinteger · int32optional0–∞default 1Distinct approvals needed before the deployment starts, 1–10.
    • requires_approvalbooleanoptionaldefault falseWhen set, a deployment to this environment waits for approval before it starts. Nothing runs and no credentials are issued while it waits.
    • wait_timer_secondsinteger · int32optional0–∞default 0How long a deployment waits before it may start, in seconds, up to one hour. 0 means no wait.
  • tierEnvironmentTierdevelopmenttestingstagingproductionoptionalWhat kind of environment this is, whatever it is called: development, testing, staging or production. A production environment is protected by default.
  • urlstring or nulloptional

Example

Synthesized example
{
"slug": "slug-b4ae",
"concurrency": {
"exclusive": false,
"max_lock_wait_seconds": 0,
"mode": "queue"
},
"display_name": "Lin Park",
"protection": {
"accept_from": "people_signed_in",
"allowed_refs": [
"allowed-refs-059e"
],
"allowed_scopes": [
{
"group": "4c1d8e2f-6a3b-4f90-b7c5-1e2d3c4b5a69"
},
{
"group": "4c1d8e2f-6a3b-4f90-b7c5-1e2d3c4b5a69"
}
],
"approvers": [
{
"anyone": {}
}
],
"prevent_self_approval": false,
"required": 1,
"requires_approval": false,
"wait_timer_seconds": 0
},
"tier": "development",
"url": "https://gitmoap.example/acme/cad770b8"
}

Graph

Used inside

No schema contains this one.

Used by