CCNet Trigger different Tasks - cruisecontrol.net

I would like to have two (or more) different triggers for different tasks in one project. Is this possible?
For example:
A interval Trigger to build my project ones an hour and a scheduled trigger to perform my unit test once every day.
I'm using the latest version of CCNet with MSBuild and MSTest.

Okay, I solved it by myself and did it in two projects in the ccnet.config.
Each project has its own trigger and performs one task (build or unit test).

Related

Self hosted azure agent - how to configure pipelines to share the same build folder

We have a self-hosted build agent on an on-prem server.
We typically have a large codebase, and in the past followed this mechanism with TFS2013 build agents:
Daily check-ins were built to c:\work\tfs\ (taking about 5 minutes)
Each night a batch file would run that did the same build to those folders, using the same sources (they were already 'latest' from the CI build), and build the installers. Copy files to a network location, and send an email to the team detailing the build success/failures. (Taking about 40 minutes)
The key thing there is that for the nightly build there would be no need to get the latest sources, and the disk space required wouldn't grow much. Just by the installer sizes.
To replicate this with Azure Devops, I created two pipelines.
One pipeline that did the CI using MSBuild tasks in the classic editor- works great
Another pipeline in the classic editor that runs our existing powershell script, scheduled at 9pm - works great
However, even though my agent doesn't support parallel builds what's happening is that:
The CI pipeline's folder is c:\work\1\
The Nightly build folder is c:\work\2\
This doubles the amount of disk space we need (10gb to 20gb)
They are the same code files, just built differently.
I have struggled to find a way to say to the agent "please use the same sources folder for all pipelines"
What setting is this, as we have to pay our service provider for extra GB storage otherwise.
Or do I need to change my classic pipelines into Yaml and somehow conditionally branch the build so it knows it's being scheduled and do something different?
Or maybe, stop using a Pipeline for the scheduled build, and use task scheduler in Windows as before?
(I did try looking for the same question - I'm sure I can't be the only one).
There is "workingDirectory" directive available for running scripts in pipeline. This link has details of this - https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/command-line?view=azure-devops&tabs=yaml
The number '1' '2'...'6' of work folder c:\work\1\, c:\work\2\... c:\work\6\ in your build agent which stands for a particular pipeline.
Agent.BuildDirectory
The local path on the agent where all folders for a given build
pipeline are created. This variable has the same value as
Pipeline.Workspace. For example: /home/vsts/work/1
If you have two pipelines, there will also be two corresponding work folders. It's an except behavior. We could not configure pipelines to share the same build folde. This is by designed.
If you need to use less disk space to save cost, afraid stop using a Pipeline for the scheduled build, and use task scheduler in Windows as before is a better way.

How to Run Azure Pipeline Builds Sequentially

I have created an Azure build pipeline using the 'classic editor' (i.e. not yaml). The build consists of two agent jobs:
Job 1 - Build code and deploy to test enviornment using a single agent.
Job 2 - Run tests against the test enviornment in parallel (using max 3 agents at a time).
My problem with this setup is if a build is triggered, and the tests are mid-run, if a second build is triggered, the code that is deployed to the test enviornment will be overwritten by the subsequent build, causing the test run in Job 2 of the first build to fail.
Is it possible to tell the build pipeline to only trigger builds sequentially?
I have figured out how to use Azure DevOps API to check if the latest build has completed, however Im not sure how I can use it in the pipeline. Is it possible to do something like:
1 - Invote REST API to check status of latest build.
2 - Success Criteria met (i.e. the build has completed)? If yes continue build, if not wait a minute and check again.
You have the option to control this in the Build options. Should work based on what you described.
Edit:
After looking again to your question, i noticed that you are running your tests after you deploy your app to test environment, so it means you run your tests during release, so you need to control the flow on your release and not on your buid. In order to do it, you should control on the maximum number of parallel deployments:

Triggering multiple builds within a build

I have a pipeline build for a .NET application called Master Site and then I have three other build definitions using different repos. Every time I have to do a build of the Master site and then the subsequent build. I need to know if we can do multiple builds by triggering a single build request. (all the builds are built off of different repos)
I need to know if we can do multiple builds by triggering a single
build request.
For this issue,the answer is yes. You can do this by adding multiple Trigger Build Tasks to the agent job in a build pipeline .
This tasks allows to trigger a new Build (add it to the queue) as part of a Build Definition.

In GitLab is it possible to configure a Scheduled Pipeline that runs on all branches periodically?

I am using GitLab for Git version control and GitLab CI / CD for my automated builds. Usually, the builds are triggered by Git repository activity but I also have a weekly build to ensure that projects not under active development continue to work. When there is only a "master" branch on a project, it is easy to ensure a weekly build is run on the latest code. When there are multiple branches in a project, I would like to repeat the pipeline work for each of them in turn.
What I would like to be able to do is schedule a build (weekly, fortnightly or monthly) that runs on all current branches visible in Git. Is that possible within GitLab's Continuous Delivery system?
The motivation behind doing this is to ensure that external activity, such as tool and library updates, do not introduce an issue without it being promptly visible. Assuming there are reasonable automated testing, coverage and comprehensive builds for target platforms, a monthly build with the latest tools should highlight the problem promptly. This is better than an invisible mountain to problems accumulating while a project is shelved for a few years (or months). Sometimes all that is required is occasional maintenance.
There are only a handful of feature branches and release lines on the projects currently. I would not expect that number to grow significantly. There is time enough over a weekend to run the required pipelines dozens if not hundreds of times at present.
Ideally, I would like something straightforward to set up. I cannot see anything in the admin GUI that would allow this at present. I did look at the API and I can see there is some scope there to script the addition and removal. Perhaps some script that is run once a month to create new Scheduled pipelines based on git branches is the only way. A pre-made solution on those lines would be perfectly acceptable. If nothing exists I might start work on something like that in time.
I am currently running GitLab Community Edition 11.2.3 06cbee3 (GitLab CE 11.2.3). If there is an Enterprise Edition only answer, that is fine and will add to the justifications of purchasing the EE version. I would pick at CE one above the EE one though.
You cannot set a schedule for all branches at once, you have to configure one schedule per branch yourself.
Perhaps some script that is run once a month to create new Scheduled
pipelines based on git branches is the only way.
I would go in that way.

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.

Resources