我的新公司霸主要求我在客户门户上拥有每个工件的 SHA256 哈希值。当然,我可以自己生成或在构建脚本或 Makefile 中生成它,但这感觉就像 Jenkins 能够做的那样。
最佳答案
如果您的构建在 Unix/Linux 上运行,则可以从您的 Pipeline/Jenkinsfile 输出到 sha256sum
:
sha256sum = sh(returnStdout: true, script: "sha256sum '${fileName}'")
如果您的构建在 Windows 上运行,您可以使用
Get-FileHash
(我还没有测试过):sha256sum = powershell(
returnStdout: true,
script: "Get-FileHash -Algorithm sha256 -Path '${fileName}' | Select -ExpandProperty Hash"
)
关于jenkins - 是否有内置方法或插件可以让 Jenkins 为我的工件生成 SHA256 哈希?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31351312/