2
votes

Recently I ran into the issue with not being able to publish in azure data factory integrated with azure devops/git. This happened because we tried using powershell to automatically create pipelines based on a json template. When this is done in the data factory using Set-AzDataFactoryV2Pipeline, you by-pass the azure devops integration and the pipeline gets published right away without any commits or pull requests. Below is the error message

Publishing Error

The publish branch is out of sync with the collaboration branch. This is likely due to publishing outside of Git mode. To recover from this state, please refer to our Git troubleshooting guide

3

3 Answers

3
votes

The MS GIT troubleshooting guide suggests some hardcore measures to resolve this out-of-sync issues (by deleting and re-creating the repo I believe). In this case, there's an easier and less hardcore way of solving this.

You simply need to:

  • Create a new branch from your master branch in data factory
  • Create the same pipeline you created via Set-AzDataFactoryV2Pipeline
  • Create a pull request and merge it into master

Voila, you'll hopefully be able to publish again as it now will consider the branches to be in sync again

1
votes

Micosoft now provides guidance on resolving this issue:

From: https://docs.microsoft.com/en-us/azure/data-factory/source-control#stale-publish-branch

Stale publish branch

If the publish branch is out of sync with the master branch and contains out-of-date resources despite a recent publish, try following these steps:

  • Remove your current Git repository
  • Reconfigure Git with the same settings, but make sure Import existing Data Factory resources to repository is selected and choose New branch
  • Create a pull request to merge the changes to the collaboration branch
0
votes

remove your git repo from data factory and create a new with exact same setting. Go to azure devops and create a new pull request to merge new branch into master.

Link: https://www.datastackpros.com/2020/05/how-to-fix-data-factory-adfpublish.html