locked
Lost Workflowtask (task group) after update release definition RRS feed

  • Question

  • Hi all

    I've release definition which has more than environment (QA, Stage...). Within environment, I've agent phase. Within agent phase, I've task group. Initially, the release definition is having trigger option (QA - auto, Stage - manual). What I've trying to do is:

    1. Download release definition

    2. Update release definition (just change the trigger option for Stage environment from manual to auto)

    3. Import release definition.

    After I downloaded, updated and import release definition, the agent phase name is automatically changed to the same name as environment, and the task group is lost. I went to history and do a diff, I see the agent phase name is changed and entire Workflowtask section is gone for all environment. I checked json file that I downloaded and updated, and it does have workflowtask section. Am I missing something or this is a bug? Below is my powershell script. Please advise.

    $releaseuri = $tpcUri + "/" + $teamprojectname + "/_apis/Release/definitions/" + $releaseid 
    Write-Host $releaseuri
    $releasetemplate = $downloadlocation + "\" + $releasetemplatename
    Write-Host $releasetemplate
    # Get release definition and save to local computer
    $Jsonfile = Invoke-RestMethod -Uri $releaseuri -Method Get -UseDefaultCredentials
    $Jsonfile | ConvertTo-Json -depth 100 | Out-File $releasetemplate


    $ReleaseFile = "C:\DevOps\updatedmytest1.json"
    
    #import release definition
    $Uri = $tpcUri + "/" + $teamprojectname + "/_apis/release/definitions?api-version=3.0-preview.2"
    Write-Verbose "URI: $uri"
    Write-Host "Importing release definition........"
    $release = gc $ReleaseFile -Raw -ea Stop
    $result = Invoke-RestMethod -Method Post -UseDefaultCredentials -ContentType application/json -Uri $Uri -Body $release

    Best Regards,

    Andy Pham


    Best Regards, Andy Pham


    • Edited by AndyPham Wednesday, November 29, 2017 6:03 PM
    Wednesday, November 29, 2017 4:41 PM

Answers

  • Hi Andy,

    Which version of TFS are you using?

    If you are using VSTS, try to change the api version to api-version=4.1-preview.3.

    If you are using TFS 2017, try to change the api version to api-version=3.2-preview.3.

    Best regards,


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    • Marked as answer by AndyPham Thursday, November 30, 2017 4:44 PM
    Thursday, November 30, 2017 7:21 AM

All replies

  • Hi Andy,

    Which version of TFS are you using?

    If you are using VSTS, try to change the api version to api-version=4.1-preview.3.

    If you are using TFS 2017, try to change the api version to api-version=3.2-preview.3.

    Best regards,


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    • Marked as answer by AndyPham Thursday, November 30, 2017 4:44 PM
    Thursday, November 30, 2017 7:21 AM
  • Cece Dong,

    Specific api-version=3.2-preview.3 is fixed the import release definition issue. Thanks

    Best Regards,

    Andy Pham


    Best Regards, Andy Pham

    Thursday, November 30, 2017 4:44 PM