Skip to content

Add support for bitbucket datacenter pull request event merged #2748

@mluckam

Description

@mluckam

Feature request

Bitbucket Datacenter has 14 supported pull request events:

  • pr:comment:added
  • pr:comment:deleted
  • pr:comment:edited
  • pr:declined
  • pr:deleted
  • pr:from_ref_updated
  • pr:merged
  • pr:modified
  • pr:opened
  • pr:reviewer:approved
  • pr:reviewer:needs_work
  • pr:reviewer:unapproved
  • pr:reviewer:updated
  • pr:to_ref_updated

Of these 14 pull request events, 4 are currently supported by the PaC provider bitbucketdatacenter:

  • pr:comment:added
  • pr:comment:edited
  • pr:from_ref_updated
  • pr:opened

See Atlassian documentation for more information on pull request events.

Some of the events do not make sense to trigger a build such as below:

  • pr:comment:deleted
  • pr:declined
  • pr:deleted
  • pr:reviewer:needs_work
  • pr:reviewer:unapproved

That being said, it is the responsibility of PaC to determine what event types make sense or instead should PaC implement all provider events and allow the end user to determine which events to utilize? At a minimum I would suggest the following be implemented:

  • pr:merged
  • pr:modified
  • pr:reviewer:approved

Use case

The use case in mind is for the pull request event merged. When a PR is approved and then merged to the main branch, the desire is to trigger a main branch build to have the latest compiled, possibly deployed, and tested. Since this event is not currently implemented it requires an additional PipelineRun defining on-target-branch as main and on-event push.

Current implementation

apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
  generateName: foo-bar-pipeline-pr-run-
  annotations:
    pipelinesascode.tekton.dev/on-target-branch: "[refs/heads/*]"
    pipelinesascode.tekton.dev/on-event: "[pull_request]"
...
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
  generateName: foo-bar-pipeline-merge-run-
  annotations:
    pipelinesascode.tekton.dev/on-target-branch: "[refs/heads/main]"
    pipelinesascode.tekton.dev/on-event: "[push]"
...

Proposed solution

apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
  generateName: foo-bar-pipeline-pr-run-
  annotations:
    pipelinesascode.tekton.dev/on-target-branch: "[refs/heads/*]"
    pipelinesascode.tekton.dev/on-event: "[pull_request]"
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions