Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

We have captured here some

Azure DevOps Pipeline for a DotNet application

Code Block
languagepowershell
$sldomain="m.sealights.co" 
$slagenttoken="$(AgentToken.Sandbox)"
$APP_NAME="Calculator-CS"

#Retrieve the same name of target branch as reported in Sealights Dashboard
$PR_TARGET_BRANCH="$(System.PullRequest.TargetBranch)".Replace("refs/heads/","")
#Retrieve the last Commit Hash from the PR branch and not the one from the ADO local Merge
$PR_LAST_COMMIT=$(git log -2 --format=%H).Split(" ")[1]
$PR_NUMBER="$(System.PullRequest.PullRequestId)"
$REPO_URL="$(System.PullRequest.SourceRepositoryURI)"



[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Write-Output "Retrieve DotNet agent version set in Sealights settings..." 
$agentversion = ((iwr -Uri https://$($sldomain)/api/v2/agents/dotnet/recommended -Headers @{'Accept' = 'application/json'; 'Authorization' = "Bearer $($slagenttoken)"}).Content | ConvertFrom-Json | Select-Object agent).agent.version
Write-Output "Download Sealights DotNet agent..." 
iwr -OutFile sealights-dotnet-agent.zip -Uri http://agents.sealights.co/SL.DotNet/SL.DotNet-$($agentversion).zip
Expand-Archive .\sealights-dotnet-agent.zip -DestinationPath SL.DotNet -Force
Write-Output "Sealights agent version used is: $(Get-Content .\SL.DotNet\version.txt)" 

Write-Output "`n*** Create PR BSID ***"
.\SL.DotNet\x64\SL.DotNet.exe prConfig --appName $APP_NAME --pullRequestNumber  $PR_NUMBER  --targetBranch $PR_TARGET_BRANCH --latestCommit $PR_LAST_COMMIT --repositoryUrl $REPO_URL --includeNamespace CalculatorServer.Controllers --buildSessionIdFile $(Build.ArtifactStagingDirectory)\SealightsBuildSessionId.txt --token $(AgentToken.Sandbox) --logEnabled true --logAppendConsole true --ignoreCertificateErrors true

Write-Output "`n*** Prepare for MSBuild ***"
.\SL.DotNet\x64\SL.DotNet.exe prepareForMsBuild --buildSessionIdFile $(Build.ArtifactStagingDirectory)\SealightsBuildSessionId.txt --workspacePath $(Build.Repository.LocalPath)\src --baseDir  $(Build.Repository.LocalPath) --ignoreGeneratedCode true --debugMode true --logEnabled true --logAppendConsole true --ignoreCertificateErrors true --token $($slagenttoken) --scm git --scmProvider vsts 

Maven Build for a Java application

In the example below, we simply create the buildSessionId outside the JSON command using the relevant parameters.

...