[英]Jenkins Windows Batch Command Inject environment variable
I try to inject environment variable into Jenkins and use it on Editable Email Notification in order to send git commit information to others. 我尝试将环境变量注入Jenkins,并在可编辑电子邮件通知中使用它,以便将git commit信息发送给其他人。
echo GIT_COMMITTER_NAME=$(git show -s --format=%cn) > propsfile
echo GIT_COMMITTER_EMAIL=$(git show -s --format=%ce) >> propsfile
echo GIT_COMMIT=$(git show -s --format=%h) >> propsfile
echo GIT_MESSAGE=$(git show -s --format=%B) >> propsfile
Mac and Ubuntu Slave works fine with upper code, but windows just echo inside command. Mac和Ubuntu Slave可以与上层代码一起很好地工作,但是Windows只是在命令内部回显 。
For Example, 例如,
echo GIT_COMMITTER_NAME=$(git show -s --format=%cn)
returns 退货
GIT_COMMITTER_NAME=$(git show -s --format=%cn)
What I intend is 我打算是
echo GIT_COMMITTER_NAME=Committer Name
How to execute a command inside a command in Windows ? 在Windows中如何在命令内部执行命令?
I solve it by using Git Bash. 我通过使用Git Bash解决它。
I add Git Bash's Path into System Enviroment Path. 我将Git Bash的路径添加到系统环境路径中。 Therefore, I can use bash command directly from PowerShell.
因此,我可以直接从PowerShell使用bash命令。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.