Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
157 views
in Technique[技术] by (71.8m points)

Integration between Bitbucket and Azure DevOps

My requirement is I want to integrate my Bitbucket repo with the Azure DevOps CI server so that as soon as I push code in the bitbucket repo my pipeline should trigger in the Azure DevOps CI server for that I have created a webhook in the Bitbucket repo.

I have added the Azure DevOps CI server URL in the URL section and added secret in a secret section of the webhook of Bitbucket. the secret is personal access token generated in Azure DevOps Server. But while creating a webhook I am getting

Resource not available for anonymous access. Client authentication required. - Azure DevOps server

Even though I have added a secret why it is giving client authentication required error? what could be the reason?

P.S. - There is a scarcity of documentation for integration between Bitbucket repo and Azure DevOps CI server

enter image description here

Update : I have already enabled continuous integration on the triggers tab as suggested by Vito Liu-MSFT in the answer but still my pipeline is not getting triggered automatically when I push my code to feature/POC branch in bitbucket.

enter image description here

Yml file is as follows

resources:
  repositories:
  - repository: myRepo
    type: externalgit
    name: 'myRepo' 
    endpoint: myrepo
    ref: feature/POC 

trigger:
  - feature/POC
question from:https://stackoverflow.com/questions/65598750/integration-between-bitbucket-and-azure-devops

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I push code in the bitbucket repo my pipeline should trigger in the Azure DevOps CI server

We could create service connection in the Azure DevOps, create pipeline in the Azure DevOps and select Bitbucket Cloud as source, then select Enable continuous integration on the Triggers tab. We could refer to this doc for more details.

Update1

Yes, We do not need Webhook in the Bitbucket if we enable continuous integration on the triggers tab. I have shared my test result, you could check the pic below.

enter image description here

Update2

According to the pic, it seems that you are using Azure Repos Git as the source instead of Bitbucket Cloud, note the source icon

enter image description here

Update3

Create yaml pipeline in the Azure DevOps, we need select Bitbucket Cloud as the code resource.

enter image description here

Then select Bitbucket repository, it will save the yaml file in the Bitbucket Repo instead of Azure DevOps repo, then we could configure the CI trigger.

enter image description here

I am using default yaml template do the test.

Note: we need update the field trigger, Azure DevOps has update the default branch to main instead of master

enter image description here

Note: If the yml file save in the Azure DevOps repo, it will not trigger the build if we push code in the Bitbucket repo.

Result:

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...