operator icon indicating copy to clipboard operation
operator copied to clipboard

bitbucket server ClusterTriggerBinding clone url

Open khrm opened this issue 2 years ago • 2 comments

@af-wieda

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://[email protected]: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

khrm avatar Sep 15 '23 12:09 khrm

/assign @khrm

khrm avatar Sep 15 '23 12:09 khrm

Copied from here: https://github.com/openshift/tektoncd-pipeline-operator/issues/635 /cc @af-wieda

khrm avatar Sep 15 '23 12:09 khrm