From f3bbdf93655ce2ebb3b8025d589e4a922d440a9f Mon Sep 17 00:00:00 2001 From: Kalyan Date: Sat, 7 Jul 2018 12:29:24 +0530 Subject: [PATCH 1/3] Transforming git url to http url while downloading commits from Jenkins job. --- .../ArtifactDetails/CommitsDownloader.ts | 66 ++++++++++++++++--- .../resources.resjson/en-US/resources.resjson | 1 + Tasks/JenkinsDownloadArtifactsV1/task.json | 3 +- .../JenkinsDownloadArtifactsV1/task.loc.json | 3 +- 4 files changed, 63 insertions(+), 10 deletions(-) diff --git a/Tasks/JenkinsDownloadArtifactsV1/ArtifactDetails/CommitsDownloader.ts b/Tasks/JenkinsDownloadArtifactsV1/ArtifactDetails/CommitsDownloader.ts index 7203241c7cff..b5f01990f50f 100644 --- a/Tasks/JenkinsDownloadArtifactsV1/ArtifactDetails/CommitsDownloader.ts +++ b/Tasks/JenkinsDownloadArtifactsV1/ArtifactDetails/CommitsDownloader.ts @@ -53,12 +53,6 @@ export class CommitsDownloader extends ArtifactDetailsDownloaderBase { public static GetCommitMessagesFromCommits(commits: string): string[] { console.log(tl.loc("GetCommitMessages")); - // remove the extra comma at the end of the commit item - let index: number = commits.lastIndexOf(","); - if (index > -1) { - commits = commits.substring(0, index) + commits.substring(index + 1); - } - let template = handlebars.compile(GetCommitMessagesTemplate); try { var result = template(JSON.parse(commits)); @@ -111,7 +105,9 @@ export class CommitsDownloader extends ArtifactDetailsDownloaderBase { this.jenkinsClient.DownloadJsonContent(commitsUrl, CommitTemplate, null).then((commitsResult) => { tl.debug(`Downloaded commits: ${commitsResult}`); - defer.resolve(commitsResult); + + var commits: string = this.TransformCommits(commitsResult); + defer.resolve(commits); }, (error) => { defer.reject(error); }); @@ -128,7 +124,9 @@ export class CommitsDownloader extends ArtifactDetailsDownloaderBase { tl.debug(`Downloading commits from startIndex ${startIndex} and endIndex ${endIndex}`); this.jenkinsClient.DownloadJsonContent(commitsUrl, CommitsTemplate, {'buildParameter': buildParameter}).then((commitsResult) => { tl.debug(`Downloaded commits: ${commitsResult}`); - defer.resolve(commitsResult); + + var commits: string = this.TransformCommits(commitsResult); + defer.resolve(commits); }, (error) => { defer.reject(error); }); @@ -161,4 +159,56 @@ export class CommitsDownloader extends ArtifactDetailsDownloaderBase { return fileName; } + + private TransformCommits(commits: string): string { + if (!!commits) { + + // remove the extra comma at the end of the commit item + let index: number = commits.lastIndexOf(","); + if (index > -1) { + commits = commits.substring(0, index) + commits.substring(index + 1); + } + + try { + var commitMessages = JSON.parse(commits); + + commitMessages.forEach((commit) => { + tl.debug('Normalizing url' + commit.DisplayUri); + commit.DisplayUri = this.ConvertGitProtocolUrlToHttpProtocol(commit.DisplayUri); + }); + + return JSON.stringify(commitMessages); + + } catch(error) { + console.log(tl.loc("CannotParseCommits", commits, error)); + throw error; + } + } + + return ''; + }; + + private ConvertGitProtocolUrlToHttpProtocol(commitUrl: string): string { + var result: string = ''; + if (!!commitUrl) { + if (commitUrl.startsWith('git@')) { + tl.debug('repo url is a git protocol url'); + + + if (commitUrl.startsWith('git@gitlab.com')) { + result= commitUrl.replace('git@gitlab.com:', 'https://gitlab.com/').replace('.git/', '/'); + } + else if (commitUrl.startsWith('git@github.com')) { + result = commitUrl.replace('git@github.com:', 'https://github.com/').replace('.git/', '/'); + } + } + else if (commitUrl.startsWith('http')) { + // if its http return the url as is. + result = commitUrl; + } + } + + tl.debug(`Translated url ${commitUrl} to ${result}`); + return result; + } } \ No newline at end of file diff --git a/Tasks/JenkinsDownloadArtifactsV1/Strings/resources.resjson/en-US/resources.resjson b/Tasks/JenkinsDownloadArtifactsV1/Strings/resources.resjson/en-US/resources.resjson index 6a9760f09967..dfc40b4ab9e8 100644 --- a/Tasks/JenkinsDownloadArtifactsV1/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/JenkinsDownloadArtifactsV1/Strings/resources.resjson/en-US/resources.resjson @@ -66,6 +66,7 @@ "loc.messages.SuccessfullyDownloadedCommitsAndWorkItems": "Commits and work items downloaded successfully", "loc.messages.CommitsAndWorkItemsDownloadFailed": "Downloading commits and work items from Jenkins failed with an error: %s", "loc.messages.CannotFindBuilds": "Cannot find builds", + "loc.messages.CannotParseCommits": "Cannot parse commit objects %s. Error: %s", "loc.messages.JenkinsNoCommitsToFetch": "Start and end build Ids are same. Commits and work items will not be downloaded.", "loc.messages.InvalidJenkinsBuildNumber": "Cannot parse the Jenkins Build number.", "loc.messages.InvalidJenkinsStartBuildNumber": "The specified Jenkins start build number %s is not valid.", diff --git a/Tasks/JenkinsDownloadArtifactsV1/task.json b/Tasks/JenkinsDownloadArtifactsV1/task.json index ec3b38c8d5c6..c308187d2cba 100644 --- a/Tasks/JenkinsDownloadArtifactsV1/task.json +++ b/Tasks/JenkinsDownloadArtifactsV1/task.json @@ -17,7 +17,7 @@ "demands": [], "version": { "Major": 1, - "Minor": 137, + "Minor": 138, "Patch": 0 }, "groups": [ @@ -304,6 +304,7 @@ "SuccessfullyDownloadedCommitsAndWorkItems": "Commits and work items downloaded successfully", "CommitsAndWorkItemsDownloadFailed": "Downloading commits and work items from Jenkins failed with an error: %s", "CannotFindBuilds": "Cannot find builds", + "CannotParseCommits": "Cannot parse commit objects %s. Error: %s", "JenkinsNoCommitsToFetch": "Start and end build Ids are same. Commits and work items will not be downloaded.", "InvalidJenkinsBuildNumber": "Cannot parse the Jenkins Build number.", "InvalidJenkinsStartBuildNumber": "The specified Jenkins start build number %s is not valid.", diff --git a/Tasks/JenkinsDownloadArtifactsV1/task.loc.json b/Tasks/JenkinsDownloadArtifactsV1/task.loc.json index 7f3c1a9b8023..32331b52d211 100644 --- a/Tasks/JenkinsDownloadArtifactsV1/task.loc.json +++ b/Tasks/JenkinsDownloadArtifactsV1/task.loc.json @@ -17,7 +17,7 @@ "demands": [], "version": { "Major": 1, - "Minor": 137, + "Minor": 138, "Patch": 0 }, "groups": [ @@ -304,6 +304,7 @@ "SuccessfullyDownloadedCommitsAndWorkItems": "ms-resource:loc.messages.SuccessfullyDownloadedCommitsAndWorkItems", "CommitsAndWorkItemsDownloadFailed": "ms-resource:loc.messages.CommitsAndWorkItemsDownloadFailed", "CannotFindBuilds": "ms-resource:loc.messages.CannotFindBuilds", + "CannotParseCommits": "ms-resource:loc.messages.CannotParseCommits", "JenkinsNoCommitsToFetch": "ms-resource:loc.messages.JenkinsNoCommitsToFetch", "InvalidJenkinsBuildNumber": "ms-resource:loc.messages.InvalidJenkinsBuildNumber", "InvalidJenkinsStartBuildNumber": "ms-resource:loc.messages.InvalidJenkinsStartBuildNumber", From 591e03f52f8ba5fc836b4b38b17a7f4e806b7a85 Mon Sep 17 00:00:00 2001 From: Kalyan Date: Sat, 7 Jul 2018 16:04:50 +0530 Subject: [PATCH 2/3] Added L0 for commit url transformation --- Tasks/JenkinsDownloadArtifactsV1/Tests/L0.ts | 76 +++++++++++++++++++ .../Tests/L0ValidateGitHubCommitUrl.ts | 41 ++++++++++ .../Tests/L0ValidateGitLabCommitUrl.ts | 41 ++++++++++ .../Tests/L0ValidateHttpCommitUrl.ts | 41 ++++++++++ .../Tests/L0ValidateInvalidCommitUrl.ts | 41 ++++++++++ 5 files changed, 240 insertions(+) create mode 100644 Tasks/JenkinsDownloadArtifactsV1/Tests/L0ValidateGitHubCommitUrl.ts create mode 100644 Tasks/JenkinsDownloadArtifactsV1/Tests/L0ValidateGitLabCommitUrl.ts create mode 100644 Tasks/JenkinsDownloadArtifactsV1/Tests/L0ValidateHttpCommitUrl.ts create mode 100644 Tasks/JenkinsDownloadArtifactsV1/Tests/L0ValidateInvalidCommitUrl.ts diff --git a/Tasks/JenkinsDownloadArtifactsV1/Tests/L0.ts b/Tasks/JenkinsDownloadArtifactsV1/Tests/L0.ts index b62c5b3c0f20..f3784347e364 100644 --- a/Tasks/JenkinsDownloadArtifactsV1/Tests/L0.ts +++ b/Tasks/JenkinsDownloadArtifactsV1/Tests/L0.ts @@ -103,6 +103,82 @@ describe('JenkinsDownloadArtifacts L0 Suite', function () { } }); + it('Validate github commit url', (done) => { + + const tp: string = path.join(__dirname, 'L0ValidateGitHubCommitUrl.js'); + const tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp); + + try { + tr.run(); + + assert(tr.stdout.indexOf('Translated url git@github.com:user/TestRepo.git/commit/3cbfc14e3f482a25e5122323f3273b89677d9875 to https://github.com/user/TestRepo/commit/3cbfc14e3f482a25e5122323f3273b89677d9875') !== -1, tr.stdout); + + done(); + } catch(err) { + console.log(tr.stdout); + console.log(tr.stderr); + console.log(err); + done(err); + } + }); + + it('Validate gitlab commit url', (done) => { + + const tp: string = path.join(__dirname, 'L0ValidateGitLabCommitUrl.js'); + const tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp); + + try { + tr.run(); + + assert(tr.stdout.indexOf('Translated url git@gitlab.com:admin/projectk.git/commit/3cbfc14e3f482a25e5122323f3273b89677d9875 to https://gitlab.com/admin/projectk/commit/3cbfc14e3f482a25e5122323f3273b89677d9875') !== -1, tr.stdout); + + done(); + } catch(err) { + console.log(tr.stdout); + console.log(tr.stderr); + console.log(err); + done(err); + } + }); + + it('Validate http commit url', (done) => { + + const tp: string = path.join(__dirname, 'L0ValidateHttpCommitUrl.js'); + const tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp); + + try { + tr.run(); + + assert(tr.stdout.indexOf('Translated url https://github.com/user/TestRepo/commit/3cbfc14e3f482a25e5122323f3273b89677d9875 to https://github.com/user/TestRepo/commit/3cbfc14e3f482a25e5122323f3273b89677d9875') !== -1, tr.stdout); + + done(); + } catch(err) { + console.log(tr.stdout); + console.log(tr.stderr); + console.log(err); + done(err); + } + }); + + it('Validate invalid commit url', (done) => { + + const tp: string = path.join(__dirname, 'L0ValidateInvalidCommitUrl.js'); + const tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp); + + try { + tr.run(); + + assert(tr.stdout.indexOf('Translated url ssh://user@server/project.git/commit/3cbfc14e3f482a25e5122323f3273b89677d9875 to') !== -1, tr.stdout); + + done(); + } catch(err) { + console.log(tr.stdout); + console.log(tr.stderr); + console.log(err); + done(err); + } + }); + it('Should download commits from build range', (done) => { const tp: string = path.join(__dirname, 'L0DownloadCommitsFromBuildRange.js'); const tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp); diff --git a/Tasks/JenkinsDownloadArtifactsV1/Tests/L0ValidateGitHubCommitUrl.ts b/Tasks/JenkinsDownloadArtifactsV1/Tests/L0ValidateGitHubCommitUrl.ts new file mode 100644 index 000000000000..cffc75cf3f06 --- /dev/null +++ b/Tasks/JenkinsDownloadArtifactsV1/Tests/L0ValidateGitHubCommitUrl.ts @@ -0,0 +1,41 @@ +import ma = require('vsts-task-lib/mock-answer'); +import tmrm = require('vsts-task-lib/mock-run'); +import path = require('path'); +import mockTask = require('vsts-task-lib/mock-task'); +import helper = require("./JenkinsTestHelper"); + +const taskPath = path.join(__dirname, '..', 'jenkinsdownloadartifacts.js'); +const tr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath); + +tr.setInput("serverEndpoint", "ID1"); +tr.setInput("jobName", "myfreestyleproject") +tr.setInput("saveTo", "jenkinsArtifacts"); +tr.setInput("filePath", "/"); +tr.setInput("jenkinsBuild", "BuildNumber"); +tr.setInput("jenkinsBuildNumber", "20"); +tr.setInput("itemPattern", "archive/**"); +tr.setInput("downloadCommitsAndWorkItems", "true"); +tr.setInput("artifactDetailsFileNameSuffix", "alias_v1.json"); + +process.env['ENDPOINT_URL_ID1'] = 'http://url'; +process.env['ENDPOINT_AUTH_PARAMETER_connection1_username'] = 'dummyusername'; +process.env['ENDPOINT_AUTH_PARAMETER_connection1_password'] = 'dummypassword'; +process.env['ENDPOINT_DATA_ID1_acceptUntrustedCerts'] = 'true'; + +helper.RegisterArtifactEngineMock(tr); +helper.RegisterHttpClientMock(tr, (url: string) => { + if (url === "http://url/job/myfreestyleproject//api/json") { + return helper.GetSuccessExpectedResult('{}'); + } + + if (url === "http://url//job/myfreestyleproject//20/api/json?tree=artifacts[*]") { + return helper.GetSuccessExpectedResult('{ "_class": "hudson.model.FreeStyleBuild", "artifacts": [ "abc" ] }'); + } + + var commitResult = '{"actions":[{"remoteUrls":["git@github.com:user/TestRepo.git"]}],"changeSet":{"items": [{"commitId": "3cbfc14e3f482a25e5122323f3273b89677d9875", "author": { "fullName": "user" }, "msg": "test3", "date": "2018-07-07 12:18:48 +0530" }], "kind": "git"}}' + if (url == "http://url/job/myfreestyleproject//20/api/json?tree=number,result,actions[remoteUrls],changeSet[kind,items[commitId,date,msg,author[fullName]]]") { + return helper.GetSuccessExpectedResult(commitResult); + } +}); + +tr.run(); diff --git a/Tasks/JenkinsDownloadArtifactsV1/Tests/L0ValidateGitLabCommitUrl.ts b/Tasks/JenkinsDownloadArtifactsV1/Tests/L0ValidateGitLabCommitUrl.ts new file mode 100644 index 000000000000..391758f22090 --- /dev/null +++ b/Tasks/JenkinsDownloadArtifactsV1/Tests/L0ValidateGitLabCommitUrl.ts @@ -0,0 +1,41 @@ +import ma = require('vsts-task-lib/mock-answer'); +import tmrm = require('vsts-task-lib/mock-run'); +import path = require('path'); +import mockTask = require('vsts-task-lib/mock-task'); +import helper = require("./JenkinsTestHelper"); + +const taskPath = path.join(__dirname, '..', 'jenkinsdownloadartifacts.js'); +const tr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath); + +tr.setInput("serverEndpoint", "ID1"); +tr.setInput("jobName", "myfreestyleproject") +tr.setInput("saveTo", "jenkinsArtifacts"); +tr.setInput("filePath", "/"); +tr.setInput("jenkinsBuild", "BuildNumber"); +tr.setInput("jenkinsBuildNumber", "20"); +tr.setInput("itemPattern", "archive/**"); +tr.setInput("downloadCommitsAndWorkItems", "true"); +tr.setInput("artifactDetailsFileNameSuffix", "alias_v1.json"); + +process.env['ENDPOINT_URL_ID1'] = 'http://url'; +process.env['ENDPOINT_AUTH_PARAMETER_connection1_username'] = 'dummyusername'; +process.env['ENDPOINT_AUTH_PARAMETER_connection1_password'] = 'dummypassword'; +process.env['ENDPOINT_DATA_ID1_acceptUntrustedCerts'] = 'true'; + +helper.RegisterArtifactEngineMock(tr); +helper.RegisterHttpClientMock(tr, (url: string) => { + if (url === "http://url/job/myfreestyleproject//api/json") { + return helper.GetSuccessExpectedResult('{}'); + } + + if (url === "http://url//job/myfreestyleproject//20/api/json?tree=artifacts[*]") { + return helper.GetSuccessExpectedResult('{ "_class": "hudson.model.FreeStyleBuild", "artifacts": [ "abc" ] }'); + } + + var commitResult = '{"actions":[{"remoteUrls":["git@gitlab.com:admin/projectk.git"]}],"changeSet":{"items": [{"commitId": "3cbfc14e3f482a25e5122323f3273b89677d9875", "author": { "fullName": "user" }, "msg": "test3", "date": "2018-07-07 12:18:48 +0530" }], "kind": "git"}}' + if (url == "http://url/job/myfreestyleproject//20/api/json?tree=number,result,actions[remoteUrls],changeSet[kind,items[commitId,date,msg,author[fullName]]]") { + return helper.GetSuccessExpectedResult(commitResult); + } +}); + +tr.run(); diff --git a/Tasks/JenkinsDownloadArtifactsV1/Tests/L0ValidateHttpCommitUrl.ts b/Tasks/JenkinsDownloadArtifactsV1/Tests/L0ValidateHttpCommitUrl.ts new file mode 100644 index 000000000000..d2ed5bd0c34f --- /dev/null +++ b/Tasks/JenkinsDownloadArtifactsV1/Tests/L0ValidateHttpCommitUrl.ts @@ -0,0 +1,41 @@ +import ma = require('vsts-task-lib/mock-answer'); +import tmrm = require('vsts-task-lib/mock-run'); +import path = require('path'); +import mockTask = require('vsts-task-lib/mock-task'); +import helper = require("./JenkinsTestHelper"); + +const taskPath = path.join(__dirname, '..', 'jenkinsdownloadartifacts.js'); +const tr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath); + +tr.setInput("serverEndpoint", "ID1"); +tr.setInput("jobName", "myfreestyleproject") +tr.setInput("saveTo", "jenkinsArtifacts"); +tr.setInput("filePath", "/"); +tr.setInput("jenkinsBuild", "BuildNumber"); +tr.setInput("jenkinsBuildNumber", "20"); +tr.setInput("itemPattern", "archive/**"); +tr.setInput("downloadCommitsAndWorkItems", "true"); +tr.setInput("artifactDetailsFileNameSuffix", "alias_v1.json"); + +process.env['ENDPOINT_URL_ID1'] = 'http://url'; +process.env['ENDPOINT_AUTH_PARAMETER_connection1_username'] = 'dummyusername'; +process.env['ENDPOINT_AUTH_PARAMETER_connection1_password'] = 'dummypassword'; +process.env['ENDPOINT_DATA_ID1_acceptUntrustedCerts'] = 'true'; + +helper.RegisterArtifactEngineMock(tr); +helper.RegisterHttpClientMock(tr, (url: string) => { + if (url === "http://url/job/myfreestyleproject//api/json") { + return helper.GetSuccessExpectedResult('{}'); + } + + if (url === "http://url//job/myfreestyleproject//20/api/json?tree=artifacts[*]") { + return helper.GetSuccessExpectedResult('{ "_class": "hudson.model.FreeStyleBuild", "artifacts": [ "abc" ] }'); + } + + var commitResult = '{"actions":[{"remoteUrls":["https://github.com/user/TestRepo"]}],"changeSet":{"items": [{"commitId": "3cbfc14e3f482a25e5122323f3273b89677d9875", "author": { "fullName": "user" }, "msg": "test3", "date": "2018-07-07 12:18:48 +0530" }], "kind": "git"}}' + if (url == "http://url/job/myfreestyleproject//20/api/json?tree=number,result,actions[remoteUrls],changeSet[kind,items[commitId,date,msg,author[fullName]]]") { + return helper.GetSuccessExpectedResult(commitResult); + } +}); + +tr.run(); diff --git a/Tasks/JenkinsDownloadArtifactsV1/Tests/L0ValidateInvalidCommitUrl.ts b/Tasks/JenkinsDownloadArtifactsV1/Tests/L0ValidateInvalidCommitUrl.ts new file mode 100644 index 000000000000..feb3a538f6bf --- /dev/null +++ b/Tasks/JenkinsDownloadArtifactsV1/Tests/L0ValidateInvalidCommitUrl.ts @@ -0,0 +1,41 @@ +import ma = require('vsts-task-lib/mock-answer'); +import tmrm = require('vsts-task-lib/mock-run'); +import path = require('path'); +import mockTask = require('vsts-task-lib/mock-task'); +import helper = require("./JenkinsTestHelper"); + +const taskPath = path.join(__dirname, '..', 'jenkinsdownloadartifacts.js'); +const tr: tmrm.TaskMockRunner = new tmrm.TaskMockRunner(taskPath); + +tr.setInput("serverEndpoint", "ID1"); +tr.setInput("jobName", "myfreestyleproject") +tr.setInput("saveTo", "jenkinsArtifacts"); +tr.setInput("filePath", "/"); +tr.setInput("jenkinsBuild", "BuildNumber"); +tr.setInput("jenkinsBuildNumber", "20"); +tr.setInput("itemPattern", "archive/**"); +tr.setInput("downloadCommitsAndWorkItems", "true"); +tr.setInput("artifactDetailsFileNameSuffix", "alias_v1.json"); + +process.env['ENDPOINT_URL_ID1'] = 'http://url'; +process.env['ENDPOINT_AUTH_PARAMETER_connection1_username'] = 'dummyusername'; +process.env['ENDPOINT_AUTH_PARAMETER_connection1_password'] = 'dummypassword'; +process.env['ENDPOINT_DATA_ID1_acceptUntrustedCerts'] = 'true'; + +helper.RegisterArtifactEngineMock(tr); +helper.RegisterHttpClientMock(tr, (url: string) => { + if (url === "http://url/job/myfreestyleproject//api/json") { + return helper.GetSuccessExpectedResult('{}'); + } + + if (url === "http://url//job/myfreestyleproject//20/api/json?tree=artifacts[*]") { + return helper.GetSuccessExpectedResult('{ "_class": "hudson.model.FreeStyleBuild", "artifacts": [ "abc" ] }'); + } + + var commitResult = '{"actions":[{"remoteUrls":["ssh://user@server/project.git"]}],"changeSet":{"items": [{"commitId": "3cbfc14e3f482a25e5122323f3273b89677d9875", "author": { "fullName": "user" }, "msg": "test3", "date": "2018-07-07 12:18:48 +0530" }], "kind": "git"}}' + if (url == "http://url/job/myfreestyleproject//20/api/json?tree=number,result,actions[remoteUrls],changeSet[kind,items[commitId,date,msg,author[fullName]]]") { + return helper.GetSuccessExpectedResult(commitResult); + } +}); + +tr.run(); From 953b05fa589f4241ff427e14fee0b657ed8347f3 Mon Sep 17 00:00:00 2001 From: Kalyan Date: Sat, 7 Jul 2018 22:56:41 +0530 Subject: [PATCH 3/3] fixed typo --- .../ArtifactDetails/CommitsDownloader.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Tasks/JenkinsDownloadArtifactsV1/ArtifactDetails/CommitsDownloader.ts b/Tasks/JenkinsDownloadArtifactsV1/ArtifactDetails/CommitsDownloader.ts index b5f01990f50f..7f8b8ca8c407 100644 --- a/Tasks/JenkinsDownloadArtifactsV1/ArtifactDetails/CommitsDownloader.ts +++ b/Tasks/JenkinsDownloadArtifactsV1/ArtifactDetails/CommitsDownloader.ts @@ -179,7 +179,7 @@ export class CommitsDownloader extends ArtifactDetailsDownloaderBase { return JSON.stringify(commitMessages); - } catch(error) { + } catch (error) { console.log(tl.loc("CannotParseCommits", commits, error)); throw error; } @@ -193,7 +193,6 @@ export class CommitsDownloader extends ArtifactDetailsDownloaderBase { if (!!commitUrl) { if (commitUrl.startsWith('git@')) { tl.debug('repo url is a git protocol url'); - if (commitUrl.startsWith('git@gitlab.com')) { result= commitUrl.replace('git@gitlab.com:', 'https://gitlab.com/').replace('.git/', '/');