I've got a VSTS build that is trying to deploy a test agent so I can run some Selenium tests and when I get to the "Deploy TestAgent on" build step, I am getting the following error:
2017-06-22T14:29:05.6157972Z ##[warning]Task 'DownloadTestAgent' for
machine vmtest43xxx.cloudapp.net:5986's Error : System.Exception: The
process cannot access the file 'C:\TestAgent\vstf_testagent.exe'
because it is being used by another process.
Also, if setting up a local build agent is a good workaround for this, I'm all ears, but so far I have had a lot of trouble trying to set up a local test agent. This seems weird since setting up a local build agent was relatively easy up to this point. Any suggestions on how I should set up a local agent? I've been trying to follow instructions from here and here.
Thanks!
It’s easy to setup a local build agent, so try to setup a build agent:
Steps for windows:
Go to Admin page of Agent Pools (https://[account].visualstudio.com/_admin/_AgentPool)
Click Download agent button
Unzip the downloaded file
Run Command Line as Administrator
Run config.cmd
Specify collection url (https://[account].visualstudio.com), Personal Access Token etc
More information, you can refer to: Deploy an agent on Windows.
You can specify Test Agent Location (can be access from build agent machine) for Visual Studio Test Agent Deployment task to save time.
Related
I set up my Selenium project (Maven, Java, TestNG) in GitHub repo and it is connected to Jenkins. I am able to execute the Maven project via Jenkins and do the testing. This requires all dependant tools (Maven,Java,Jenkins) set up in my local machine.
But we have a requirement to do this in the cloud. I know we can use Selenium Grid-Docker, BrowserStack or GCP to execute the tests in the cloud but what we need is to have everything installed in the cloud and any external user with access being able to execute any test via UI or executable file without installing anything in user's local machine.
Is this possible at all? If yes,how?
I searched a lot and couldn't find anything. One of my friends said it can be done using AWS but doesn't know how. I just need guidance on the path to take here and I'm willing to learn and implement it myself.
Solved this my deploying code to AWS-EC2.
Here's what I did.
I created a TestNG-Maven project and uploaded to GitHub. Then created a AWS-EC2 t2.micro linux instance and installed Chrome and Jenkins in it. I accessed Jenkins from my local machine and connected it to GitHub repo. From Jenkins when I build the project everything was getting downloaded in EC2 and execution happened in EC2. This will be chrome-headless execution.
We have a UWP app with unit tests that run fine from Visual Studio. However, we are running into issues when trying to run the tests on our build agent. To isolate the issue from our build pipeline, we have tried to run the tests using vstest.console.exe from the command line on our local build machine. The error below is the same regardless of whether we run from the build pipeline or from the command line. We would appreciate any guidance.
TestWindow>vstest.console.exe /Platform:x86 /Framework:FrameworkUap10
/InIsolation /logger:trx;LogFileName=%temp%\SampleUwpAppTest.trx
C:\vsts-agent_work\22\a\AppxPackages\SimpleUwpApp.Tests_1.0.0.0_x86_Test\SimpleUwpApp.Tests_1.0.0.0_x86.appx
Microsoft (R) Test Execution Command Line Tool Version 15.7.2
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait... Attempting to deploy to target
'Local Machine'. Deployment operation succeeded, package moniker:
'7d25c824-2568-4449-a622-ad28662417f9_1.0.0.0_x86__a178p9x51fw8a'.
Attempting to launch app with app user model Id
'7d25c824-2568-4449-a622-ad28662417f9_a178p9x51fw8a!vstest.executionengine.universal.App' and arguments '--port 1428 --endpoint 127.0.0.1:01428 --role client
--parentprocessid 5744 --telemetryoptedin false'. DEP7100: Failed to activate app
'7d25c824-2568-4449-a622-ad28662417f9_a178p9x51fw8a!vstest.executionengine.universal.App' with parameters '--port 1428 --endpoint 127.0.0.1:01428 --role client
--parentprocessid 5744 --telemetryoptedin false'. Access is denied.
Access is denied.
App activation failed.
Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException:
Failed to initialize client proxy: could not connect to test process.
at
Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable`1
sources) at
Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyExecutionManager.StartTestRun(TestRunCriteria
testRunCriteria, ITestRunEventsHandler eventHandler) Closing app with
package full name
'7d25c824-2568-4449-a622-ad28662417f9_1.0.0.0_x86__a178p9x51fw8a'.
Test Run Aborted.
Build Information
Our sample solution has two projects: SimpleUwpApp and SimpleUwpApp.Tests. The former's project file has <AppxBundle>Always</AppxBundle> and the latter has <AppxBundle>Never</AppxBundle>. The build agent is a local Windows 10 machine which we have used for UWP builds for a while. Here is a screenshot of our build configuration in Azure DevOps:
You might see this error if developer mode is not enabled on the build agent.
You can enable developer mode in the Settings app, or set the AllowDevelopmentWithoutDevLicense registry key.
I ran across this issue today and eventually traced it to the way in which our Self-Hosted Azure DevOps agent was running - in order to run UWP Unit Tests you have to use Interactive mode for the Agent and not run it as a Windows Service. From the docs:
Visible UI testing using self-hosted Windows agents
Agents that are configured to run as service can run Selenium tests only with headless browsers. If you are not using a headless browser, or if you are running UI tests for desktop apps, Windows agents must be configured to run as an interactive process with auto-logon enabled.
After making this change I found the error went away.
Hi I am Teamcity Developer.
Now i Have a task to move Teamcity instance to another server.
So far i moved the instance to another one but i am having a problem with running the builds.
You can see below the builds are in incompatible agents.
SNapshot of my builds in Build agent
Please can anyone suggest the way to get builds run on time.
Your JDK does not seems to be recognized.
You should ensure it has been properly installed on every targeted agent.
To visualize your environment settings, you can click on your agent, Agent Parameters and Environment Variable tab.
Inside the C:\BuildAgent\conf\buildAgent.properties file you can declare new variables, like :
env.JDK_18=C:\Program Files (x86)\Java\jdk1.8.xxx\
And, once it has been done, restart your TeamCity Agent Service.
I am working on a project where we are delay signing the assemblies. I need to use the strong name tool a couple times during the build, to turn off strong name verification, and then to fully sign the assemblies before they are packaged. I attempted to use a powershell step to turn off verification, but it came back with this error:
Script:
$testprojs = gci Project.*.dll -r
$testprojs | % {
sn -Vr $_
write-output $("Turned off sn verification for " + $_.Name)
}
Error:
Failed to open registry key -- Administrator permissions are needed to use
the selected options. Use an administrator command prompt to complete these tasks.
So I created a script that would run the first one, but added the -elevated parameter. This made no difference.
I also tried using a command prompt step instead of powershell. This also returned the same error.
For /r %g in ("Project.*.dll") DO sn -Vr %g
When I tried running this same script rdp'd to the build agent machine itself, it works as intended. It's only when it runs as a step in the build does it not work.
Any ideas?
According to your description:
When I tried running this same script rdp'd to the build agent machine
itself, it works as intended.
I assume you are using your own build agent for build. Then this may caused by the build agent isn't running with an administrator account. Please update your build agent to run with administrator account and then try again.
Run the agent Run as a service
If you deployed the agent to run as a Windows service, then the agent
running status can be controlled from the Services snap-in. Run
services.msc and look for "VSO Agent ()". If you
need to change the logon account, don't do it from the services
snap-in. Instead, From an elevated Command Prompt, run:
C:\Agent\Agent\VsoAgent.exe /ChangeWindowsServiceAccount Run
interactively
Otherwise if you installed the agent to run interactively, the agent
can be started by launching Agent\VsoAgent.exe.
Refer to this link for details: Run the agent
We are using jenkins for CI. we get late night builds. Is there any way to automate the build deploy as soon as we get a mail or intimation ? Any suggestions would be appreciated..
One mechanism to deploy off of a build on Jenkins is to use artifacts to place the latest binary in a known location, and then kick off a new job (only on success of the compile/test phase) which uses (private key protected) ssh or scp to copy the artifacts to the test/production machine and then perform the install.
We use a similar mechanism for some automated testing that we do. The tricky part is getting the shell command to handle the ssh keys, so we do the following:
eval `ssh-agent -s`
ssh-add ~/.ssh/your_private_key_here
As long as that private key is on the Jenkins server and the public key is on the server you're trying to push to, you can then use ssh and scp commands in the rest of the script to perform functions on the server in question.
If you prefer to run the process entirely from the target server end, you can create a small script that runs on the server that checks for new files in the artifact directory of your Jenkins server build. Thanks to the latest path, you don't have to know the build number to do this. To find the specific path, you can log in to your Jenkins server (once you've saved at least one artifact), and find the project you are using and look at the Last Successful Artifacts, which will be URLs to the last successful builds of the artifacts. These URLs remain constant and always point at the most recent successful build, so you don't have to worry about them changing unless the project name or server name changes.
NOTE: there are security holes here that you can drive a truck through if you are doing this for anything other than a deployment to test. In the case of the first mechanism, your build server has an ssh key that gives it access (potentially destructive) to the target. In the case of the second mechanism, you are trusting that the Jenkins server will only serve up binaries that are good for you. However, for test environments, push to stage, etc. these techniques will work well.
These are the ways I know:
With a script:
In the Jenkins configurations, you can execute windows/shell commands after the execution of your maven goals. In my case, I have a Glassfish on a Linux, and via ssh I execute the asadmin parameters for the deployment. I have installed an instance in the server, and the process that I follow is: stop instance, undeploy app, deploy app, start instance (commands).
With a Maven Deploy Plugin:
This plugin takes a war/ear file and deploys that to a running remote application server at the end of a build. The list of currently supported containers include:
Tomcat 4.x/5.x/6.x/7.x
JBoss 3.x/4.x
Glassfish 2.x/3.x
https://wiki.jenkins-ci.org/display/JENKINS/Deploy+Plugin
With Cargo:
The Deploy Plugin is based on this. You must edit your pom.xml and execute the goals of deploy with maven.
http://cargo.codehaus.org/
In tomcat, configuration with jenkins and tomcat:
Install and download the jenkins on your server and start the server go to jenkins portal after that create the project using 'New Item' and select the pom.xml and create the maven project.
Now go to your project and click on Configure and select the "Restrict where this project can be run" and add master in your Level Expression.
select the "Source Code Management" clisck on git and configure your git repository and credential and branch name.
Select the "Build" add Root pom : pom.xml and Goals and options : clean install -DskipTests
select the "Post-build Actions" and select the "Deploy war/ear to a container"
WAR/EAR files : target/test.war
Context path : test
Containers select tomcat and add Credentials
Tomcat URL : example : http://localhost:8080/
Update the 'apache-tomcat-8.5.5\webapps\manager\META-INF\context.xlm file. uncomment the Value tag. and restart server
context.xml file
Before :
<Context antiResourceLocking="false" privileged="true">
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="192\.168\.0\.9|127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
</Context>
After change :
<Context antiResourceLocking="false" privileged="true" >
</Context>
for auto deployment: go to 'apache-tomcat-8.5.5\conf\context.xml' and add antiResourceLocking="true" in 'Context' tag