screwdriver-coverage-sonar 4.1.1 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +21 -9
- package/package.json +3 -2
package/index.js
CHANGED
|
@@ -45,14 +45,15 @@ class CoverageSonar extends CoverageBase {
|
|
|
45
45
|
'Invalid config for sonar coverage plugin'
|
|
46
46
|
);
|
|
47
47
|
|
|
48
|
-
this.
|
|
49
|
-
this.
|
|
50
|
-
this.
|
|
51
|
-
this.
|
|
52
|
-
this.
|
|
48
|
+
// use this.config for default values
|
|
49
|
+
this.sdCoverageAuthUrl = `${this.config.sdApiUrl}/v4/coverage/token`;
|
|
50
|
+
this.adminToken = this.config.adminToken;
|
|
51
|
+
this.sonarHost = this.config.sonarHost;
|
|
52
|
+
this.sonarEnterprise = this.config.sonarEnterprise;
|
|
53
|
+
this.sonarGitAppName = this.config.sonarGitAppName;
|
|
53
54
|
|
|
54
55
|
this.uploadCommands = COMMANDS.replace('$SD_SONAR_HOST', this.sonarHost)
|
|
55
|
-
.replace('$SD_UI_URL', config.sdUiUrl)
|
|
56
|
+
.replace('$SD_UI_URL', this.config.sdUiUrl)
|
|
56
57
|
.replace('$SD_SONAR_ENTERPRISE', this.sonarEnterprise)
|
|
57
58
|
.split('\n');
|
|
58
59
|
|
|
@@ -295,13 +296,20 @@ class CoverageSonar extends CoverageBase {
|
|
|
295
296
|
const [projectScope, id] = projectKey.split(':');
|
|
296
297
|
const projectName = projectScope === 'pipeline' ? pipelineName : `${pipelineName}:${jobName}`;
|
|
297
298
|
const username = `user-${projectScope}-${id}`;
|
|
298
|
-
|
|
299
|
-
return {
|
|
299
|
+
const projectData = {
|
|
300
300
|
projectKey,
|
|
301
301
|
username,
|
|
302
302
|
projectName,
|
|
303
303
|
projectScope
|
|
304
304
|
};
|
|
305
|
+
|
|
306
|
+
if (projectScope === 'pipeline') {
|
|
307
|
+
const componentId = encodeURIComponent(`pipeline:${id}`);
|
|
308
|
+
|
|
309
|
+
projectData.projectUrl = `${this.sonarHost}/dashboard?id=${componentId}`;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return projectData;
|
|
305
313
|
}
|
|
306
314
|
|
|
307
315
|
// Use user-configured scope; otherwise figure out default scope: pipeline scope for enterprise edition, job scope for everything else
|
|
@@ -309,11 +317,15 @@ class CoverageSonar extends CoverageBase {
|
|
|
309
317
|
const coverageScope = userScope || (enterpriseEnabled ? 'pipeline' : 'job');
|
|
310
318
|
|
|
311
319
|
if (coverageScope === 'pipeline') {
|
|
320
|
+
const componentId = encodeURIComponent(`pipeline:${pipelineId}`);
|
|
321
|
+
const projectUrl = `${this.sonarHost}/dashboard?id=${componentId}`;
|
|
322
|
+
|
|
312
323
|
return {
|
|
313
324
|
projectKey: `pipeline:${pipelineId}`,
|
|
314
325
|
projectName: pipelineName,
|
|
315
326
|
username: `user-pipeline-${pipelineId}`,
|
|
316
|
-
projectScope: coverageScope
|
|
327
|
+
projectScope: coverageScope,
|
|
328
|
+
projectUrl
|
|
317
329
|
};
|
|
318
330
|
}
|
|
319
331
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "screwdriver-coverage-sonar",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "SonarQube implementation of the coverage-base class",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"pretest": "eslint .",
|
|
8
|
-
"test": "nyc --report-dir ./artifacts/coverage --reporter=lcov mocha --reporter mocha-multi-reporters --reporter-options configFile=./mocha.config.json --recursive --timeout 4000 --retries 1 --exit --allow-uncaught true --color true"
|
|
8
|
+
"test": "nyc --report-dir ./artifacts/coverage --reporter=lcov mocha --reporter mocha-multi-reporters --reporter-options configFile=./mocha.config.json --recursive --timeout 4000 --retries 1 --exit --allow-uncaught true --color true",
|
|
9
|
+
"test-debug": "mocha --inspect-brk ./test/**/*.js"
|
|
9
10
|
},
|
|
10
11
|
"repository": {
|
|
11
12
|
"type": "git",
|