Skip to content

Commit 20ad08e

Browse files
committed
Reduce number of parameter for node-test-pull-request-lite-pipeline
1 parent ca83833 commit 20ad08e

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

scripts/trigger-jenkins-build.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ function buildParametersForRepo (options, repo) {
3535
} else {
3636
return [
3737
{ name: 'CERTIFY_SAFE', value: 'true' },
38-
{ name: 'GITHUB_ORG', value: 'nodejs' },
39-
{ name: 'REPO_NAME', value: 'node' },
40-
{ name: 'PR_ID', value: options.number },
41-
{ name: 'REBASE_ONTO', value: '' }
38+
{ name: 'PR_ID', value: options.number }
4239
]
4340
}
4441
}
@@ -73,8 +70,7 @@ function triggerBuild (options, cb) {
7370
return cb(new Error(`Expected 200 from Jenkins, got ${response.statusCode}`))
7471
}
7572

76-
cb(null,
77-
`https://ci.nodejs.org/blue/organizations/jenkins/${jobName}/detail/${jobName}/${response.body.id}/pipeline`)
73+
cb(null, { jobName, jobId: response.body.id })
7874
})
7975
}
8076

@@ -86,14 +82,16 @@ function triggerBuildIfValid (options) {
8682
return logger.debug(`Ignoring comment to me by @${options.author} because they are not a repo collaborator`)
8783
}
8884

89-
triggerBuild(options, function onBuildTriggered (err, buildUrl) {
85+
triggerBuild(options, function onBuildTriggered (err, { jobName, jobId }) {
86+
const jobUrl = `https://ci.nodejs.org/job/${jobName}/${jobId}`
87+
let body = `Lite-CI: ${jobUrl}`
9088
if (err) {
9189
logger.error(err, 'Error while triggering Jenkins build')
92-
return createPrComment(options, `@${options.author} Sadly, an error occurred when I tried to trigger a build. :(`)
90+
body = 'Sadly, an error occurred when I tried to trigger a build. :('
91+
} else {
92+
logger.info({ jobUrl }, 'Jenkins build started')
9393
}
94-
95-
createPrComment(options, `@${options.author} build started: ${buildUrl}`)
96-
logger.info({ buildUrl }, 'Jenkins build started')
94+
createPrComment(options, body)
9795
})
9896
})
9997
}
@@ -121,6 +119,7 @@ function handleCommentCreated (event, owner, repo) {
121119
}
122120

123121
function handlePullCreated (event, owner, repo) {
122+
// eslint-disable-next-line camelcase
124123
const { number, logger, pull_request } = event
125124
const pullRequestAuthor = pull_request.user.login
126125
const options = {

0 commit comments

Comments
 (0)