Tfs build stuck in build queue - tfs

I accidentally deleted a build definition and did not realize that it was being used in the queue. When I try to cancel it an error shows: 404 Requested build 650 not found.
Is There a way to fix this without access to the server?

I found that you can navigate to the agent pool right click and select update. The Queue automatically canceled the stuck build after i did this.

Related

Cannot abandon a release on TFS2017 as one or more of the environments are in-progress

I want to abandon a release that is running multiple environments at the same time, but with every try on the Abandon option I am getting this error
Cannot abandon release 'Release-#' as one or more of the environments
are in-progress.
Each environment changes it own status after the release creation and you have to go and cancel it mannually. In order to abandon the release, each one needs to be canceled.
Then you can try to abandon the release.
Now trying to restart the agents on the server is the final step that we can try, there is another workaround, must of the time those agents have a process running on the server that is consuming the CPU's time, see which is the task that is running and kill it, automatically you will see how the steps on the release start failing, but you should try to avoid this way.
Now there is something that I want to add on the later. You can see after you kill a task that the agent can be in an inconsistent state, go to the services and see VSTS Agent service that runs the task, if it is not running, feel free to start it again.
According to the error info, since you are running multiple environments of your release. You need to abandon a status completed release either passed, canceled or a failed release.
Please just waiting for sometime and try the abandon action again. If you still get the same error info, check if a release has stuck In Progress. And check if the build which trigger the release stuck. You restart the build agent in this case.

How to make a specific job wait for a slave indefinitely?

Problem :
A certain task often crashes the slave, which then should reboot (sometimes it doesn't). If the reboot fails, it may take a week until someone reboots the computer. Then the build which failed couldn't archive the artifacts.
Idea to solve it (if there is a better one please tell me) :
To have a task always launch after this one which checks if the artifacts failed to be made (I have a way to check it), and then wait forever until the slave becomes available again, to archive the artifacts.
I know it's possible to do such for every job, but I cannot find how to do it for a specific job.
The best solution is to actually fix what crashes your server.
But for now you can add another job:
In Jenkins create a "New Item".
Make this a freestyle project.
In the "Build Trigger" section, select "Build after other projects are built".
Here you select the other job that causes the slave to crash.
Afterwards add you monitoring-and-restart-script as a build step.

TFS Online Build Fails on local Build Server with TF270016 / TF270002

We're using Visual Studio Online, but we have local Build Controller and Build agent. This has been running fine for the past 6 months or so, but just this week the builds have consistently failed.
The software itself appears to build successfully, and the tests also seem to pass, but it fails due to an error during the publication of the log files (see error below).
The build uses an unmodified Default Template, and is setup so that it "does not copy output files to a drop folder" (in the Build Defaults of the build definition).
After a few hours of head-banging this feels like some sort of permissions thing, but I have no idea how to go about debugging, or verifying this assumption.
Can anyone offer any suggestions, or better yet, a solution! :-)
One other thing to note is that we have been mucking about with our users in Visual Studio Online to change some accounts from Basic to Stakeholder accounts in order to reduce costs. I'm wondering if we've also managed to remove a critical account or permission that has caused this...?
Error
An error occurred while copying diagnostic activity logs to the drop location.
Details: TF270002:
An error occurred copying files from
'C:\Users\tfs\AppData\Local\Temp\BuildAgent\5498\Logs\2853\LogsToCopy\ActivityLog.AgentScope.5498.xml'
to
'ActivityLog.AgentScope.5498.xml'.
Details: BadRequest: Bad Request
An error occurred while copying diagnostic activity logs to the drop location.
Details: TF270002:
An error occurred copying files from
'C:\Users\tfs\AppData\Local\Temp\BuildController\4592\Logs\2853\LogsToCopy\ActivityLog.xml'
to
'ActivityLog.xml'.
Details: BadRequest: Bad Request
Edit
One thing to note is that this error is consistent across all builds for different C# projects that are executed through the same build controller. I've tried removing and re-registering the controller, restarting the build service and the build server itself.
we are also experiencing similar issue. We have not done any changes to VSO permissions, so I doubt it is that.
Two things that coinside this:
1. There was an update to VSOnline during the same timewindow that this issue appeared
2. Our local build controllers/agents were updated with latest Patch Tuesday updates
So the solution to this (in my case anyway) was to upgrade the Build controller software to v12 (TFS 2013).

Is it possible to stop build in TFS automatically?

I'd like to be able to stop build for some build definitions programmatically.
First I thought about creating some event handler (soap service or TFS plugin) to solve this issue. But unfortunatelly it seems like there isn't appropriate event in TFS (that would be raised when build is just started).
Is there the way to solve this issue?
Thank you!
Elena
Upd:
The problem has been solved by call of cutom build task in the very first target in TFSBuild.proj
Most build monitors seem to periodically poll TFS to see if there's any new builds, this obviously won't work for you as there will be too much of a delay to cancel the build.
I suggest you modify the build template to do a web request right at the start. Or just putting the logic to cancel the build in the actual template.
May i ask why you need to cancel builds anyway? there may be a better alternative.

Why won't my 2008 Team Build trigger on developer check-ins despite CI being enabled

I have a Team Foundation Server 2008 Installation and a separate machine with the Team Build service.
I can create team builds and trigger them manually in Visual Studio or via the command line (where they complete successfully). However check ins to the source tree do not cause a build to trigger despite the option to build every check in being ticked on the build definition. Update: To be clear I had a fully working build definition with the CI option enabled.
The source tree is configured is a pretty straight forward manner with code either under a Main folder or under a Branch\branchName folder. Each branch of code (including main) has a standard Team Build definition relating to the solution file contained within. The only thing that is slightly changed from default settings is that the build server working folder; i.e. for main this is Server:"$\main" Local:"c:\build\main" due to path length.
The only thing I've been able to guess at (possible red herring) is that there might be some oddity with the developer workspaces. Currently each developer maps Server:"$\" to local:"c:\tfs\" so that there is only one workspace for all branches. This is mainly to avoid re-mapping problems that some of the developers had previously gotten themselves into. But I can't see how this would affect CI.
UPDATE: Ifound the answer indirectly; please read below
Ok I have found the answer myself after several dead ends. In the end I fixed this unintentionally while fixing another issue. Basically we had just turned on the automatic execution of unit tests for our builds. The test would run sucessfully but then immediately the build would bomb out with a message saying it was unable to report to the build drop folder.
What was happening was that while the Build service runs under one account and has a set of rights; some of the functionality is actually driven through the TFSService account. fter wading a heap of permissions I had my tests being reported. Then I noticed that builds had started to trigger on check-ins; I can't tell you exactly which permission fixed this but hopefully this answer will at least set people down the right path.
One other note a few of the builds started failing due to conflicting workspace mappings - this was a separate issue that I resolved by deleting some obsolete workspaces using the Attrice Sidekicks for Team Foundation tool.
Hope this helps somebody else.
Select your team project from team explorer, then right click on the Builds folder. Select a new build definition and then select the trigger tab. Move the radio button to "Build each check-in (more builds)"
More info can be found here
MSDN How to: Create a Build Definition
Are there any errors in the log on the TFS application server? Anything that indicates that it tried to fire but failed?

Resources