我正在尝试使用Dockerfile创建用于Jenkins作业的映像。我当前的实现方式类似于https://issues.jenkins-ci.org/browse/JENKINS-51763,因此我也遇到了相同的问题,即凭据未在日志中被屏蔽。
我可以使用任何解决方法吗?还是有某种方式可以掩盖凭据?
在下面粘贴Jenkins文件:
def ARTIFACTORY_USERNAME
def ARTIFACTORY_PASSWORD
node {
//https://issues.jenkins-ci.org/browse/JENKINS-51763
withCredentials([usernamePassword(credentialsId: 'ArtifactoryCredentials', passwordVariable: 'artifactoryPassword', usernameVariable: 'artifactoryUser')]) {
ARTIFACTORY_USERNAME = "${artifactoryUser}"
ARTIFACTORY_PASSWORD = "${artifactoryPassword}"
}
}
pipeline {
agent {
dockerfile {
args "--privileged=true"
additionalBuildArgs "--build-arg ARTIFACTORY_USERNAME=\"" + "${ARTIFACTORY_USERNAME}" + '" --build-arg ARTIFACTORY_PASSWORD="' + "${ARTIFACTORY_PASSWORD}" + '"'
}
}
stages {
stage ('Environment') {
steps {
sh "env | sort"
}
}
}
}