cruisecontrol.net projecttrigger timeout - cruisecontrol.net

I have a project A ( DAL project ) that is relied upon by Projects B,C,D,E,F,G.
I currently have set up project triggers in the config of B,C,D,E,F,G and these are causing the projects to rebuild when project A successfully builds.
However, there is projects that are timing out as all the other projects are trying to be built at the same time.
Is there a way to stagger the build or get them to retry on failure of build?

Put them all in the same queue. CCNet only allows one project to build per queue.

Related

How to Order builds using Polyrepo

So I have a project set up as a polyrepo, meaning all services and libraries are in different repos.
Now, I've updated the service projects to reference the library project directly when using Debug as the build config in visual studio, and the package on NuGet when building in Release, on Azure DevOps.
The problem I am trying to solve is that my service builds sometimes fail when I've updated the library because the Library build hasn't completed and update NuGet yet.
What are my options here? Is there a way to ensure that the Library build completes first before the service builds start, or something similar?
Since you are using the Release feature in Azure Devops, I suggest that you could split the whole process into two stages (Library Build Stage and Service Build Stage).
For example:
These two stages are connected by After Stage relationship.
Then when the Library Stage completes , the Service Build stage will start.
If the two stages need to specify different files in the build, you could select the target files in the Visual Studio Build task -> Solution.
By the way, if Service Build stage needs to use the build results of Library Build stage, I suggest that you can use the same Self-hosted agents to run the release.
You can define it in Tasks -> Agent Job -> Demands.
Updates:
Since the Service Build and Library Build are two pipelines, you could try the following steps to order the Build running Step.
Step1: Set the CI trigger(continuous integration) in Library Build. This could make sure the commits could trigger the Library Build.
Step2: Disable the CI trigger in Service Build. Then Set the Pipeline trigger in Service Build. You could set the Library Build trigger the Service Build.
In this case, you could make sure that the Service Build will run after the Library Build.

When using CI/CD in VSTS, should the publish step be part of the build or the "release"?

I have a VSTS project and I'm setting up CI/CD at the moment. All fine, but I seem to have 2 options for the publishing step:
Option 1: it's a task as part of the CI Build, e.g. see build step 3 here:
https://medium.com/#flu.lund/setting-up-a-ci-pipeline-for-deploying-your-angular-application-to-azure-using-visual-studio-team-f686c8f190cf
Option 2: The build phase produces artifacts, and as part of a separate release phase these artifacts are published, see here:
https://learn.microsoft.com/en-us/vsts/build-release/actions/ci-cd-part-1?view=vsts
Both options seem well supported in the MS documentation, is one of these options better than the other? Or is it a case of pros & cons for each and it depends on circumstances, etc?
Thanks!
You should definitely use "Option 2". Your build should not make changes in your environments whatsoever, that is strictly what a "release" is. That link you have under "Option 1" is the wrong way to do it, a build should be just that, compiling code and making artifacts, not actually deploying code.
When you mesh build/releases together, you make it very difficult to debug build issues. Since your code is always being released, you really have to disable the "deploy" step to get any idea of what was built before you deployed.
Also, the nice thing about creating an artifact is you have a deployable package, and if in the future you need to rollback to a previous working version, you have that ready to go. Using the "build only" strategy, you'd have to revert your code or make unnecessary backups to achieve this.
I think you'll find any new Microsoft documentation pointing you toward this approach, and VSTS is completely set up like this. Even the "Configure Continuous Delivery in Azure..." feature in Visual Studio 2017 will create a build and a release.
Almost all build tasks are the same as release tasks, so you can deploy the app after building the project in build process.
Also there are many differences between release and build, for example, many environments, deployment group phase in release.
So which way is better is per to your detail requirement, for example, if build > deploy > other process is simple, you can do it just in build.
Regarding Publish artifact task, it is used to publish the files to VSTS server or other place (e.g. shared folder), which can be used in release as Artifact (Click Add artifact > Build in release definition), you also can download them for troubleshooting, for example, if you are using Hosted Agent that you can’t access, but you want to get some files (e.g. build result), you can add publish artifact task to publish to VSTS server, then download them (Open build result > Artifacts)

CruiseControl.net project that can skip completed tasks?

A common problem I have with CruiseControl.net is when a project encounters an error (either related to the ccnet configuration or build errors) and once I fix the error I must start the project over from the start. But in some cases this means hours of work that doesn't need to be redone.
Is there a method or design philosophy that will allow me to run sections of projects with more granularity?
I was considering passing in a number when force building and using that to determine which "stage" of the build to start at.

CC.NET alternative trigger for waiting until another step has completed (was using intervalMultiActivityTrigger - triggerActivity)

I am using an old verison of CC.NET on a continuous build server and am using the intervalTrigger and intervalMultiActivityTrigger. These types of triggers do not exist in recent versions of CC.NET and I am having difficulty finding a workaround in the documentation or on stackoverflow.
I have a continuous build server with 4 projects/steps.
Get latest code (checks every 5 minutes and continues if there is new code checked in)
Build database (triggers when #1 is complete)
Build code (triggers when #2 is complete)
Run unit tests (triggers when #3 is complete)
Step 1 uses a intervalMultiActivityTrigger to check if any of the other 3 projects are not "Sleeping" as to not start a second build until the rest of the steps have completed.
<trigger type="intervalMultiActivityTrigger" seconds="300" project="04-Do_UnitTests" projectTwo="03-Build_Code" projectThree="02-Build_Database" triggerActivity="Sleeping"/>
What are some alternatives to do the same functionality using the latest versions of CC.NET (check for another project activity="Sleeping")?
A queue will be what you are looking for. A queue can be set to contain all of your projects. The project will only be forced if it is at the head of the queue.
By default each project is in a queue with the same name aa the project. The following would force each project into the same queue, named queue1, with default settings.
<project>
<queue>queue1</queue>
</project>
The queue can be configured by defining it outside of the project scope with the additional properties.
Your case probably does not need this, but the information is here: http://cruisecontrolnet.org/projects/ccnet/wiki/Queue_Configuration
Queues have existed since version 1.3 so as long as you are using that or a later version you should be fine.

How to build unit test project when performing an Azure Cloud service CI build via Visual Studio Online?

I have a Visual Studio solution housing an Azure Cloud Service with the following projects:
CloudService
CloudServiceRole
Tests
Where the Tests project is a standard MSTest project that contains unit tests for the business logic in the CloudServiceRole project.
The code is stored in Visual Studio Online and I have hooked up the automated CI build deployment that Azure offers. When I check in code, my staging deployment of the cloud service is automatically updated. However, the Tests project is never even built during the CI builds! This, of course, means that no unit tests run during the build as the "run unit tests" part of the build process finds no assemblies with tests.
My goal is to change this so the tests project is built and all the unit tests executed.
Looking at the MSBuild arguments that the CI deployment process uses, it appears that only the CloudService:Publish target is executed. The CloudService project has no dependency on the Tests project so MSBuild never even builds the latter.
What I have tried
I cannot manually add a CloudService->Tests dependency because when I add dependencies on projects that are not Cloud Service Role projects, I get an error during build (The item "C:\a\src\MyProject\Tests\Tests.csproj" in item list "ProjectReferenceWithConfiguration" does not define a value for metadata "Name".) and I cannot add a CloudServiceRole->Tests dependency because that would make a circular dependency.
Instructing MSBuild to build the full solution by manually adding a /t:Build parameter resulted in yet another error: C:\a\bin\ServiceDefinition.csdef: Need to specify the physical directory for the virtual path 'Web/' of role Web.
Adding the Tests project as a separate build target, alongside the solution, results in the tests getting built! However, at the same time, it disables the Continuous Deployment functionality: More than one solution found. Continuous Deployment skipped.
Trying to make a fake Cloud Service Role project that references the Tests project but has zero instances configured results in a build error: WAT100: The following roles 'Tests.FakeRole' have an instance count of 0. Instance count of 0 is not supported in deployments to Microsoft Azure. Attempting to disable this validation results in a build error due to a defect in the Azure SDK.
You need to run a Build and a Publish separately. I ran into the same problem on my VSO (now VSTS) project and this fixed it. This happens because your cloud service doesn't depend on your unit test project.
1) Visual Studio Build (or MSBuild) action with arguments /t:Build (clean here)
2) Visual Studio Build (or MSBuild) action with arguments /t:Publish (do not clean here)
Note: I had to run these actions separately (not /Build;Publish) otherwise I got an error about the cloud service entry point.
Pieced this together from this question and from here and here.
One workaround that appears to bring results is to add a pre-MSBuild script to the build definition and explicitly build the Tests project in that script.
:: This is used as a pre-build script in Continuous Deployment builds because on their own, they do not build the Tests project.
"c:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe" %~dp0\..\..\Tests\Tests.csproj /t:Build /p:Configuration=Debug;Platform=AnyCPU;OutDir="%~dp0\..\..\..\..\bin\\"
It appears to do the job, although I am not sure what side-effects I should be aware of. My main concern is that the binaries from this build go into the same directory as the binaries from the Cloud Service build - is there perhaps some possibility of conflict here?

Resources