Publishing remote test results to my Azure DevOps pipeline - azure-devops

I have a nodejs web application that I build in Azure Pipelines. I am planning to deploy the generated artifacts on a Azure VM (probably a dev test labs), as part of one of the pipeline steps.
I want to now run browser tests by pointing the browser to the hosted URL in the Azure VM. I want to use the Azure windows and linux VMs in a build pipeline to run the tests on this remote Azure VM and publish the results to the pipeline. These would be karma tests essentially running on the nodejs server.
In my current design, the test results are going to be available on the Azure VM hosting the nodejs application.
What I don't understand is how can I get these test results back to
the Azure Pipeline for publishing the same?
Is there a way I can architect this solution without having to setup my Azure VM as a
pipeline agent in Azure DevOps?
Is there a standard pattern to design such continuous test infrastructure using Azure DevOps?
Thanks

According to your description, you just want to use Microsoft host agent to access an url on your self-host agent (ignore it's Azure VM or your own physical machine, same to host agent).
It depends if that url are accessible through public internet.
The simplest solution here is deploy your build agent on that Azure VM directly. Then run build and test. You can do this through the following script and tasks:
run ng test or any command to raise your tests
publish test results with PublishTestResults task
publish code coverage results with PublishCodeCoverageResults task
Microsoft-hosted agent pool will not work for you with every scenarios. For many teams this is the simplest way to run your jobs. You can try it first and see if it works for your build or deployment. If not, you can use a self-hosted agent. Self-hosted agents give you more control for your builds, tests and deployments.
In your scenario, setup your Azure VM as a pipeline agent and run build/test on it should be the simplest and convenient solution.

Related

How to copy files from a linux agent to windows agent in Azure DevOps release pipeline?

I have to run a Linux docker image for performing testing in Azure DevOps release pipeline. Hence, I have used;
Agent Pool : Azure Pipelines and Agent Specification: ubuntu-20.04
for that task. Now, result of this test has to be send as an email. For that 'Send Email' extension in Azure DevOps marketplace can be used. But this is configured only for Windows agent.
So, there is a requirement to run two agent jobs, one for Linux and other Windows. How can I access the report file generated in first job, to send email in second.
Had tried publishing pipeline artifacts, but it didn't worked as artifacts are not supported in release.

How to integrate JMeter with Azure DevOps Pipeline when the scripts are kept in a git repository?

I have a requirement to integrate the JMeter scripts, checked-in a Git repository, with a DevOps pipeline so that I can run the JMeter scripts using a specific VM in Azure.
Basically, I should have all my jmxs and csvs in a git repository and when I run the pipeline, having a parameter of the script name, it should run the script on a specific VM (not with a static IP) and copy the jtl in some storage.
What is the best way to achieve this?
With a DevOps pipeline so that I can run the JMeter scripts using a
specific VM in Azure. What is the best way to achieve this?
If the specific VM exists before the current pipeline, you can consider installing self-hosted agent there.
To do CI/CD using Azure pipelines, we need at least one agent. If we use microsoft-hosted agent, it will provide one fresh VM for us to run jobs. Since you need to run the script in your own specific VM, I suggest using self-hosted agent. You can follow the steps here to install one agent into your own VM. (The steps are quite easy and only cost several minutes)
After making your VM a self-hosted agent, the pipeline will call your VM to run the jobs. Now your original issue turns into how to run JMeter locally with command-line. See similar issues here: Five Ways To Launch a JMeter Test without Using the JMeter GUI and Run .jmx file through command line ....
1.So now we can use a command-line task in pipeline to run the JMeter related commands shared in the similar topics above. And these jobs are done in your specific VM.
2.I'm not sure which location you want to copy the jtl to, but you can use Azure File Copy task to copy files to Microsoft Azure storage blobs or virtual machines (VMs). Or a simple copy/xcopy command in your command line task to copy files to another location in same machine. (Specific VM)
Hope all above helps :)
I have Use following Task in Azure CD pipeline.
"Run Taurus" Task is as following.
Where "_WM WebClient TestArtifacts" is git/Azure Repo directory where .jmx file kept(in Code).

how to deploy an application to a particular ubuntu server using azure-devops?

I have my code in the azure repos.I have created the release pipeline which runs the task "npm install" and "npm run start".This will deploy my application.But I want to deploy this application to my ubuntu server 206.189.22.155 from the azure release pipeline.Is there any way I can configure the release pipeline to use my ubuntu server?
The only agent pool available for me is "Azure Pipelines" and for agent specification I used "ubuntu-16.04".Iam totally confused about how this works.
I just want my application to run on http://206.189.22.155:5000. I can run the application directly in the server, but the whole point is to run it from the release pipeline.So how do I connect the pipeline to my ubuntu server?I think my default azure uses some kind of virtual machine for deployment.
You can create a deployment group in Azure DevOps. Deployment groups in Azure pipelines make it easier to organize the servers you want to use to host your app. In Azure pipelines -> Devployment group, select “+New” button and type of target to register. Copy and run the Registration script in your Ubuntu server.
You can refer to https://learn.microsoft.com/en-us/azure/devops/pipelines/apps/cd/deploy-linuxvm-deploygroups?view=azure-devops&tabs=java-script#define-your-ci-build-pipeline and https://learn.microsoft.com/en-us/azure/devops/pipelines/release/deployment-groups/index?view=azure-devops for more detailed information
After you create the deployment group, you can choose it in your release pipeline
And after you configure you deployment group, you can deploy your app to the specific server.

How do I give Azure Pipelines access to network resources?

I'm trying to set up a pipeline to include steps such as deploy a dacpac as well as run some e2e integration smoke tests. Unfortunately, some of the resources are inside of an on-premise network. How would Azure Pipelines obtain access to network resources?
You don't. If you need access to on-premise resources, install and configure a private agent within your network.

Azure Devops Pull Request and Jenkins behind corporate network

I'm trying to figure out how can I connect my Jenkins Build server to the Azure DevOps Pull Request. My Jenkins Server is behind a corporate firewall, I don't have any way to have access to this server outside of the corporate network.
Due to the corporate network rules I cannot add a hook in Azure to call my Jenkins server, but my server can have access to the Microsoft Azure web site.
I tried to run the VSTS Agent with success on my Linux Jenkins server. It works, but It doesn't do what I would need to do. I don't want to change all my build process to build my application inside this Agent. I really want to be able to launch a Jenkins Pipeline build from my server and forward the build result to the Azure DevOps.
I cannot use the Jenkins VM provided by Azure DevOps, because my Jenkins build process has to run some regression test tool on real hardware unit in our lab to flag the build as a success.
So in other word:
1- I cannot use the VSTS agent because I need to use my Jenkins Build Server
2- I cannot use the Jenkins VM provided by Azure DevOps because I need to have access to real Hardware Unite
3- I think I cannot instrument my Jenkins to see if we have a new Pull Request branch, because I will not be able to send the Jenkins build result to the Microsoft Azure DeveOps server.
Anybody had to do something like that?
Any reading to suggest?
Thanks!
Since one-way communication is going to be possible (from Jenkins to Azure DevOps), you'll have to do the following:
Set up your Jenkins pipeline to periodically poll Azure DevOps for new PR branches and build PRs
Set up a branch policy for approval from external services
Have Jenkins post the build status back to the external service API so that Azure DevOps knows whether the build has succeeded or failed