Method: googleapis.cloudbuild.v1.projects.locations.triggers.create

Creates a new BuildTrigger. This API is experimental.

Arguments

Parameters
parent

string

Required. The parent resource where this trigger will be created. Format: projects/{project}/locations/{location}

projectId

string

Required. ID of the project for which to configure automatic builds.

body

object (BuildTrigger)

Required.

Raised exceptions

Exceptions
ConnectionError In case of a network problem (such as DNS failure or refused connection).
HttpError If the response status is >= 400 (excluding 429 and 503).
TimeoutError If a long-running operation takes longer to finish than the specified timeout limit.
TypeError If an operation or function receives an argument of the wrong type.
ValueError If an operation or function receives an argument of the right type but an inappropriate value. For example, a negative timeout.

Response

If successful, the response contains an instance of BuildTrigger.

Subworkflow snippet

Some fields might be optional or required. To identify required fields, refer to the API documentation.

YAML

- create:
    call: googleapis.cloudbuild.v1.projects.locations.triggers.create
    args:
        parent: ...
        projectId: ...
        body:
            approvalConfig:
                approvalRequired: ...
            autodetect: ...
            build:
                artifacts:
                    images: ...
                    objects:
                        location: ...
                        paths: ...
                availableSecrets:
                    inline: ...
                    secretManager: ...
                images: ...
                logsBucket: ...
                options:
                    diskSizeGb: ...
                    dynamicSubstitutions: ...
                    env: ...
                    logStreamingOption: ...
                    logging: ...
                    machineType: ...
                    pool:
                        name: ...
                    requestedVerifyOption: ...
                    secretEnv: ...
                    sourceProvenanceHash: ...
                    substitutionOption: ...
                    volumes: ...
                    workerPool: ...
                queueTtl: ...
                secrets: ...
                serviceAccount: ...
                source:
                    repoSource:
                        branchName: ...
                        commitSha: ...
                        dir: ...
                        invertRegex: ...
                        projectId: ...
                        repoName: ...
                        substitutions: ...
                        tagName: ...
                    storageSource:
                        bucket: ...
                        generation: ...
                        object: ...
                    storageSourceManifest:
                        bucket: ...
                        generation: ...
                        object: ...
                steps: ...
                substitutions: ...
                tags: ...
                timeout: ...
            description: ...
            disabled: ...
            filename: ...
            filter: ...
            gitFileSource:
                path: ...
                repoType: ...
                revision: ...
                uri: ...
            github:
                enterpriseConfigResourceName: ...
                installationId: ...
                name: ...
                owner: ...
                pullRequest:
                    branch: ...
                    commentControl: ...
                    invertRegex: ...
                push:
                    branch: ...
                    invertRegex: ...
                    tag: ...
            ignoredFiles: ...
            includedFiles: ...
            name: ...
            pubsubConfig:
                serviceAccountEmail: ...
                state: ...
                topic: ...
            resourceName: ...
            serviceAccount: ...
            sourceToBuild:
                ref: ...
                repoType: ...
                uri: ...
            substitutions: ...
            tags: ...
            triggerTemplate: ...
            webhookConfig:
                secret: ...
                state: ...
    result: createResult

JSON

[
  {
    "create": {
      "call": "googleapis.cloudbuild.v1.projects.locations.triggers.create",
      "args": {
        "parent": "...",
        "projectId": "...",
        "body": {
          "approvalConfig": {
            "approvalRequired": "..."
          },
          "autodetect": "...",
          "build": {
            "artifacts": {
              "images": "...",
              "objects": {
                "location": "...",
                "paths": "..."
              }
            },
            "availableSecrets": {
              "inline": "...",
              "secretManager": "..."
            },
            "images": "...",
            "logsBucket": "...",
            "options": {
              "diskSizeGb": "...",
              "dynamicSubstitutions": "...",
              "env": "...",
              "logStreamingOption": "...",
              "logging": "...",
              "machineType": "...",
              "pool": {
                "name": "..."
              },
              "requestedVerifyOption": "...",
              "secretEnv": "...",
              "sourceProvenanceHash": "...",
              "substitutionOption": "...",
              "volumes": "...",
              "workerPool": "..."
            },
            "queueTtl": "...",
            "secrets": "...",
            "serviceAccount": "...",
            "source": {
              "repoSource": {
                "branchName": "...",
                "commitSha": "...",
                "dir": "...",
                "invertRegex": "...",
                "projectId": "...",
                "repoName": "...",
                "substitutions": "...",
                "tagName": "..."
              },
              "storageSource": {
                "bucket": "...",
                "generation": "...",
                "object": "..."
              },
              "storageSourceManifest": {
                "bucket": "...",
                "generation": "...",
                "object": "..."
              }
            },
            "steps": "...",
            "substitutions": "...",
            "tags": "...",
            "timeout": "..."
          },
          "description": "...",
          "disabled": "...",
          "filename": "...",
          "filter": "...",
          "gitFileSource": {
            "path": "...",
            "repoType": "...",
            "revision": "...",
            "uri": "..."
          },
          "github": {
            "enterpriseConfigResourceName": "...",
            "installationId": "...",
            "name": "...",
            "owner": "...",
            "pullRequest": {
              "branch": "...",
              "commentControl": "...",
              "invertRegex": "..."
            },
            "push": {
              "branch": "...",
              "invertRegex": "...",
              "tag": "..."
            }
          },
          "ignoredFiles": "...",
          "includedFiles": "...",
          "name": "...",
          "pubsubConfig": {
            "serviceAccountEmail": "...",
            "state": "...",
            "topic": "..."
          },
          "resourceName": "...",
          "serviceAccount": "...",
          "sourceToBuild": {
            "ref": "...",
            "repoType": "...",
            "uri": "..."
          },
          "substitutions": "...",
          "tags": "...",
          "triggerTemplate": "...",
          "webhookConfig": {
            "secret": "...",
            "state": "..."
          }
        }
      },
      "result": "createResult"
    }
  }
]