jenkins gradle sonar -> github comments - github

I'd like to have sonar comments on github pull requests. For that I set up a jenkins job which runs ./gradlew clean sonarRunner [properties].
I read through this:
jenkins + sonar + github integration
My setup is similar, I don't start sonar with maven but with gradle.
I use the following properties:
-Dsonar.github.login=
-Dsonar.github.repository=company/repo
-Dsonar.analysis.mode=preview
-Dsonar.issuesReport.console.enable=true
-Dsonar.github.login=gitusername
-Dsonar.github.oauth=token
As described here:
http://docs.sonarqube.org/display/PLUG/GitHub+Plugin
The end of the log on jenkins is:
11:06:02.167 INFO - Sensor GitHub Plugin InputFile Cache
11:06:02.167 INFO - Sensor GitHub Plugin InputFile Cache (done) | time=0ms
11:06:02.168 INFO - Load server issues
11:06:02.532 INFO -
------------- Issues Report -------------
+620 issues
+2 blocking
+43 critical
+402 major
+169 minor
+4 info
11:06:02.532 INFO - Export issues to
/jenkins/workspace/scheduling-sonar-pull-request/jdk/JDK8/label/Linux/build/sonar/sonar-report.json
11:06:02.611 INFO - ANALYSIS SUCCESSFUL
INFO: EXECUTION SUCCESS INFO:
Total time: 20.198s Final Memory: 26M/742M INFO:
BUILD SUCCESSFUL
But there are no comments appearing on github.
In order to debug changed the oauth token, which gave:
ERROR: Caused by: Unable to perform GitHub WS operation
ERROR: Caused by: Server returned HTTP response code: 401 for URL:
Why are no comments appearing on github? The github plugin is installed on sonarqube, jenkins triggers the sonarRunner, the PR id is correct (tried it hard-coded), the PR has a lot of files, a wrong oauth token gives an error.

Related

How to build azure pipeline tasks from https://github.com/microsoft/azure-pipelines-tasks locally and consume them in an on-prem Azure DevOps Server?

So I cloned their repository, but how do I actually build the tasks?
Here is my scenario. We use Azure DevOps Server 2020 (on prem). All of our build pipelines run the Index Sources & Publish Symbols task
However, it has a bug https://github.com/microsoft/azure-pipelines-tasks/issues/14852. Luckily a fix was merged to master. However, we are not going to see it until it is propagated to the Azure DevOps Server edition and only All Mighty knows when it would happen.
So, I would like to build that task locally and upload to our Azure DevOps server. But I cannot find instructions on how to do it.
So, how can I build and consume it in our Azure DevOps Server?
EDIT 1
Tried to follow the procedure in https://github.com/microsoft/azure-pipelines-tasks/blob/master/ci/build-all-steps.yml, but it did not work.
The first step that seems relevant to me is https://github.com/microsoft/azure-pipelines-tasks/blob/6ab084f52e582370880127132d1c449634c9bfbc/ci/build-all-steps.yml#L39:
- script: |
cd ci
cd verifyMinAgentDemands
npm install
node index.js
displayName: Verify all min agent demands are valid
And it is fine:
C:\work\azure-pipelines-tasks\ci\verifyMinAgentDemands [master ≡]> npm install
npm WARN verifyminagentdemands#1.0.0 No description
npm WARN verifyminagentdemands#1.0.0 No repository field.
added 52 packages from 78 contributors and audited 52 packages in 1.743s
found 2 low severity vulnerabilities
run `npm audit fix` to fix them, or `npm audit` for details
C:\work\azure-pipelines-tasks\ci\verifyMinAgentDemands [master ≡]> node .\index.js
##vso[task.debug]agent.TempDirectory=undefined
##vso[task.debug]agent.workFolder=undefined
##vso[task.debug]loading inputs and endpoints
##vso[task.debug]loaded 0
##vso[task.debug]Agent.ProxyUrl=undefined
##vso[task.debug]Agent.CAInfo=undefined
##vso[task.debug]Agent.ClientCert=undefined
##vso[task.debug]Agent.SkipCertValidation=undefined
Verifying min agent demands.
Latest version of the Agent that's fully rolled out is 2.195.0.
The next step (https://github.com/microsoft/azure-pipelines-tasks/blob/6ab084f52e582370880127132d1c449634c9bfbc/ci/build-all-steps.yml#L47) seems to be relevant too:
- script: node make.js build --task "$(task_pattern)"
displayName: Build
condition: ne(variables['numTasks'], 0)
But:
C:\work\azure-pipelines-tasks [master ≡]> node make.js build --task PublishSymbolsV2
> prepending PATH C:\work\azure-pipelines-tasks\node_modules\.bin
tsc tool:
Version 2.3.4
C:\work\azure-pipelines-tasks\node_modules\.bin\tsc
npm tool:
6.14.12
C:\Program Files\nodejs\npm
------------------------------------------------------------
Building: PublishSymbolsV2
------------------------------------------------------------
> getting task externals
Downloading file: https://vstsagenttools.blob.core.windows.net/tools/symstore/2/symbol.zip
Could not use "nc", falling back to slower node.js method for sync requests.
C:\work\azure-pipelines-tasks\node_modules\sync-request\index.js:77
throw new Error(res.stderr.toString());
^
Error
at doRequestWith (C:\work\azure-pipelines-tasks\node_modules\sync-request\index.js:77:11)
at doRequest (C:\work\azure-pipelines-tasks\node_modules\sync-request\index.js:20:10)
at downloadFile (C:\work\azure-pipelines-tasks\make-util.js:411:22)
at downloadArchive (C:\work\azure-pipelines-tasks\make-util.js:451:27)
at C:\work\azure-pipelines-tasks\make-util.js:644:33
at Array.forEach (<anonymous>)
at getExternals (C:\work\azure-pipelines-tasks\make-util.js:639:25)
at C:\work\azure-pipelines-tasks\make.js:193:13
at Array.forEach (<anonymous>)
at Function.target.build (C:\work\azure-pipelines-tasks\make.js:158:14)
C:\work\azure-pipelines-tasks [master ≡]>
What is now?

401 from vulnerability DB sync during trial

I just started a 30 day trial of Artifactory Pro and Xray on prem, stood up using docker-compose.
Most functionality is working fine, however when I try to sync the Xray vulnerability DB through the UI, it fails. Looking at the xray server service log I see:
2021-08-03T08:54:44.091Z [33m[jfxr ][0m [1m[31m[ERROR][0m [f1000c9d14bbcc48] [updates_job:389 ] [main ] Updates worker id 0 failed to download updates from https://jxray.jfrog.io/api/v1/updates/onboarding?version=3.25.1: failed to get online updates
--- at /go/src/jfrog.com/xray/internal/jobs/scanner/scanner_job.go:793 (DownloadOnlineUpdates) ---
Caused by: Failed to access :https://jxray.jfrog.io/api/v1/updates/onboarding?version=3.25.1 return status code : 401
2021-08-03T08:54:44.091Z [33m[jfxr ][0m [1m[31m[ERROR][0m [f1000c9d14bbcc48] [updates_job:341 ] [main ] failed to Download online updates
--- at /go/src/jfrog.com/xray/internal/jobs/updates_job.go:397 (UpdatesJob.downloadUpdateUrlsAndLastUpdateTime) ---
Caused by: failed to get online updates
--- at /go/src/jfrog.com/xray/internal/jobs/scanner/scanner_job.go:793 (DownloadOnlineUpdates) ---
Caused by: Failed to access :https://jxray.jfrog.io/api/v1/updates/onboarding?version=3.25.1 return status code : 401
2021-08-03T08:55:01.076Z [33m[jfxr ][0m [34m[INFO ][0m [ ] [samplers:327 ] [main ]
I get a similar response if I switch to offline sync and run the offline update:
~/src/artifactory ❯ jfrog xr offline-update --license-id=[redacted for posting] --version=3.25.1
[Info] Getting updates...
[Error] Response: Server response: 401 Unauthorized
I'm assuming this is a licensing problem? Any suggestions please? - I'm assuming the xray trial includes access to the vulnerability DB?
The issue seems to be related to the Xray trial license not being added correctly as 401 means license validation is failing at the JFrog end. Kindly confirm if the Xray trial license is added correctly under the UI --> Administration --> License | Xray trial license. Also, refer to this KB article for more insights.
Seems to be an issue with the license. I signed up for another trial, and used the xray license on my existing cluster. It initially failed in the same way, but shortly afterwards I was able to do an offline download (and when that worked, I tried an online sync which did work).

Teamcity fails to fetch files from Azure Devops

I am very new to the TeamCity and want to learn auto build and deploy applications from online TFS. My project has windows and web apps developed in .NET only.
I have no code on my machine and directly using online TFS as source.
VCS Root setting works fine and connection gets successful.
In the Build Step, I am using Build as the first step using MSBuild. When I click on RUN it starts the process and shows the first step as UPDATING SOURCES. In the code checkout directory, it creates only directories and there is no even single source code file though I can see all code files in TFS online. After this step it shows error:
Failed to start MSBuild.exe. Failed to find project file at path:
C:\TeamCity\buildAgent\work\740b9db587af8795\ProjectName.sln
ProjectName.sln file exists in TFS at https://ProjectName.visualstudio.com/DefaultCollection/$/Main/MainBranch
I am not getting what things I am missing. I googled much about but I wasn't able to get what is missing here. What extra steps I need to do to get this working.
Appreciate your help.
FI: Teamcity Version 2018.1.3 (build 58658). Teamcity server and build agent are on the same machine: Win 10.
Edited:
Below is screenshot with the RUN process.
Teamcity-Activities.log
[2019-01-07 19:44:23,906] INFO - s.buildServer.ACTIVITIES.AUDIT - build_type_edit_settings: "MLD / Main {id=Mld_Main, internal id=bt2}" build configuration settings were edited ("version before: 45, version after: 46") by "'admin'(AB) {id=1}" with comment "runners of 'Main' build configuration were updated"
[2019-01-07 19:44:34,460] INFO - s.buildServer.ACTIVITIES.AUDIT - build_add_to_queue: Build BUILD_PROMOTION{id=52} was added to queue by "'admin'(AB) {id=1}"
[2019-01-07 19:44:34,466] INFO - tbrains.buildServer.ACTIVITIES - Build added to queue; Queued build {Build promotion {promotion id=52, configuration={id=Mld_Main, internal id=bt2}, queued}, triggered by "'admin'(AB) {id=1}" (##userId='1' type='user')}
[2019-01-07 19:44:34,539] INFO - tbrains.buildServer.ACTIVITIES - Build started; MLD / Main {id=Mld_Main, internal id=bt2} #25 {promotion id=52, agent="Agent-Name" {id=1}, triggered by "'admin'(AB) {id=1}" (##userId='1' type='user'). Started 2019-01-07 19:44:34.514, running}
[2019-01-07 19:55:38,847] INFO - tbrains.buildServer.ACTIVITIES - Finished build MLD / Main {id=Mld_Main, internal id=bt2} #25 {promotion id=52, agent="Agent-Name" {id=1}, triggered by "'admin'(AB) {id=1}" (##userId='1' type='user'). Started 2019-01-07 19:44:41.748, finished. Status "FAILURE 'Cannot start build runner; exit code -42 (Step: Build (MSBuild))'"}
Teamcity-tfs.log
[2019-01-07 19:42:03,434] INFO - .vcs.tfs.java.TfsJavaWebRunner - Starting TFS out of process application
[2019-01-07 19:42:03,439] INFO - .vcs.tfs.java.TfsJavaWebRunner - TFS out of process application has been started
[2019-01-07 19:42:08,312] INFO - .vcs.tfs.java.TfsJavaWebRunner - Web server started at http://localhost:64729/api/commands
[2019-01-07 19:42:08,312] INFO - gers.vcs.tfs.TfsTimeoutWatcher - TFS out of process app idle timer has started
[2019-01-07 19:42:25,586] INFO - .vcs.tfs.java.TfsJavaWebRunner - TFS java web command has finished: TestConnection $/Main/Feature -s="https://ProjectName.visualstudio.com/" -p="*******", completed in 22.140 second(s)
[2019-01-07 19:43:00,661] INFO - .vcs.tfs.java.TfsJavaWebRunner - TFS java web command has finished: GetCurrentVersion $/Main/Feature -s="https://ProjectName.visualstudio.com/" -p="*******", completed in 1.607 second(s)
[2019-01-07 19:44:35,894] INFO - .vcs.tfs.java.TfsJavaWebRunner - TFS java web command has finished: GetCurrentVersion $/Main/Feature 31529 -s="https://ProjectName.visualstudio.com/" -p="*******", completed in 1.293 second(s)
Finally got the issue issue resolved!
The token generated for the TFVC access was not having sufficient permissions. Changed the access token to have Full Access and it started working and I can see all code files in the checkout directory. Thanks jesse for your comments.

Rundeck and Hipchat Plugin

I am configuring Rundeck in my work and I want to receive all notifications from jobs via Hipchat. I have found this plugin: https://github.com/hbakkum/rundeck-hipchat-plugin
I copied .jar file in Rundeck libext directory and now I see Hipchat option in Job notification. Despite the fact that I wrote the room ID and I get a token to allow Rundeck sends notifications to this room, nothing happens..
I saw this topic: https://github.com/rundeck/rundeck/issues/764
Also I am getting this logs:
2018-01-31 15:15:12,122 [quartzScheduler_Worker-3] INFO grails.app.services.rundeck.services.ExecutionUtilService - Execution successful: 13 in project proyecto_prueba
2018-01-31 15:15:12,501 [quartzScheduler_Worker-3] INFO grails.app.services.rundeck.services.ExecutionService - updated scheduled Execution
2018-01-31 15:15:31,088 [quartzScheduler_Worker-4] ERROR grails.app.services.rundeck.services.PluginService - Notification: configuration was not valid for plugin 'HipChatNotification': apiAuthToken: required
is Hipchat plugin working wrong because last update was in 2016 or Am I configuring something wrong?
Thanks beforehand.
Regards,
Mike.
I found the issue. Hipchat API Token has to have next scopes: Send notification y View Room. With these scopes, I have to specify next lines in Rundeck config files:
configure framework:
framework.plugin.Notification.HipChatNotification.apiVersion=v2
framework.plugin.Notification.HipChatNotification.apiAuthToken=value
configure project:
project.plugin.Notification.HipChatNotification.apiVersion=v2
project.plugin.Notification.HipChatNotification.apiAuthToken=value

Selenium looping through jenkins and permission denied in cli

After struggling to get proper testsuites, I'm now pretty disappointed by the fact that , while following as close as possible this tutorial (pretty straightforward, right ?) Setting up Selenium server on a headless Jenkins CI build machine, Jenkins keeps looping on the current build, outputting :
So I decided to run a selenium build by hand on the ci machine, and got this :
user#machine:/var/log$ export DISPLAY=":99" && java -jar /var/lib/selenium/selenium- server.jar -browserSessionReuse -htmlSuite *firefox http://staging.site.com /var/lib/jenkins/jobs/project/workspace/tests/selenium/testsuite.html /var/lib/jenkins/jobs/project/workspace/logs/selenium.html
24 janv. 2012 19:27:56 org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
19:27:59.927 INFO - Java: Sun Microsystems Inc. 20.0-b11
19:27:59.929 INFO - OS: Linux 3.0.0-14-generic amd64
19:27:59.951 INFO - v2.17.0, with Core v2.17.0. Built from revision 15540
19:27:59.958 INFO - Will recycle browser sessions when possible.
19:28:00.143 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
19:28:00.144 INFO - Version Jetty/5.1.x
19:28:00.145 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
19:28:00.147 INFO - Started HttpContext[/selenium-server,/selenium-server]
19:28:00.147 INFO - Started HttpContext[/,/]
19:28:00.183 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler#16ba8602
19:28:00.184 INFO - Started HttpContext[/wd,/wd]
19:28:00.199 INFO - Started SocketListener on 0.0.0.0:4444
19:28:00.199 INFO - Started org.openqa.jetty.jetty.Server#6f7a29a1
HTML suite exception seen:
java.io.IOException: Permission denied
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:900)
at org.openqa.selenium.server.SeleniumServer.runHtmlSuite(SeleniumServer.java:603)
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:287)
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:245)
at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:54)
19:28:00.218 INFO - Shutting down...
19:28:00.220 INFO - Stopping Acceptor ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=4444]
While understanding the output is'nt that hard, finding what to do to remove this issue is.
Any chance you guys already have been facing that kind of stuff ? Thanks
I only just got past these problems myself, but I was able to run your command when I pointed it at my .jar, testSuite and report file. I'm thinking that perhaps the location of your files under,
/var/lib/selenium
could be part of the problem. Try putting them where your user has permission perhaps under
/home/USERNAME/selenium
Other than that the only thing I can say is make sure your .jar, testSuite and report file are valid.
Also (I assume this is an error of copy and paste into stack overflow) but, this part of your command is incorrect
/var/lib/selenium/selenium- server.jar
You are not getting the error I would expect from an incorrect jar location so I assume something was lost when you pasted to stackoverflow.