Jenkins: Windows build re-started elevated breaks with "Build already in progress" - windows

In Jenkins, I have in a function that has
powershell '& "C:\\Program Files\\VisBuildPro9\\VisBuildCmd.exe" /logfile myLogFile /nologo myBuildFile.bld'
This used to work fine until factors beyond my control caused this script to have to restart elevated. Jenkins output:
3/10/2022 9:38:06 AM: Starting Build: myBuildFile.bld
3/10/2022 9:38:06 AM: Building project step 'myBuildFile.bld' was restarted elevated'...
Pausing 3 seconds...
Error building application: Build already in progress.
Now if I run myBuildFile.bld in the Windows system that is the Jenkins agent, Visual Build Professional does something similar, spawning a second (elevated) VBP which runs the build without complaining that a build is already in progress.
How can I get past the "Build already in progress" block in my Jenkins script?

Related

Jenkins Agent can't reconnect

I've been attempting to setup a Windows agent for our Jenkins on Linux to use. Mostly using the instructions from https://www.gdcorner.com/2019/12/30/JenkinsHomeLab-P3-WindowsAgents.html
Only mostly, as those (like EVERY OTHER SET I've found) don't match the current Jenkins screens.)
I got to the point where I ran the curl/java -jar commands on the Agent machine in an Administrator Command window.
It worked, and connected to Jenkins, showed up as running. Though this means it was still running as a normal program in a command window.
While attempting to figure out what was meant by "Click the Launch agent from browser. " - which showed a small window that should then be displayed - which would allow you to install it as a service, I closed the Command window.
I never figured out how to "click the launch agent from browser", so I opened a new admin command window and re-ran the commands. They no longer work. It gets this error every time: (note that "WinDInstaller" is really "Win%2DInstaller")
Sep 28, 2022 10:15:40 AM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
INFO: Using C:\Enterprise\Agent\remoting as a remoting work directory
Sep 28, 2022 10:15:40 AM org.jenkinsci.remoting.engine.WorkDirManager setupLogging
INFO: Both error and output logs will be printed to C:\Enterprise\Agent\remoting
Failed to obtain http://metrixbld1:8080/computer/WinDInstaller/jenkins-agent.jnlp?encrypt=true
java.io.IOException: Failed to load http://metrixbld1:8080/computer/WinDInstaller/jenkins-agent.jnlp?encrypt=true: 404 Not Found
at hudson.remoting.Launcher.parseJnlpArguments(Launcher.java:514)
at hudson.remoting.Launcher.run(Launcher.java:346)
at hudson.remoting.Launcher.main(Launcher.java:297)
Waiting 10 seconds before retry
It seems like it should be possible to get an Agent running on windows as a Service - but so far I've not found a set of instructions that work.
EDIT: Since that agent definition no longer worked, I created a new one and had it just copy the settings from the old one.
Then ran the new java/agent command - and it worked.
Apparently you can only launch a new agent once. If it ever stops you have to re-create it????

TFS build giving error - The active Test Run was aborted because the execution process exited unexpectedly

We are using Visual Studio 2019 and TFS server 2015.
TFS build is giving below error:
Error: The active Test Run was aborted because the execution process exited unexpectedly. The test execution process crashed while running the tests. To investigate further, open file:///C:/Users/username/AppData/Local/CrashDumps/TE.ProcessHost.Managed.exe.11108.dmp file in Visual Studio and choose "Debug in mixed mode".
##[error]VSTest Test Run failed with exit code: 1
##[error] at Microsoft.TeamFoundation.DistributedTask.Task.Internal.PowerShell.InvokeVSTestCmdlet.ProcessRecord()
##[error] at System.Management.Automation.CommandProcessor.ProcessRecord()
If we uncheck Code coverage enable checkbox, then build gets successful, its failing when we enable that check box.
Observation: Recently on server, Visual Studio Build Tools 2022 (17.2.5) got updated. After that TFS builds not working.
Please someone help to solve this issue.

Setup Bootstrap for Visual Basic Setup Toolkit - EXE - silent installation (VB6)

We have an old application which uses has it's executable (EXE) build on VB6 (Setup Bootstrap for Visual Basic Setup Toolkit ). We are trying to silently install the setup by and running it in a scheduled manner using task scheduler.
Command use : Start-Process -FilePath "D:\SETUPXXX.EXE" -Verb runAs -ArgumentList "/qn"
While running this stand alone from a power shell console or command line the setup executes and shows up on the screen , completes installation and goes off(without clicking anything). This installs is successfully.
But wherever we are trying to schedule this on a task scheduler it doesn't pop up anything and neither it installs the application.
We tried other ways "setupxxx.exe /sc:\setup.log" but the results are same it works when executed from command line and pops up the installation completes but fails to do the same when scheduled or run as a batch file.
Is there a way to stop the installer popup coming which might be stopping the instillation while running.
Refer :https://theether.net/kb/100165

How to properly stop running dotnet core web application?

In Visual Studio 2017 and 2019 on Windows, I run dotnet watch run in the Package Manager Console. It launched kestrel for a dotnet core app, automatically disabled text edit in the console, and displayed a red button to stop command execution, but the button doesn't do anything. Also, the message is being displayed to use Ctrl+C but it doesn't work either.
Now listening on: http://localhost:20436 Application started. Press Ctrl+C to shut down.
Now there is an error when I try to launch the web app in Visual Studio because it is already running.
I couldn't find a command like dotnet stop only Ctrl+C which doesn't work in this case. I used Process Hacker to kill the dotnet.exe process but that doesn't seem right. What would be the best way to kill the running process?
Since this stop option doesn't work it is clearly a bug. If I need to run dotnet watch run I generally just open command line on my current folder outside VS and run it from there. Since dotnet watch run has nothing to do with visual studio (no debugging) it makes sense. Alternatively, you can use the green button to run within visual studio with debugger. However, this would mean you can't edit the code while testing.
run your project:
dotnet run > Examplelog.log &
$ dotnet run > Examplelog.log &
[1] 162
end your project:
kill 162
$ kill 162
[1]+ Exit 127 dotnet run > Examplelog.log
So with kill[id] you can end your process.
you not need a second console and can use your console for other inputs (take note that all outputs will be stored inside the Examplelog.log-File you have to check)^^lg
when the service is already running just again apply build command "dotnet build" and then again run command apply like "dotnet run"
services will be up again then you just have to press Ctrl+c in the terminal to shutdown running services.
There is a red button next to the clear button in that section next to the project name. I just found it LOL I will show you a picture follow the yellow circle. I was trying ctrl+c too LOL

TeamCity configuration for BrowserStack tests

In TeamCity, I'm setting up "command line" runner type. My aim is to run the commandline script in the window & let it run. Then go to next build step without closing the command line window which is opened in the previous step. In my last build step, I want to close the command line window which is still open during the initial build step.
Above scenario is based on my build steps while configuring 'BrowserStack" tests project. I want to execute BrowserStackLocal.cmd in my 'Command Line' runner type step & let it run. Then go to next build step in which i have all my tests. Finally in the last build step, I want to close the command line window after completing the tests.
Currently the build step doesn't know what to do after executing 'start BrowserStackLocal.exe -force' as it will be waiting for a reply code.
Any ideas on how to move to the next build step?
As pointed out by Alina you need to setup a 'Command Line' build step for launching BrowserStackLocal in background before running the tests. The config can be like:
Runner Type = Command Line
Run = Custom Script
Using 'advanced options' set Working directory where BrowserStackLocal is present if it differs from the checkout directory.
Custom Script samples:
For Linux/Mac
#!/bin/bash
./BrowserStackLocal <BrowserStack Key> -force &
For Windows
start /B BrowserStackLocal.exe <BrowserStack Key> -force
You can put a wait to allow the BrowserStackLocal process to start before moving to the next build step in your Team City project. Also, you can set up a post build action to kill the running BrowserStackLocal processes.
Had the same issue recently, starting the binary as a daemon will continue to the next build step.
Open connection:
browserstacklocal.exe --key %system.BrowserStackKey% --local-identifier %system.BrowserStackLocalIdentifier% --force --daemon start
Close connection:
browserstacklocal.exe --local-identifier %system.BrowserStackLocalIdentifier% --daemon stop
you just have to press ALT and TAB
If 'BrowserStack' has an appropriate start-stop commands then you can use them (for example like Tomcat). If not then you can start 'BrowserStack' in background, then run tests and then kill it using the following command option:
-force - kill other running instances of BrowserStack Local

Resources