In https://github.com/openshift/tektoncd-pipeline-operator/blob/master/deploy/resources/addons/01-clustertriggerbindings/bitbucket.yaml
When a Bitbucket Server has both SSH and HTTPS enabled for clone urls the webhook payload will have a links.clone[] array like this:
"links": { "clone": [ { "href": "https://bitbucket.example.com/scm/project/project.git", "name": "http" }, { "href": "ssh://git@bitbucket.example.com:8022/project/project.git", "name": "ssh" } ],
The positioning of the ssh url in the array is not predictable, and the git-clone task expects an ssh clone url.
I suggest replacing the field mapping of the payload to use a named entry instead of the first item in the array:
For example in bitbucket-pullreq:
params: - name: gitrepo-url value: >- $(body.pullRequest.fromRef.repository.links.clone[?(@.name=="ssh")].href)
Clone links can be found in several places in the PR payload: "fromRef.repository.links.clone[]" and "toRef.repository.links.clone[]". I can't determine which is best to use, for normal pullrequests it shouldn't matter.
Best regards,
David
@af-wieda