Advertisement
Guest User

Untitled

a guest
Jul 13th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. $Username = '!username!'
  2. $Password = '!password!'
  3. $BuildTypeId = '!build type id from teamcity!'
  4.  
  5. $Pair = "$($Username):$($Password)"
  6. $EncodedCredentials = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($Pair))
  7. $Headers = @{
  8. Authorization = "Basic $EncodedCredentials";
  9. Accept = "application/json"
  10. }
  11.  
  12. $Body = '<build branchName="v1.26.1"><buildType id="#{buildTypeId}"/><comment><text>Build was triggered by GitLab.</text></comment><properties /></build>' -Replace "#{buildTypeId}", $BuildTypeId
  13. Invoke-WebRequest -Uri 'http://teamcity.host/httpAuth/app/rest/buildQueue' -Method POST -Body $Body -UseBasicParsing -Headers $Headers -ContentType "application/xml"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement