1

I am using a bitbucket repository and I have a pipeline (let's call it P1) that is triggered when users commit to the repository on bitbucket. The main task done by P1 is to sync the code from the bitbucket repository with the Azure DevOps repository.

I did our first pull request directly on Azure DevOps, from a feature branch to master, and I squashed all the commits contained within the pull request. Thus my repository on Azure DevOps is now ahead of the bitbucket repository, and I need to sync them. I created a new pipeline (P2) which runs only a powershell script, and triggers it manually, as per the link.

P2 execution succeeded, but instead of the single commit coming from the pull request, only the first commit within the pull request was persisted on bitbucket. And now, triggering P2 succeeds but it tells me that the repository is up-to-date.

How can I fix this?

Also, if you have some suggestions with regards my approach, please go ahead! I could have done the pull request on bitbucket, and I think that might have avoided all this mess. And if I wouldn't have squashed the commits into a single commit as well, but it is so much cleaner...

asked Mar 19, 2020 at 20:49
2
  • 1
    Why do you need to synchronize the two repositories? If you want to use Bitbucket for source control, then use Bitbucket. Trying to have both Bitbucket and Azure DevOps be a source of truth for ongoing code commits is going to be a nightmare. FWIW, Azure DevOps pipelines can consume source code from Bitbucket. Commented Mar 19, 2020 at 21:06
  • By having the code history on Azure DevOps we can link tickets to commits, and I find it makes my life easier to have it all on the same place. In addition, everything has been going smooth until we decided to start using pull requests. And I believe this is a bug that can be easily avoided in the future, but for now I just want to sync the repos again. But you are right, if this takes me too long to fix, I will follow your suggestion, and keep it simple. Commented Mar 19, 2020 at 21:43

1 Answer 1

1

Okay, I finally managed to get this working by forcing a push in master (I can't find the exact command I used, if someone can remind me, I will update this answer).

The repository history was a little bit messed up though (explained below), but at least it is working and even though the history is not exactly in sync, the files are.


Azure DevOps repo history

Commit XXX

Commit AAA

Bitbucket repo history

Commit XXX

Commit YYY

Commit AAA


For someone using a similar configuration, I recommend making sure the pull requests are done on bitbucket, and not on Azure DevOps. This way the pipeline will always trigger after changes on the main repo, on bitbucket, and never the other way around.

I was also having a problem related with permissions, namely:

Pushes to this branch are not permitted; you must use a pull request to update this branch.

I managed to fix it by following these guidelines

answered Mar 20, 2020 at 2:07
Sign up to request clarification or add additional context in comments.

1 Comment

I will, as soon as I am allowed to do so (in two days)

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.