aqa-test-tools icon indicating copy to clipboard operation
aqa-test-tools copied to clipboard

TRS Server can't use Jenkins Password that has Special Characters

Open piyush286 opened this issue 6 years ago • 0 comments

Relevant Code Snippet

https://github.com/AdoptOpenJDK/openjdk-test-tools/blob/414ec78d4edadf6542ba2a53357e73037494ba21/TestResultSummaryService/JenkinsInfo.js#L64-L77

JenkinsInfo.js can't use the password that has special characters such as "!" to communicate with Jenkins properly, giving 401 Unauthorized error.

Helpful Links

https://github.com/jansepar/node-jenkins-api We tried replacing the original code with this snippet but didn't have much luck:

// Password that needs to be %-encoded
const { URL } = require('url');
const jenkinsUrl = new URL('https://[email protected]');
jenkinsUrl.password = 'some_weirdPASSWORD123!@#$%^&*()~`\\/;\'';
var jenkins = jenkinsapi.init(jenkinsUrl.href);

Workaround

  1. Can use a password that doesn't have special characters.
  2. Can use a token instead of password: https://stackoverflow.com/questions/45466090/how-to-get-the-api-token-for-jenkins.

piyush286 avatar Feb 28 '19 19:02 piyush286