I’m using Gatling on my local machine. Now I need to move tests to our Azure DevOps server on prem version.
Anyone who has done this? I’ve not found a tutorial for this.
Since you are using the Azure Devops Server, you need to create a Self-hosted agent.
Then you can use your local script to run the gatling test.
Here is my maven gatling test example:
Yaml sample:
steps:
- task: Maven#3
displayName: 'Maven pom.xml'
- powershell: 'mvn gatling:test'
workingDirectory: '$(build.sourcesdirectory)'
displayName: 'PowerShell Script'
- task: PublishBuildArtifacts#1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(Build.sourcesdirectory)'
Related
I have an Azure DevOps pipeline step failing running the OWASP dependency check. I want to find what dependencies need to be updated.
The logs that are written during the dependency check pipeline step say:
[INFO] Writing report to: e:\vsts\a\7567\TestResults\dependency-check\dependency-check-report.html
I assume this dependency-check-report.html is where it will tell me what dependencies need to be updated. But I do not understand where this e:\vsts\a\7567\TestResults\ location is, as this step is being run in DevOps. Is this somewhere in DevOps? I cannot seem to find it anywhere. "Download logs" on the pipeline page doesn't seem to have it either.
where this e:\vsts\a\7567\TestResults\ location is
When you run the pipeline in Azure DevOps, this path represents the local path of the machine where the agent locates.
In your case, the agent is self-hosted agent. You go to the local machine where the agent locates and find the dependency-check-report.html in e:\vsts\a\7567\TestResults\dependency-check.
On the other hand, you can use the Publish Pipeline Artifacts task to upload the target file to Pipeline artifacts.
For example:
steps:
- task: dependency-check-build-task#6
displayName: 'Dependency Check'
inputs:
projectName: test
scanPath: test
continueOnError: true
- task: PublishPipelineArtifact#1
displayName: 'Publish Pipeline Artifact'
inputs:
targetPath: '$(Common.TestResultsDirectory)'
artifact: drop
Note: You need to set the continueOnError: true in OWASP dependency check task.
In this case, the dependency-check-report.html on agent machine will be uploaded to Azure Artifacts.
For example:
I'm using and on-premise installation of Azure DevOps Server 2020 Update 1.2. I'm trying to configure the build pipeline to obtain the diff coverage indicators in the files tab of pull requests as shown in https://learn.microsoft.com/en-us/azure/devops/pipelines/test/codecoverage-for-pullrequests?view=azure-devops
I created two .Net Core projects one in Azure Devops Cloud and one in our on-premise server. The indicators appear in the cloud project but not on the on-premise hosted one. The only difference between both is that the on-premise linux build agent is based on RedHat instead of Ubuntu.
Are there requirements on the server or software that need to be installed on the server or the agent to get this coverage indicators working?
These are the relevant steps of my yaml pipeline:
- task: DotNetCoreCLI#2
displayName: 'dotnet restore task'
inputs:
command: 'restore'
feedsToUse: 'config'
nugetConfigPath: '$(Build.SourcesDirectory)/NuGet.config'
- task: DotNetCoreCLI#2
displayName: 'dotnet build $(buildConfiguration)'
inputs:
command: 'build'
arguments: '--configuration $(buildConfiguration)'
- task: DotNetCoreCLI#2
displayName: 'dotnet test $(buildConfiguration) v2'
inputs:
command: 'test'
projects: '**/*Test/*.csproj'
arguments: '--configuration $(buildConfiguration) --collect:"XPlat Code Coverage" --collect:"Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=json,cobertura,lcov,teamcity,opencover,coverlet -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.SplitCoverage="True"'
publishTestResults: true
This feature is currently not available for Azure DevOps Server 2020 Update 1.2.
Currently, we can only see the feature in the RTW Release Notes for Azure DevOps Server 2020 RC1.
For this, you may access this URL: https://aka.ms/AzDevOpsIdeas to submit any comments and proposals for future releases and implementations.
I'm learning how to build the infrastructure provisioning pipelines in Azure DevOps and looking for some step-by-step tutorial to deploy for instance the vnet and a VM in Azure using both methods - ARM templates as well as Terraform
Any help highly appreciated,
Thanks,
Andrey
ARM template:
Firstly, you need have one template which it can be deployed to azure to create VM and Vnet. Just refer to this sample: azure-quickstart-templates. Then do some changes into the JSON scripts based on your actual demands.
The CI/CD structure in azure devops also very easy.
1) Build:
Since the template scripts do not need any build process, it only need 2 tasks to pack and publish the repos as artifact. So that release can use them.
- task: CopyFiles#2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
TargetFolder: '$(build.artifactstagingdirectory)'
- task: PublishBuildArtifacts#1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
2) Release:
In release pipeline, it just need one task: Azure Resource Group Deployment task.
This blog has detailed description on how to configure the task.
Terraform:
Same with ARM, here you also need one terraform scripts.
1) Build
For tefrraform, the build configuration same with ARM. Just need publish artifacts.
2) Relesase
See this detailed blog: Terraform deployment with Azure DevOps
I have 2 ways to build a pipeline on Azure DevOps, with YAML pipeline template or with Tasks preset in Classic Editor(which can be converted into Task Group as well).
If I select the same template in either one of these ways, the same task in the Classic Editor could be missing from its YAML pipeline template counterpart.
I selected .NET Desktop with both ways.
https://i.imgur.com/2fGcZ14.png
In Classic Editor, I could see 2 of these publishing tasks as seen below.
https://i.imgur.com/yxYxD44.png
With YAML Pipeline, the 2 tasks seen above are missing though.
# .NET Desktop
# Build and run tests for .NET Desktop or Windows classic desktop solutions.
# Add steps that publish symbols, save build artifacts, and more:
# https://learn.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller#1
- task: NuGetCommand#2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild#1
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest#2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
I can't figure out why this is happening though. Appreciate some help or pointers on this, thanks in advance.
Both those tasks are not missing, but you might need to manually add them.
Publishing artifacts is no long a standalone task, it's become part of the core capability of YAML pipelines, so it's effective a native step called publish
steps:
- publish: output/files # path to files/directory containing files you want to publish
artifact: myartifact # Name of the artifact
As for copy files, that's still a task, as documented here
The docs for YAML pipelines are pretty good IMO
As well as a complete reference for the all the built-in tasks
I would need to have a build definition totally included inside a powershell script.
I can install dotnet, restore packages, build everything, and now I need to create an artifact.
I cannot find a way to call in Powershell the equivalent of the task PublishBuildArtifacts#1, nothing comes up also googling everywhere. It shouldn't be difficult...
Thanks in advance.
Maybe I found it, finally: I will try it using this documentation:
https://learn.microsoft.com/en-us/rest/api/azure/devops/build/artifacts/create?view=azure-devops-rest-4.1
'Publish build artifacts' should solve it.
I would also add a task to archive the files to be considered artifacts before the publish.
The build report now shows a link to download the files produced by the powershell script.
Summary:
Archive task to $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
Publish Build Artifacts task publishing $(Build.ArtifactStagingDirectory)
yaml for the archive:
- task: ArchiveFiles#2
displayName: 'Archive output'
inputs:
rootFolderOrFile: Deliver
yaml for the publish:
- task: PublishBuildArtifacts#1
displayName: 'Publish Artifact: drop'