Skip to content

Commit

Permalink
jenkins: handle IPv4 remote address converted to IPv6 (#161)
Browse files Browse the repository at this point in the history
After the Jenkins IP whitelist was activated, the inline PR status
reports for nodejs/node seems to be broken.

Seems like the issue here is that IPv4 remote addresses are converted
to IPv6, which wasn't expected too happen.. Stripping any IPv6 parts
off the remote addresses should make our IPv4 comparisons work as
expected.

Refs nodejs/build#1016
Refs nodejs/build#985
  • Loading branch information
phillipj committed Nov 27, 2017
1 parent 5c683d3 commit 994fec2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/jenkins-status.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const enabledRepos = ['citgm', 'http-parser', 'node']
const jenkinsIpWhitelist = process.env.JENKINS_WORKER_IPS ? process.env.JENKINS_WORKER_IPS.split(',') : []

function isJenkinsIpWhitelisted (req) {
const ip = req.connection.remoteAddress
const ip = req.connection.remoteAddress.split(':').pop()

if (jenkinsIpWhitelist.length && !jenkinsIpWhitelist.includes(ip)) {
req.log.warn({ ip }, 'Ignoring, not allowed to push Jenkins updates')
Expand Down

0 comments on commit 994fec2

Please sign in to comment.