tektoncd / pipeline

A cloud-native Pipeline resource.
https://tekton.dev
Apache License 2.0
8.48k stars 1.78k forks source link

"bitbucketcloud" SCM Type for the Git Remote Resolver is broken #7189

Open ElectricWarr opened 1 year ago

ElectricWarr commented 1 year ago

Expected Behaviour

Configuring remote pipeline resolution to point to a Pipeline manifest file stored in a private repo in Bitbucket Cloud results in a PipelineRun based on the specified Pipeline.

Actual Behavior

PipelineRuns fail with the following CouldntGetPipeline error:

Error retrieving pipeline for pipelinerun namespace/mypipelinerunname: error requesting remote resource: error getting "Git" "namespace/git-[id removed]": failed to create SCM client: no username supplied

This error is emitted by resolver.go at line 156. no username supplied comes from the JenkinsX go-scm factory at line 168, and the root cause appears to be that Tekton never calls the go-scm factory's SetUsername function even though this appears to be required.

Setting the scm-type to bitbucket instead of bitbucketcloud and using a Repository, Project, or Workspace Access Token seems to be a reasonable workaround, as this avoids the client.Username check above.

Additional Info

Client Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.2", GitCommit:"7f6f68fdabc4df88cfea2dcf9a19b2b830f1e647", GitTreeState:"clean", BuildDate:"2023-05-17T14:20:07Z", GoVersion:"go1.20.4", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v5.0.1
Server Version: version.Info{Major:"1", Minor:"27+", GitVersion:"v1.27.4-eks-2d98532", GitCommit:"3d90c097c72493c2f1a9dd641e4a22d24d15be68", GitTreeState:"clean", BuildDate:"2023-07-28T16:51:44Z", GoVersion:"go1.20.6", Compiler:"gc", Platform:"linux/amd64"}
Client version: 0.32.0
Chains version: v0.17.0
Pipeline version: v0.50.1
Triggers version: v0.25.0
Dashboard version: v0.39.0
Operator version: v0.68.0
ElectricWarr commented 1 year ago

New day, also tried with a Repository Access Token and still no luck

ElectricWarr commented 1 year ago

Update: after going through the source with a fine-toothed comb I've got it working! Specifying bitbucketcloud as the scm-type is always broken, I'll update this issue to reflect that.

If anyone's reading this and has the same problem, use bitbucket as your scm-type instead (and make sure your API Token is a Repostiry/Project/Workspace Access Token), it should work 👍

pritidesai commented 1 year ago

let's document this workaround for now

/kind documentation