Trigger filtering in the pipeline JSON (CLI) - Amazon CodePipeline
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Trigger filtering in the pipeline JSON (CLI)

You can update the pipeline JSON to add filters for triggers.

To use the Amazon CLI to create or update your pipeline, use the create-pipeline or update-pipeline command.

The following example JSON structure provides a reference for the field definitions under create-pipeline.

{ "pipeline": { "name": "MyServicePipeline", "triggers": [ { "provider": "Connection", "gitConfiguration": { "sourceActionName": "ApplicationSource", "push": [ { "filePaths": { "includes": [ "projectA/**", "common/**/*.js" ], "excludes": [ "**/README.md", "**/LICENSE", "**/CONTRIBUTING.md" ] }, "branches": { "includes": [ "feature/**", "release/**" ], "excludes": [ "mainline" ] }, "tags": { "includes": [ "release-v0", "release-v1" ], "excludes": [ "release-v2" ] } } ], "pullRequest": [ { "events": [ "CLOSED" ], "branches": { "includes": [ "feature/**", "release/**" ], "excludes": [ "mainline" ] }, "filePaths": { "includes": [ "projectA/**", "common/**/*.js" ], "excludes": [ "**/README.md", "**/LICENSE", "**/CONTRIBUTING.md" ] } } ] } } ], "stages": [ { "name": "Source", "actions": [ { "name": "ApplicationSource", "configuration": { "BranchName": "mainline", "ConnectionArn": "arn:aws:codestar-connections:eu-central-1:111122223333:connection/fe9ff2e8-ee25-40c9-829e-65f8EXAMPLE", "FullRepositoryId": "monorepo-example", "OutputArtifactFormat": "CODE_ZIP" } } ] } ] } }

The fields in the JSON structure are defined as follows:

  • sourceActionName: The name of the pipeline source action with the Git configuration.

  • push: Push events with filtering. These events use an OR operation between different push filters and an AND operation inside filters.

    • branches: The branches to filter on. Branches use an AND operation between includes and excludes.

      • includes: Patterns to filter on for branches that will be included. Includes use an OR operation.

      • excludes: Patterns to filter on for branches that will be excluded. Excludes use an OR operation.

    • filePaths: The file path names to filter on.

      • includes: Patterns to filter on for file paths that will be included. Includes use an OR operation.

      • excludes: Patterns to filter on for file paths that will be excluded. Excludes use an OR operation.

    • tags: The tag names to filter on.

      • includes: Patterns to filter on for tags that will be included. Includes use an OR operation.

      • excludes: Patterns to filter on for tags that will be excluded. Excludes use an OR operation.

  • pullRequest: Pull request events with filtering on pull request events and pull request filters.

    • events: Filters on open, updated, or closed pull request events as specified.

    • branches: The branches to filter on. Branches use an AND operation between includes and excludes.

      • includes: Patterns to filter on for branches that will be included. Includes use an OR operation.

      • excludes: Patterns to filter on for branches that will be excluded. Excludes use an OR operation.

    • filePaths: The file path names to filter on.

      • includes: Patterns to filter on for file paths that will be included. Includes use an OR operation.

      • excludes: Patterns to filter on for file paths that will be excluded. Excludes use an OR operation.