How do you pull out several TFS repositories in one Jenkins job?

I have a repo that has 2 subfolders $ / Repo / project and $ / Repo / thirdparty. I need to get both of them to Jenkins in one build. Naturally, I tried to just pull $ / Repo, but this gives me a lot of other projects along with false polls (it will build every time ANYTHING is checked for $ / Repo). I tried using a multi-scm plugin that works, but does not save the configuration (annoying, but not applicable). I tried using the regular tfs plugin and manually placed the calls for another repo in the Windows command (this did not work, even if I linked them to different folders).

What is the best way to approach this? Some kind of subtitle that pulls a third side? Fix multiple scm plugin? Is there any tfs command or trigger to pull another repo when you pull the project?

+6
source share
6 answers

TFS for Jenkins does not currently support checking from multiple locations. perhaps the answer may be a few-scm-plugin, but as you pointed out in the question, at the moment this is not an option. Indeed, as far as I can see it, only for possible solutions for you:

  • Create a workspace in TFS that will include all the necessary imports. I use this functionality in my daily meetings with TFS, although I have never had the opportunity to use this with the Jenkins plugin. It might work, maybe not.
  • You can use and please, this is a pretty serious option, at least for me - git. There is git-tfs and import all the necessary projects into the git repository. And having them in git will open up many possibilities for you, including using separate repositories for each folder using git modules, git externals ... and so on. So, at least for me this is the right option, although this seems like an ugly workaround at first glance ...
+2
source

I managed to get this job with a work pipeline. This is a kind of hacking, but it works.

The program I'm trying to build uses $/Department/Framework/Main (as workspace\Framework ) and $/Department/Products/TheProgram/Main (as workspace\TheProgram ).

I created three jobs in Jenkins, each "descending" from the other:

  • Framework-Get: running the source code normally on the TFS $/Department/Framework/Main project path. There is no assembly step.
  • Execution of the Get-program: normal start of the source code in the path of the TFS product $/Department/Products/TheProgram . There is no assembly step.
  • TheProgram-Build: No source control. But the steps to build the xcopy source are from the two previous steps. Then you can run the normal build step.

The first step in building Program-Build is the windows command:

  REM =====================================
 REM First Get the Framework folder:
 rmdir / s / q Framework
 mkdir framework
 xcopy / y / q / e .. \ .. \ Framework-Get \ Workspace \ Framework Framework

 REM =====================================
 REM Then Get the TheProgram Folder:
 rmdir / s / q TheProgram 
 mkdir TheProgram 
 xcopy / y / q / e .. \ .. \ TheProgram-Get \ Workspace \ TheProgram TheProgram

The second build step was a simple call to ant. But you can use msbuild or whatever you like here.

+5
source

The TFS plugin supports the ability to hide folders in $\Repo that you are not interested in. Checkins to cloaked folders does not start the build. Unfortunately, this can be many folders, and you are only interested in two - you will need to save the list of hidden folders when new ones are added.

We avoid the TFS plugin and instead create a script to configure our TFS workspaces through the powershell step using the tfs command line. Each assembly defines the folders that it wants, and the script will take care of covering / decomposing the rest.

+1
source

My solution is to create two Jobs that just load your dependency and the other for build.

In my case, I was able to build using the Maven properties, for example:

pom.xml

 <properties> <my.dir>../MyDir</wsdl.dir> </properties> 

Jenkins build

 Goals clean package -U -Dmy.dir=${WORKSPACE}/../../another-build/workspace/MyDir 
0
source

I had to create a workaround for Jenkins. This was accomplished using TF and PowerShell Snapin Microsoft.TeamFoundation.PowerShell.

Basically the workflow is as follows:

Get-TFsWorkspace (Powershell: Workspace Validation)

TF Workspace / new

TF Workfold / unmap (use this to remove the standard $ / mapping created when the workspace was created)

TF Workfold / map (To copy specific locations, i.e. $ / Repo / project)

TF Scorch (to remove any artifacts, if any)

TF Get (Get Code)

There may be other methods that people have, but this will allow you to use tf Workfold / cloak functionality as well.

Greetings

Hope this helps.

0
source

We can confirm that several SCM 0.5 work with the Team Foundation Server 4.0 plugin

The survey does seem to be interrupted.

0
source

Source: https://habr.com/ru/post/914802/


All Articles