How to use ultimate thread group plugin in JMeter, which is executed from an Azure Devops pipeline? - azure-devops

I have an ADO pipeline which starts a JMeter script execution on a VM(load-generator) using a Command Line task. Following is the command line statement -
C:\JMeter\apache-jmeter-5.2.1\bin\jmeter -n -f -t "$(Build.SourcesDirectory)\JMeterTestScripts\$(Module)\$(TestName).jmx" -l "$(Build.ArtifactStagingDirectory)\$(TestName).jtl"
I am using the ultimate thread group for one of my test scripts.
The JMeter executable folder on the VM has all the necessary plugin-related JARs present in the lib/ext folder. But for some reason while trying to run this pipeline, it throws the following error-
*An error occurred: Error in NonGUIDriver Problem loading XML from:'C:\agent\_work\1\s\Jmeter_Script_Folder\ScriptName.jmx Cause:
CannotResolveClassException: kg.apc.jmeter.threads.UltimateThreadGroup*
However, when I try to execute the same command from the VM (load generator) manually using the windows cmd, then it successfully triggers the test execution.
Any idea, what possibly could be causing this odd behaviour? Any pointers on this is much appreciated.

Related

Latexmk exit code 12 in Azure Devops

I'm trying to run a test script in an azure devops pipeline. I have a test that runs on my own environment but fails in the pipeline.
when I run the following code:
command = '['latexmk', '-pdf', '--interaction=nonstopmode', '/tmp/my_tex.tex']'
output = subprocess.check_output(command,
stderr=subprocess.STDOUT,
**check_output_kwargs)
Locally it finishes without errors. When I run it in the DevOps pipeline I get:
subprocess.CalledProcessError:
Command '['latexmk', '-pdf', '--interaction=nonstopmode', '/tmp/tmp78wpkv3l/Unknown.tex']'
returned non-zero exit status 12.
Which isn't very descriptive. Does anybody know how to solve this or get more descriptive error messages?
The problem was that latexmk was being run in the wrong folder, fixed with a simple os.chdir(<correct folder>)

Start-Process : The system cannot find the file specified from TeamCity Build step but works fine locally

i am trying to run Pact broker can i deploy tool with paramaters which is working fine locally but when i add the build step in TeamCity it is throwing below error
Start-Process : This command cannot be run due to the error: The
system cannot find the file specified.
when i run the same powershell script locally, it is working fine .
powershell script:
CanIDeploy.bat code is
Note: the reason i am calling pact-broker.bat from power shell script is, unable to run bat file from Teamcity , that is the reason created powershell script which internally calls pact broker bat file.
any help is appreciated
I see that you use relative path, but what about the working directory? I see a different path in the error message vs what you show where the file is.

Bamboo Powershell Task fails after first run

I'm completely new to Bamboo, so thank you in advance for the help.
I'm trying to create a Bamboo Run that zips files from a git repo and uploads it to Artifactory. Currently my build contains 2 tasks - source code checkout and a simple powershell script. The first time I run it it builds perfectly fine, but without any modifications any consecutive runs fail.
The error I'm getting in the log is the following:
Failing task since return code of [powershell -ExecutionPolicy bypass -Command /bin/sh /opt/bamboo/agent/temp/OR-J8U-JOB1-4-ScriptBuildTask-539645121146088515.ps1] was -1 while expected 0
Replacing the powershell script with empty space does not resolve the issue - only removing the script completely allows the build to succeed, but I cannot reinsert a new script or it will fail. I read other online questions suggesting that I "merge the user-level PATH environment information in to the system-level PATH" but I cannot find the user-level environment information, my environmental variables section is completely empty.
Like Vlad, I found that it was more efficient to implement my powershell script with batch.

VSTS build definition - prevent PowerShell exit behavior causing processes termination

I have a PowerShell task in my definition that calls another script file on its own which takes care of running several things on my build agent (starts several different processes) - emulators, node.js applications, etc.
Everything is fine up until the moment this step is done and the run continues. All of the above mentioned stuff gets closed with most of the underlying processes killed, thus, any further execution (e.g. tests run) is doomed to fail.
My assumption is that these processes are somehow dependent on the outermost (temporary) script that VSTS generates to process the step.
I tried with the -NoExit switch specified in the arguments list of my script, but to no avail. I've also read somewhere a suggestion to set this by default with a registry key for powershell.exe - still nothing.
The very same workflow was okay in Jenkins. How can I fix this?
These are the tasks I have:
The last PowerShell task calls a specified PowerShell file which calls several others on its own. They ensure some local dependencies and processes needed to start executing the tests, e.g. a running Node.js application (started in a separate console for example and running fine).
When the task is done and it is successful, the last one with the tests would fail because the Node.js application has been shut down as well as anything else that was started within the previous step. It just stops everything. That's why I'm currently running the tests within the same task itself until I find out how to overcome this behavior.
I am not sure how you call the dependencies and applications in your PowerShell script. But I tried with the following command in PowerShell script task to run a Node.js application:
invoke-expression 'cmd /c start powershell -Command {node main.js}'
The application keeps running after the PowerShell script task is passed and finished which should meet your requirement. Refer to this question for details: PowerShell launch script in new instance.
But you need to remember to close the process after the test is finished.
There is the Continue on error option (Control Options section). The build process will be continued if it is true (checked), but the build result will be partially succeeded.
You also can output the error or warning by using PowerShell or VSTS task commands (uncheck Fail on Standard Error option in the Advanced section) and terminate the current PowerShell process by using the exit keyword, for example:
Write-Warning “warning”
Write-Error “error”
Write-Host " ##vso[task.logissue type=warning;]this is the warning"
Write-Host " ##vso[task.logissue type=error;sourcepath=consoleapp/main.cs;linenumber=1;columnnumber=1;code=100;]this is an error "
More information about the VSTS task command, you can refer to: Logging Commands

Azure Powershell VSO agent task not failing for non-zero exit code

When putting together a release definition in VSO, adding an Azure PowerShell
task
backed by a file Script1.ps only containing exit 1 does not fail the step when it runs - which I would expect it to do, given that the Continue on error box is not checked
If I add the PowerShell task, writing exit 1 using the inline variant would indeed fail the step. This also comes with an 'advanced configuration option' where the Fail on Standard Error is checked by default.
What did I miss? How would I go about making the Azure Powershell fail in the same manner?
Using this code instead:
[Environment]::Exit(1)
The task will fail if the script throws an exception or writes to stderr stream.