Facing errors in SonarCube scan through Azure Devops pipeline
I am trying to implement sonar scan in my Scala codes which are in data bricks notebook via Azure-Devops pipeline but getting below error can somebody please help me?
do you know?
how many words do you know
See also questions close to this topic
-
How to exclude tagged commit
I have a build pipeline in Azure Pipelines with
trigger: branches: include: - '*' tags: include: - v/*
In other words: I build all branches (in practice I only have one), and all tags that start with
v/
(these are my releases).When I push a commit and its tag, Azure Pipelines kicks off two builds - one for the branch and one for the tag - even though they're the same commit. This takes up unnecessary pipeline resources, particularly when I want to release from many repositories at the same time.
Is there a way to skip the "branch build" of a commit (or cancel if ongoing) when a "tag build" of the same commit is started?
-
Automate Azure Devops (FTP Upload) and Git to upload on Remote Server
The current setup is as below
- Version Control - Git
- Repos and Branch hosted on - Azure DevOps
- Codebase - External server
The dev team clones Azure Repo into local git project and any staged changes are committed via Git and pushed to specific branch of Azure DevOps. In this setup we would want to upload the changes to external FTP servers and avoid manual upload. Currently trying to use Azure Devops FTP Upload Task (https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/ftp-upload?view=azure-devops), however facing issues; yaml script as below
trigger: - main pool: vmImage: 'ubuntu-latest' variables: phpVersion: 7.4 webAppName: 'Test Project' buildConfiguration: 'Release' vmImageName: 'ubuntu-latest' steps: - publish: $(System.DefaultWorkingDirectory)/AzureRepoName artifact: Test Project Deploy - task: FtpUpload@2 displayName: 'FTP Upload' inputs: credentialsOption: inputs serverUrl: 'ftps://00.00.00.00:22' username: ftp-username password: ftp-password rootDirectory: '$(System.DefaultWorkingDirectory)/AzureRepoName' remoteDirectory: '/home/public_html' clean: false cleanContents: false preservePaths: true trustSSL: true
PROBLEM
Following errors occur when I commit (for test purposes) something.
Starting: PublishPipelineArtifact ============================================================================== Task : Publish Pipeline Artifacts Description : Publish (upload) a file or directory as a named artifact for the current run Version : 1.199.0 Author : Microsoft Corporation Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/publish-pipeline-artifact ============================================================================== Artifact name input: Test Project Deploy ##[error]Path does not exist: /home/vsts/work/1/s/AzureRepoName Finishing: PublishPipelineArtifact
I want to upload any staged change that is committed to main branch on Azure Devops to be automatically deploy on the remote FTP server
Thanks
-
Migrate Azure Devops Artifacts between organizations
I am trying to migrate (clone) an Azure Devops project to another project / organization. I successfully
- cloned the repos
- migrated the work items using Azure DevOps Migration Tools by NkdAgility
- I exported the build and release pipelines as json files and imported them again.
- I created a selfhosted agent on my VM and trying to run the build pipelines - the job "dotnet restore" on that.
- I created a new feed under Artifacts. Unfortunately the job with dotnet restore fails because it relies on the artifacts only available in the old project
How can I migrate the packages from the feeds of the old project to the new one(s)?
I assume I am supposed to clone the feeds of the old project somehow so that I can simply update the nuget.config with the name of the new organization. Thank you in advance.
<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <!-- remove any machine-wide sources with <clear/> --> <clear /> <!-- also get packages from the NuGet Gallery --> <add key="nuget.org" value="https://api.nuget.org/v3/index.json" /> <add key="DotNetArcade" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" /> <add key="<OLD_FEED1" value="https://pkgs.dev.azure.com/<old org>/_packaging/<OLD_FEED1>/nuget/v3/index.json" /> <add key="<OLD_FEED2" value="https://pkgs.dev.azure.com/<old org>/_packaging/<OLD_FEED2>/nuget/v3/index.json" /> <add key="<OLD_FEED3" value="https://pkgs.dev.azure.com/<old org>/_packaging/<OLD_FEED3>/nuget/v3/index.json" /> </packageSources> <activePackageSource> <add key="All" value="(Aggregate source)" /> </activePackageSource> </configuration>
-
Invoke-RestMethod : {"errors":[{"msg":"Either \u0027analysisId\u0027, \u0027projectId\u0027 or \u0027projectKey\u0027 must be provided"}]}
I am trying to get quality gate status from sonar server using API by passing pull request ID but I am getting error:
$QualityGateResult = Invoke-RestMethod -Method Get -Uri "$ServerUrl/api/qualitygates/project_status?pullRequest=$pullrequest_key?api- version=6.0" -Headers $Headers $QualityGateResult | ConvertTo-Json | Write-Host if ($QualityGateResult.projectStatus.status -eq "OK"){ Write-Host "Quality Gate Succeeded" } else{ throw "Quality gate failed. Please check and fix the issues by reviewing the same." }
Error msg: Invoke-RestMethod : {"errors":[{"msg":"Either \u0027analysisId\u0027, \u0027projectId\u0027 or \u0027projectKey\u0027 must be provided"}]}
Please help us to understand where I am making mistake.
-
Code coverage published to Sonar is not correct
We're using Sonar Server 9.1 and using maven command to publish reports to Sonar along with code coverage generated through Jacoco
In index.html file generated for code coverage, we can see code coverage as - 68% but used jacoco.xml file to publish to Sonar it's showing only 48.6% code coverages.
What analysis I should do to find the cause of discrepancy?
-
while running test pipeline, java.lang.IllegalArgumentException: Expected URL scheme 'http' or 'https' but no colon was found
Sonar is Not authorised. Please check the properties sonar. login and sonar. password getting error while running pipeline
image: name: sonarsource/sonar-scanner-cli:latest stage: test variables: SONAR_TOKEN: "xyz" SONAR_HOST_URL: "123" GIT_DEPTH: 0 cache: paths: - .sonar/cache before_script: - which sonar-scanner - echo "Scanning the "$CI_COMMIT_REF_NAME script: - sonar-scanner -X -Dsonar.sources=. -Dsonar.host.url=%SONAR_HOST_URL% -Dsonar.password=%SONAR_TOKEN% allow_failure: true only: - develop
while running this test pipeline getting below error:
06:21:31.027 INFO: EXECUTION FAILURE 06:21:31.027 INFO: ------------------------------------------------------------------------ 06:21:31.028 INFO: Total time: 1.321s 06:21:31.101 INFO: Final Memory: 3M/56M 06:21:31.101 INFO: ------------------------------------------------------------------------ 06:21:31.101 ERROR: Error during SonarScanner execution org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarScanner analysis at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:85) at java.base/java.security.AccessController.doPrivileged(Native Method) at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:74) at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:70) at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:185) at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:123) at org.sonarsource.scanner.cli.Main.execute(Main.java:73) at org.sonarsource.scanner.cli.Main.main(Main.java:61) Caused by: java.lang.IllegalStateException: Fail to get bootstrap index from server at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(BootstrapIndexDownloader.java:42) at org.sonarsource.scanner.api.internal.JarDownloader.getScannerEngineFiles(JarDownloader.java:58) at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:53) at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:76) ... 7 more
Caused by: java.lang.IllegalArgumentException: Expected URL scheme 'http' or 'https' but no colon was found
at org.sonarsource.scanner.api.internal.shaded.okhttp.HttpUrl$Builder.parse(HttpUrl.java:1332) at org.sonarsource.scanner.api.internal.shaded.okhttp.HttpUrl.get(HttpUrl.java:917) at org.sonarsource.scanner.api.internal.shaded.okhttp.Request$Builder.url(Request.java:165) at org.sonarsource.scanner.api.internal.ServerConnection.callUrl(ServerConnection.java:111) at org.sonarsource.scanner.api.internal.ServerConnection.downloadString(ServerConnection.java:99) at org.sonarsource.scanner.api.internal.BootstrapIndexDownloader.getIndex(BootstrapIndexDownloader.java:39) ... 10 more