0

The situation:

I am new to BitBucket. I currently I have a repository created in BitBucket and I have a TFS CI build definition with which I have linked the BitBucket Repository through an Endpoint.

The TFS CI Build Definition basically downloads the Readme.md file, which is checked-in in that repository.

Problem 1:

I want to know how can I upload\check-in any file\folders into that repository present on Bitbucket with TFS CI Build?

enter image description here

Problem 2:

In the triggers option of CI build, I don't see the option of Gated trigger present under it, like it used to be when I use TFS as the source code repository.

enter image description here

After creating a batch file,

Batch file script - It works successfully if triggered manually but doesn't work with TFS build.

enter image description here

TFS Build Pipeline which gets stuck at the Git push command while executing the batch file.

enter image description here

Sae1962
  • 1,122
  • 15
  • 31
SRP
  • 999
  • 4
  • 21
  • 39
  • check-in and "Gated" trigger it's for TFVC code. Bitbucket is Git repo, totally different. – Shayki Abramczyk Jul 16 '20 at 17:20
  • So, does that means It is not possible to push the code to Bitbucket Repo with TFS build? If it is possible then how can I do that ? – SRP Jul 17 '20 at 05:54
  • You can do it. But why you want to push code from a build? Is not a best practice. – Shayki Abramczyk Jul 17 '20 at 07:24
  • Actually, we are going to use those repos present on bitbucket for pushing any code but to check-in some configuration files in that repo. That will be used and downloaded on another domain where currently the TFS source code repository is not supported. However, if it is possible to push any file to the bitbucket repo thorugh TFS could you please let me know how, is there is any link that i can refer? – SRP Jul 17 '20 at 08:20

1 Answers1

0

We can use git command to push the file. Steps:

  1. Create a build pipeline

  2. Add task Command line and enter the code. Please refer to this doc for more details.

     git config --global user.email ""
     git config --global user.name ""
     git init
     git remote add {BitBucket repo git URL}
     git checkout -b {branch name}
     git add {file path}
     git commit -m "xxx"
     git remote add origin {BitBucket repo git URL}
     git push -u origin {branch name}
    
Vito Liu
  • 7,525
  • 1
  • 8
  • 17
  • I have created a similar batch file which when executed manually does commits and pushes the file to bitbucket repo successfully but when same batch file is called through build pipeline it gets stuck on git push command for hours and doesn't pushes the file to bitbucket. I am attaching the screenshot of both above TFS build and batch script, do you know what would be the reason it is getting stuck at Git push? – SRP Jul 21 '20 at 06:42
  • Please set the variable system.debug to true, then share the latest log screenshot and build definition with us. I will check it and update the answer to help you resolve the issue. In addition, There is a [similar issue](https://stackoverflow.com/questions/57279007/error-when-pulling-from-powershell-script), please also check it. – Vito Liu Jul 24 '20 at 12:05