powershell -NonInteractive -ExecutionPolicy绕过-Command

时间:2019-06-07 17:28:41

标签: powershell github bamboo

在我的竹制远程计算机上制定计划失败时

我尝试检查env中的路径,一切似乎都很好

Failing task since return code of [powershell -NonInteractive -ExecutionPolicy bypass -Command C:\Users\xxx\bamboo-agent-home\temp\AA-GO354-ET-38-ScriptBuildTask-8740122041187922133.ps1] was -1 while expected 0
Finished task 'Set Github test status to completed' with result: Failed

1 个答案:

答案 0 :(得分:0)

仅使用任务标题,如果使用Invoke-WebRequest,则可能需要在脚本中添加一行以使用TLS 1.2。

我抓取了我用来报告状态的Github Status PS脚本,它看起来像这样。显然,请填写您自己的__GITHUB_REPO____GITHUB_TOKEN__

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri https://api.github.com/repos/__GITHUB_REPO__/statuses/${bamboo.repository.revision.number} -Headers @{"Authorization"="[__GITHUB_TOKEN__]"} -UseBasicParsing -Method POST -Body @'
{"state":"success","description":"The Bamboo CI build was successful.","target_url":"${bamboo.buildResultsUrl}"}
'@