Integrate bitbucket with Tekton as k8s basic-auth

12/9/2021

I am trying to integrate our bitbucket repository with tekton pipeline. Steps which I did as mentioned below. 1. Create K8s secret

 apiVersion: v1
 kind: Secret
 metadata:
   name: bitbuckt-secret-1
   namespace: cicd
   annotations:
     tekton.dev/git-0: bitbucket.org
 type: kubernetes.io/basic-auth
 stringData:
   username: test-admin
   password: <<password>>
  1. Added the secret in serviceaccount when I execute the tekton pipeline, I got the below error
     test -z ''
     test -z ''
     /ko-app/git-init -url=https://bnc-titsi-admin@bitbucket.org/bnc-titsi/grpc-poc-bff.git -revision=master -refspec= -path=/workspace/output/ -sslVerify=true -submodules=true -depth=1 -sparseCheckoutDirectories=
         {"level":"error","ts":1638952738.3208334,"caller":"git/git.go:54","msg":"Error running git [fetch --recurse-submodules=yes --depth=1 origin --update-head-ok --force master]: exit status 128\nfatal: could not read Password for 'https://bnc-titsi-admin@bitbucket.org': No such device or address\n","stacktrace":"github.com/tektoncd/pipeline/pkg/git.run\n\t/opt/app-root/src/go/src/github.com/tektoncd/pipeline/pkg/git/git.go:54\ngithub.com/tektoncd/pipeline/pkg/git.Fetch\n\t/opt/app-root/src/go/src/github.com/tektoncd/pipeline/pkg/git/git.go:149\nmain.main\n\t/opt/app-root/src/go/src/github.com/tektoncd/pipeline/cmd/git-init/main.go:53\nruntime.main\n\t/usr/lib/golang/src/runtime/proc.go:203"}
         {"level":"fatal","ts":1638952738.320914,"caller":"git-init/main.go:54","msg":"Error fetching git repository: failed to fetch [master]: exit status 128","stacktrace":"main.main\n\t/opt/app-root/src/go/src/github.com/tektoncd/pipeline/cmd/git-init/main.go:54\nruntime.main\n\t/usr/lib/golang/src/runtime/proc.go:203"}
    But when I integrate github as the same way it is working perfectly.

Please help me.

-- dipanjan bhaumik
bitbucket
kubernetes
tekton-pipelines

0 Answers