【问题标题】:How can I check-in files in TFS with azure pipelines如何使用 azure 管道在 TFS 中签入文件
【发布时间】:2019-05-14 23:09:28
【问题描述】:

我正在尝试自动化构建 javascript 包的本地部署脚本,然后在 TFS 命令行工具的帮助下,它将包签入到 TFS 存储库中。

现在我有构建捆绑包的管道,但我仍然需要一个将创建的文件放入 TFS 的最后一个任务。请务必注意,TFS 在另一个项目中。

是否有 Taks 可以签入到 TFS?如果没有,如果不使用自定义脚本,我有什么替代方案?

【问题讨论】:

    标签: azure tfs azure-devops azure-pipelines


    【解决方案1】:

    我编写了一个小 PowerShell 脚本来从我的构建中签入:

    $newCodeFolderPath = "$($env:Agent_BuildDirectory)\newCode"
    $tempWorkspacePath =  "$($env:Agent_BuildDirectory)\tempWorkspace"
    
    New-Item -Path $newCodeFolderPath -ItemType directory
    
    Copy-Item -Path "/your/fules/you/want/checkin" -Recurse -Destination $newCodeFolderPath 
    
    New-Item -Path $tempWorkspacePath -ItemType directory
    
    cd $tempWorkspacePath 
    
    #For VS 2017 (in other versions the tf.exe location is different)
    $tfExe = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\tf.exe"
    
    & $tfExe workspace /collection:{TfsCollection} /new "TempWorkspace" /noprompt
    
    & $tfExe workfold "{TFS proeject path (where you want to check in)}" $tempWorkspacePath 
    
    Copy-Item -Path "$($newCodeFolderPath)/*" -Recurse -Destination $tempWorkspacePath 
    
    & $tfExe add * /recursive /noignore
    
    & $tfExe checkin /recursive /comment:"from build"
    
    & $tfExe workspace /delete /collection:{TfsCollection} "Tempworkspace"
    
    cd c:/
    Remove-Item -Path $newCodeFolderPath -Force -Recurse
    Remove-Item -Path $tempWorkspacePath -Force -Recurse
    

    【讨论】:

    • 非常感谢!首先我试图直接使用 tf.exe,就好像它暴露在 %PATH% 中一样,然后我认为它不是代理的一部分
    猜你喜欢
    • 2021-02-06
    • 2020-04-05
    • 2020-06-14
    • 1970-01-01
    • 2021-01-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多