atlassian-python-api icon indicating copy to clipboard operation
atlassian-python-api copied to clipboard

Allow different selector types when triggering bitbucket pipeline

Open solveretur opened this issue 3 years ago • 1 comments

Currently when triggering pipeline the selector is hardcoded to be custom - https://github.com/atlassian-api/atlassian-python-api/blob/master/atlassian/bitbucket/cloud/repositories/pipelines.py#L54 - it causes that it's not possible to trigger pipeline by a tag.

Example case would be a bitbucket-pipelines.yml like this:

pipelines:
  default:
    - step:
        name: "Test and build"
        ...do something
    - step:
        name: "Deploy to test"
        ...do something
  tags:
    release-*:
    - step:
        name: "Test and build"
        ...do something
    - step:
        name: "Deploy to test"
        ...do something
    - step:
        name: "Deploy to prod"
        ...do something else

And I would like to trigger the release-* pipeline. It's possible by the rest api by just sending a request like:

{
  "target":{
    "type":"pipeline_ref_target",
    "ref_type":"branch",
    "ref_name":"master",
		"commit": {
			"type": "commit",
			"hash": "<SOME HASH>"
		},
    "selector":{
      "type":"tags",
      "pattern":"release-*"
    }
  }
}

but it's not possible while using your library.

solveretur avatar May 11 '21 12:05 solveretur

If I get the docs right you can use this as pattern. I'm missing the enumeration of selector values in the docs. https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/pipelines/#post

Spacetown avatar May 11 '21 19:05 Spacetown