回答

0

您需要为凭证选择助记符ID,然后在Jenkinsfile中对其进行硬编码。此时,您可以使用Credentials Binding插件来检索实际的秘密。

1

您使用“withCredentials”来公开秘密。 (显然回应这个秘密将是一个保守秘密的好方法 - 但是你可以把这个秘密传递给其他没有打印出来的东西......)

withCredentials([[$class : 'StringBinding', 
        credentialsId : 'my_secret_token', 
        variable: 'GHE_TOKEN', 
       ]]) { 
    echo "I can access my secret token of ${env.GHE_TOKEN} now" 
}