tektoncd / tektoncd/pipelines-as-code

Add support for bitbucket datacenter pull request event merged

Open
#2,748 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority/medium
Dominant language
Go
Stars
214
Forks
144
Avg merge
2d 11h
Merged PRs (30d)
27

Description

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]"
...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the existing Bitbucket Datacenter support for pr:comment:added, pr:comment:edited, pr:from_ref_updated, and pr:opened, then compare its event handling with the Atlassian event documentation linked in the issue. Clarify whether the scope is pr:merged alone or the additional proposed events; done means the selected event can trigger the described main-branch build behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
ci-cd, devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.