tektoncd / operator

Kubernetes operator to manage installation, updation and uninstallation of tektoncd projects (pipeline, …)
Apache License 2.0
449 stars 198 forks source link

bitbucket server ClusterTriggerBinding clone url #1702

Closed khrm closed 6 months ago

khrm commented 1 year ago

@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://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
khrm commented 1 year ago

/assign @khrm

khrm commented 1 year ago

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