fix: use string concat for npm auth to avoid Jenkins sandbox GString.getBytes restriction

这个提交包含在:
XuqmGroup 2026-05-16 12:19:14 +08:00
父节点 44df386935
当前提交 987e4f5952

4
Jenkinsfile vendored
查看文件

@ -39,7 +39,7 @@ pipeline {
steps { steps {
withCredentials([usernamePassword(credentialsId: 'NEXUS_CREDS', passwordVariable: 'NPM_PASS', usernameVariable: 'NPM_USER')]) { withCredentials([usernamePassword(credentialsId: 'NEXUS_CREDS', passwordVariable: 'NPM_PASS', usernameVariable: 'NPM_USER')]) {
script { script {
def auth = "${NPM_USER}:${NPM_PASS}".bytes.encodeBase64().toString() def auth = (NPM_USER + ':' + NPM_PASS).bytes.encodeBase64().toString()
writeFile file: '.npmrc', text: "@xuqm:registry=https://nexus.xuqinmin.com/repository/npm-hosted/\n//nexus.xuqinmin.com/repository/npm-hosted/:_auth=${auth}\n" writeFile file: '.npmrc', text: "@xuqm:registry=https://nexus.xuqinmin.com/repository/npm-hosted/\n//nexus.xuqinmin.com/repository/npm-hosted/:_auth=${auth}\n"
bat 'npm install --legacy-peer-deps' bat 'npm install --legacy-peer-deps'
} }
@ -68,7 +68,7 @@ pipeline {
steps { steps {
withCredentials([usernamePassword(credentialsId: 'NEXUS_CREDS', passwordVariable: 'NPM_PASS', usernameVariable: 'NPM_USER')]) { withCredentials([usernamePassword(credentialsId: 'NEXUS_CREDS', passwordVariable: 'NPM_PASS', usernameVariable: 'NPM_USER')]) {
script { script {
def auth = "${NPM_USER}:${NPM_PASS}".bytes.encodeBase64().toString() def auth = (NPM_USER + ':' + NPM_PASS).bytes.encodeBase64().toString()
writeFile file: '.npmrc', text: "@xuqm:registry=https://nexus.xuqinmin.com/repository/npm-hosted/\n//nexus.xuqinmin.com/repository/npm-hosted/:_auth=${auth}\n" writeFile file: '.npmrc', text: "@xuqm:registry=https://nexus.xuqinmin.com/repository/npm-hosted/\n//nexus.xuqinmin.com/repository/npm-hosted/:_auth=${auth}\n"
bat "npm publish --workspaces --registry %NEXUS_REGISTRY%" bat "npm publish --workspaces --registry %NEXUS_REGISTRY%"
} }