Dynamically building multiple projects in Jenkins -
i'd use jenkins dynamically search *.sln
files , trigger build each one.
i have git repository following structure:
\project1\project1.sln \project2\project2.sln \project3\project3.sln ..
my current solution have 2 projects.
parent project:
- add build step: "trigger/call builds on other projects"
- add
parameterfactory
: "for every matching file, invoke 1 build" - search
.sln
files , trigger build each matching file, filename set to:solutionfile
child project:
- use environment variable "solutionfile" create relative path solution file.
for example: project1.sln
becomes project1\project1.sln
- build solution
does have suggestions better / more robust solution?
this best solution i've been able come far.
there 2 projects: top level responsible identifying solution files, sub project builds solution file.
top level project:
- fetches repository
executes windows powershell script search
.sln
files , creates properties file each one:$solutions = get-childitem ./ -recurse -include *.sln foreach ($solution in $solutions) { write-host "identified solution build: $($solution.name)" resolve-path -relative $solution | foreach { "solutionfile=$_" -replace '\\', '\\' | out-file "$($solution.name).properties" -encoding ascii} }
note: had use encoding type ascii, or parameters contain characters.
build step: "trigger/call builds on other projects" parameter/factories of "for every property file, invoke 1 build"
file pattern: *.properties
sub project:
- setup parameter:
solutionfile
, fed in properties file - fetches repository
- builds solution file
Comments
Post a Comment