Pausing queues in VSTS - azure-devops

We recently moved to VSTS from TFS. One feature we often used is to pause queues whenever required. It was quite useful to prevent build failures in gated check in’s for known environment issues. Ex: specific tests or external dependencies failures or resources issues etc.,
I don’t see an option on how to pause a definition in VSTS. Wondering if anyone has suggestions or work arounds ?

There is the button of Cancel that can cancel the building.
You also can cancel the building through REST API: Update a build.
PATCH https://{instance}/DefaultCollection/{project}/_apis/build/builds/{buildId}?api-version={version}
Content-type (application/json)
{
"status":"cancelling"
}

You can pause any build step in your definition.
Puase task
If you want to pause entire definition then you can pause all the build steps.

Now in VSTS you can Pause a build definition from the Brelease/Build menu. Select the defnition you want to Pause and click on the [...] on the right of it, then click on Pause:

Related

Disable activity in Azure Data factory pipeline without removing it

So I am testing each of the activities of the pipeline and I want to disable some of the activities in it. Essentially there is an activity of sending emails which I want to disable as I wanted to see the output of prior activities.
Offcourse I dont want to remove the email sending activity because it is in the prod environment and not developed by me.
Is there any way to disable it?
You cannot disable one, but what you want to do is possible with the debug option in the editor. Just click on the red circle above any activity and run the debugger, it will run until that activity is complete and stop, allowing you to see the output of those prior to that.
Hope this helped!
This builds on Martin Esteban Zurita's answer, if you need to prevent activities from the beginning or from within the middle of your pipeline running, without deleting them altogether:
You can temporarily change the order of the activities and make the ones you want to disable run at the end of the pipeline instead, (closing any gaps you may have created), then click the last activity you do want to run and click the breakpoint circle icon to prevent the "disabled" activities from running.
Then reinstate the order after testing/debugging.
You could disable the trigger or delay the trigger execution to some date in the future.
I usually copy the activities to another temp pipeline, make your desired debugging and recompose the pipeline in the end if applicable.
Or you can clone the pipeline, delete the desired components and debug it.
Just remove from your dataset and add them again. ;-)

VSTS Build variable on Pull Request

I'm currently using AppCenter to Test my Xamarin app. The complete suite is being run at night. But I'm currently looking for a way to make this part of my CI builds to introduce an extra quality gate before features get merged.
However, we would need to slim down the amount of tests that need to be run otherwise this would become unmanageable. For this we can specify categories on our App Center test build step. When queued manually I'm able to specify the categories, however when we make this CI Build part of a branch policy and use a manual trigger for our build validation we are unable to specify the categories as we don't get the popup when queuing.
Any suggestions on how to adres this issue differently?
Seems you want to set build variables in pull requests when you queue the build under policies.
Unfortunately, this could not be achieved by now. It will not pop up the dialog when you queue the build. There has been a related uservoice, you could vote up and follow it, TFS PM will kindly review your suggestion.
Allow Setting Build Variables in Pull Requests
https://developercommunity.visualstudio.com/idea/365725/allow-setting-build-variables-in-pull-requests.html
The only workaround for now is editing the build definitions and add the variable under variables directly, then queue again. You could clone the original build definition first.

Is it possible to check in VSTS was build stated manually or not?

I'm trying to execute a bit different build steps in VSTS based on type how build was started: automatically or manually.
I'm especially interested in accessing that information from powershell script. But so far was not able to find suitable solution or workaround.
Did someone faced similar requirement before? How did you solved it? I would appreciate your help!
Seems you want to know whether the project build is happening through TFS triggered build or manually triggered build.
There is no such feature for vnext build for now. About this , you could submit your uservoice to this link, TFS Product Team is listening to your voice there.
As a workaround either to use two build definitions through different version patterns or manually add a specifical tag after a manually build finished. Through using tags to set some labels on the build to distinguish manual and automatic builds. But this is a manual action, it would be better if we can do this automatically.
It seems to be I've managed to find an option that allows to determine wherever build was triggered automatically or manually.
All builds started manually have actual user in $Env:BUILD_QUEUEDBY variable, while automatic builds have system account there. My value was [********]\Project Collection Service Accounts.
I don't know how reliable it is, but for me so far following code did the job:
# Identifying who triggered the build
$OwnerId = $Env:BUILD_QUEUEDBY;
$OwnerId = $OwnerId.ToUpper();
if ($OwnerId.EndsWith("PROJECT COLLECTION SERVICE ACCOUNTS"))
{
Write-Host "Build was triggered automatically. Resulting files considered 'BETA'"
}
else
{
Write-Host "Build was triggered manually. Resulting files considered 'STABLE'"
}

How to exclude particular user for schdule trigger in ccnet while IfModificationExists is true including it and false excluding it with TFS.

I have situation where my project checkin some changes during build. I also have scheduled trigger for build whenever there is change in modifications in TFS/VSTS source control. My problem is that, it automatically scheduled triggers build because of changes made during last build Hence, I am unable to achieve what I want to achieve. I want to make sure build is triggered when there is changes for scheduled build by development team and not my own build. Any idea how can i exclude myself while CCNET is detecting changesin TFS/VSTS source control?
What file or files are being modified and checked in by the build server? If the checkins are being made to a single location, you can limit the areas that ccnet monitors. You may need to use the Multi Source Control Block.
Use the Filtered Source Control Block which is specifically designed for that purpose

How can a Jenkins build differentiate between a SCM-triggered, and a user-requested build?

I would like my builds to behave differently (a handling script needs to know) if a person requested the build through the UI "build now" button, or if it was triggered by SCM. I don't want to have to provide a checkbox in the UI that the users have to alter - I've already gotten blowback from them about such things. Trouble is, any parameter I set has the same default regardless of how the build is triggered.
You should not really have 1 job with different behaviour. If you need different behaviour set up a job per behaviour. Best bet in your case is to have 2 separate jobs, one for the SCM triggered builds, and one for the manually triggered builds.
There's a plugin to allow you to filter jobs into separate pages (can't remember the name at the moment). You could set all SCM builds on 1 page and manual builds on another, then set the manual build page as the default one on login. Users will only see the jobs you want triggered manually by default, but can still access the SCM triggered builds by selecting the other page.
Could you somehow check the SCM polling log during the pre-build (with a script), and then go from there?