Snapshot dependencies - correct setup

 Hello

 

We would like to set our project in following manner:

Step 1: Build Configuration: CI (all branches, Develop, Test, Release and all feature branches)

  • Restores NuGet packages
  • Build solution
  • Run tests

Step 2: Build Configuration: Create Nuget package (Only Test and Release branches)

  • Creates NuGet package and deploys it to Octopus server using OctoPack using MSBuild step

Step 3-1: Build Configuration: Create Octopus Release for Test Branch  (Only Test branch)

  • Create "Test" branch release

Step 3-2: Build Configuration: Create Octopus Release for Release Branch  (Only Release branch)

  • Create "Release" branch release

 

VCS:

All Build configurations has the same VCS source attached

 

Dependencies are as following:

  • Step 3-1/3-2 are triggered by Finished Build Trigger depending of Step 2 and has both Snapshot and Artifact dependencies
  • Step 2 is triggered by VCS Trigger and has a Snapshot Dependency on Step 1.

 

As it is now, I cannot pass Step 2, because it seems that it is trying to start the build from a different Checkout Directory:

Failed to start MSBuild.exe. Failed to find project file at path: [Path]

 

What am I doing wrong?

 

Best regards

Miroslav

0
3 comments

Hi Miroslav,

The checkout directory is set up usually differently for different build configurations (technically, it depends on their VCS configuration). Different builds are supposed to be able to run in different agents, even while being part of a build chain, so it's usually not recommended to depend on specific files created by a different build in its build folder. The recommended approach here would be to take artifact dependencies from which to build the package, to create the nuget package as a build step instead of a separate build configuration, or to configure the snapshot dependency from 2 to 1 to run in the same agent, plus configure build 2 to have the same checkout directory as build 1 (you can do this on the version control settings of the build configuration)

 

Hope this helps.

0
Avatar
Permanently deleted user

Hi Denis,

 

Thanks for the reply.

Right now I have the NuGet step configured as part of the "Step 1: Build Configuration: CI", but the problem is that we want to build all the branches(features) to be sure that there are no errors, but only build NuGet packages for "Test" and "Release". Feature branches are failing since there is a "/" in the name which OctoPack cannot handle. Can we somehow put a condition on that step then to be able that it only runs for these two specific branches?

 

0

Hi Miroslav,

There are a couple of options here:
The easiest, and probably best, given that this is part of a build chain, would be to split this into two different build configurations, probably based on a template. B1 would run builds for all branches EXCEPT test and release, B2 would run builds for test and release, plus the package, and the deploy build configurations would depend on B2. This would not only ease the task at hand, but also would give you a separate build configuration where you check the created packages than where you build the feature branches, having a separate overview of the process vs the final result.
The suggestion here would be to have:
B1 - Build, VCS Trigger on all branches except test and release
B2 - Build + package, no triggers.
Deploy Test - VCS Trigger on Test, snapshot dependency on B2
Deploy Release - VCS Trigger on Release, snapshot dependency on B2

That way, you would have detailed information on all steps. Deploy will automatically trigger B2 due to the dependency, and don't need to add the VCS Root to use a VCS Trigger, as the trigger can be configured to trigger "on changes in its snapshot dependencies"
The other option, as mentioned, continue with the separation, and set the second build to run on the same agent and use the same checkout directory.

0

Please sign in to leave a comment.