Details
-
Type:
Improvement
-
Status: Closed (View Workflow)
-
Priority:
Minor
-
Resolution: Fixed
-
Component/s: influxdb-plugin
-
Labels:None
-
Similar Issues:
-
Released As:2.0
Description
Jenkins: 2.73.2.1-rolling
InfluxDB plugin: 1.12.3
Jenkins pipeline implementation.
I am attempting to publish sonarqube results with the influxdb plugin, but I get the following error:
[InfluxDB Plugin] Publishing data to: [url=http://influx.example.com, description=influxdb, username=jenkins, password=*****, database=jenkins]
[InfluxDB Plugin] SonarQube data found. Writing to InfluxDB...
[InfluxDB Plugin] Failed to collect data. Ignoring Exception:java.lang.RuntimeException: Failed : HTTP error code : 401
[InfluxDB Plugin] Completed.
This is because our sonarqube installation requires authentication. I have wrapped the step([$class: 'InfluxDbPublisher']), inside a withSonarQubeEnv block, which exposes a number of new environment variables, including SONAR_HOST_URL and SONAR_AUTH_TOKEN.
It would be great if the influxdb plugin could utilize the exposed ENV variables to authenticate with Sonarqube (if available)
I managed it to send the Authentication using a "Jenkins Global Environment Variable" named "SONAR_AUTH_TOKEN".
Also it is important (using SonarQube 7.4 and InfluxDB Plugin 1.20.1) to set an Environment Variable "SONAR_HOST_URL".