當前構建狀態作爲構建步驟,我嘗試使用下面的命令行代碼來檢索當前構建的構建狀態:使用cURL檢索的TeamCity
curl –u "%system.teamcity.auth.userId%:%system.teamcity.auth.password%" \
"%teamcity.serverUrl%/httpAuth/app/rest/builds/id:%teamcity.build.id%/status"
當我在本地執行此操作,它工作並返回狀態,例如。 FAILURE
然而,當我在TeamCity的代理運行它,我得到以下回饋:
[15:11:21][Step 9/10] % Total % Received % Xferd Average Speed Time Time Time Current
[15:11:21][Step 9/10] Dload Upload Total Spent Left Speed
[15:11:21][Step 9/10] 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: –u
[15:11:21][Step 9/10] curl: (6) Could not resolve host: TeamCityBuildId=15124
[15:11:21][Step 9/10] 100 82 0 82 0 0 1536 0 --:--:-- --:--:-- --:--:-- 1536
[15:11:21][Step 9/10] "Authorization" header is not specified
[15:11:21][Step 9/10] To login manually go to "/login.html" page
[15:11:21][Step 9/10] Process exited with code 0
像它的下落,因爲驗證過這似乎給我。但爲什麼會發生?我已經指定了訪問憑證,爲什麼它沒有正確使用它們?
看來我必須在某處犯了一個錯字,因爲經過很多迭代後,返回到原來的'curl -u「%system.teamcity.auth.userId%:%system.teamcity.auth.password%」 「%teamcity.serverUrl%/ httpAuth/app/rest/builds/id:%teamcity.build.id%/ status」'請求現在對我來說也正常工作! –