---
name: build_pkgs_branch_on_pytests
description: Build pkgs on circleci once pytests pass
pack: st2ci
enabled: true

trigger:
    type: circle_ci.build_event

criteria:
    trigger.body.payload.branch:
        type: regex
        # Ones that do not start with `master` or `v2.1` alike.
        # Be aware that `v2.1.1` falls into limbo and thus require its own rule.
        pattern: "^((?!master|v[0-9]+\\.[0-9]+).)*$"
    trigger.body.payload.vcs_url:
        type: equals
        pattern: "https://github.com/StackStorm/st2"
    trigger.body.payload.outcome:
        type: equals
        pattern: success

action:
    ref: st2ci.build_pkgs
    parameters:
        branch: "{{trigger.body.payload.branch}}"
        revision: "{{trigger.body.payload.vcs_revision}}"
        circle_url: "{{trigger.body.payload.build_url}}"
        github_url: "{{trigger.body.payload.compare}}"
        committer: "{{trigger.body.payload.committer_name}}"
        commit_message: "{{trigger.body.payload.subject}}"
        deploy_packages: false

---
name: build_pkgs_branch_on_pytests
description: Build pkgs on circleci once pytests pass
pack: st2ci
enabled: true

trigger:
    type: circle_ci.build_event

criteria:
    trigger.body.payload.branch:
        type: regex
        # Ones that do not start with `master`, `v2.1` and `pull/` (pull requests)
        # Be aware that `v2.1.1` falls into limbo and thus require its own rule.
        pattern: "^((?!master|v[0-9]+\\.[0-9]+|pull/).)*$"
    trigger.body.payload.vcs_url:
        type: equals
        pattern: "https://github.com/StackStorm/st2"
    trigger.body.payload.outcome:
        type: equals
        pattern: success

action:
    ref: st2ci.build_pkgs
    parameters:
        branch: "{{trigger.body.payload.branch}}"
        revision: "{{trigger.body.payload.vcs_revision}}"
        circle_url: "{{trigger.body.payload.build_url}}"
        github_url: "{{trigger.body.payload.compare}}"
        committer: "{{trigger.body.payload.committer_name}}"
        commit_message: "{{trigger.body.payload.subject}}"
        deploy_packages: false

Update rule so we don't trigger circle ci build for pull request github events.
Update rule so we don't trigger circle ci build for pull request github
events.
