jessehouwing / azure-pipelines-tfvc-tasks

Azure Pipelines tasks for Team Foundation Version Control
https://marketplace.visualstudio.com/items?itemName=jessehouwing.jessehouwing-vsts-tfvc-tasks
MIT License
28 stars 17 forks source link

Use it inside a Release Pipeline #101

Open DPD85 opened 4 years ago

DPD85 commented 4 years ago

Hi,

the extension description say "Build extensions that enable you to interact with TFVC repositories.". That's mean that the extension can't be used inside a the release pipeline?

I have the necessity to update a some files inside another repository after the creation of a project release.

Thanks.

jessehouwing commented 4 years ago

The tasks assume an existing workspace definition. I haven't tried these tasks in the context of a TFVC release artifact, but it may work.

I'd accept a PR.

There is no task to create a workspace and get a version.

If that doesn't work, consider calling tf.exe since 2018 it has supported passing the OAuth token to the commandline to work in the context of a build server.

On Tue, Oct 6, 2020, 19:04 Dario Passet notifications@github.com wrote:

Hi,

the extension description say "Build extensions that enable you to interact with TFVC repositories.". That's mean that the extension can't be used inside a the release pipeline?

I have the necessity to update a some files inside another repository after the creation of a project release.

Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jessehouwing/azure-pipelines-tfvc-tasks/issues/101, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA724S3IWR3J73XOT5ASIRDSJNE3LANCNFSM4SGJQ7VQ .

jessehouwing commented 3 years ago

I once started a port to Typescript, it has all the details to call tf.exe with the right parameters to make it work on the agent:

https://github.com/jessehouwing/azure-pipelines-tfvc-tasks/blob/features/typescript/vsts-tfvc-add/TfvcAdd.ts

  - powershell: |
      & tf vc command /loginType:oauth /login:.,$($env:SYSTEM_ACCESSTOKEN)
    env:
      SYSTEM_ACCESSTOKEN: $(System.AccessToken)

Should get you started. You can use vswhere to find tf:

$path = & $PSScriptRoot/vswhere.exe -latest -products * -requires Microsoft.VisualStudio.TeamExplorer -property installationPath
    if ( -not [string]::IsNullOrWhiteSpace($path)) 
    {
        Write-Message -Type Debug "Found Visual Studio 2017 or newer."
        $path = join-path $path '\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\'
        return $path
    }