最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Masking of secret in Jenkins logs - Stack Overflow

programmeradmin2浏览0评论

I have a custom script which fetch the secret from vault . ( I cannot use Jenkins credentials to store the secrets )

My code

def executeCommand(def command) {
    return sh(script: command, returnStatus: true, label: "Executing Command")
}
def cred = <call some script > ( Returns {username : '', password : '' } ) 
withEnv(["DOCKER_USER=${cred.username}", "DOCKER_PASS=${cred.password}"]) {
            def command = "printf '%s' \"\$DOCKER_PASS\" | docker login ${DockerRepo}.${tmpRepoUrl} -u \$DOCKER_USER --password-stdin"
            def status = executeCommand(command)
} 

The issue, It is printing the credentials in jenkins logs. [Pipeline] sh (Executing Command) (hide)

  • printf somepassword
  • docker login docker.test -u test --password-stdin WARNING! Your password will be stored unencrypted in /root/.docker/config.json.

How to avoid printing of command msg in Jenkins logs.

发布评论

评论列表(0)

  1. 暂无评论