0
TFS 2017をCDの前提条件として使用しています。 PowerShellを使用してリリースを再デプロイしようとしています。リリースを再デプロイするAPIはありますか?PowerShellでapiを使用してTFSリリースを再展開する方法
TFS 2017をCDの前提条件として使用しています。 PowerShellを使用してリリースを再デプロイしようとしています。リリースを再デプロイするAPIはありますか?PowerShellでapiを使用してTFSリリースを再展開する方法
あなたは、古いリリースを再配備するREST APIを呼び出し、特定のリリースIDとREST API経由環境IDを取得する必要があります。
あなたは、特定のリリースの環境再デプロイするPowerShellスクリプトの下に使用することができます:あなたは "再デプロイ" とはどういう意味ですか
Param(
[string]$Collecitonurl = "http://server:8080/tfs/DefaultCollection",
[string]$projectName = "YouTeamProjectName",
[string]$keepForever = "true",
[string]$user = "Domain\User",
[string]$token = "your token",
[string]$releaseid = "45" # Give the specific Release ID here
)
# Base64-encodes the Personal Access Token (PAT) appropriately
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user,$token)))
#Get releaseresponse
$Releaseurl= "$Collecitonurl/$projectName/_apis/Release/releases/$releaseid"
$releaseresponse = Invoke-RestMethod -Method Get -UseDefaultCredentials -ContentType application/json -Uri $Releaseurl
#Get all of the environment IDs from the release response:
$environmentIDs = $releaseresponse.environments.ForEach("id")
#Get the specific environment ID by grabbing the element in the environment IDs array:
$firstEnvironment = $environmentIDs[0]
$secondEnvironment = $environmentIDs[1]
$thirdEnvironment = $environmentIDs[2] # ...
#Create the JSON body for the deployment:
$deploymentbody = @"
{"status": "inprogress"}
"@
#Invoke the REST method to redeploy the release:
$DeployUrl = "$Collecitonurl/$projectName/_apis/release/releases/$releaseid/environments/"+$firstEnvironment+"?api-version=3.2-preview" # Change the envrionment ID accordingly based on your requirement.
$DeployRelease = Invoke-RestMethod -Method Patch -ContentType application/json -Uri $DeployUrl -Headers @{Authorization=("Basic {0}" -f $base64authinfo)} -Body $deploymentbody
write-host "environmentIDs:" $environmentIDs
ありがとうAndy-MSFT。その働き。 – user3744418
を?古いビルドに対して新しいリリースを実行しますか?古いリリースを再実行しますか? –
@ DanielMann、はい。古いリリースを再実行します。 – user3744418