简体   繁体   English

TFS2015脚本只能部署(而非构建)吗?

[英]Can a TFS2015 script only Deploy (and not Build)?

I am new to the world of scripting with TFS2015. 我不熟悉TFS2015的脚本编写世界。 I created a script that builds all of the projects within my solution (it is a rather large solution) and puts it out in a shared folder (where each project has its own subfolder). 我创建了一个脚本,该脚本在我的解决方案(这是一个相当大的解决方案)中构建所有项目,并将其放入共享文件夹(每个项目都有自己的子文件夹)中。

I would like to create a separate script for each project that simply copies the bin folder from the shared and pastes it out on my Test environment. 我想为每个项目创建一个单独的脚本,该脚本仅从共享中复制bin文件夹并将其粘贴到我的Test环境中。 I rarely need to deploy everything, so the idea is one build...multiple deploys. 我很少需要部署所有内容,因此这个想法是一个构建...多个部署。

However, when I run my deploy script using the Copy Files step it is doing another build. 但是,当我使用“ Copy Files步骤运行部署脚本时,它正在执行另一个构建。 Although it copies the files that I expect, it is after a full build that creates the folder structure for the build. 尽管它复制了我期望的文件,但它是在完整构建后为该构建创建文件夹结构的。

Am I able to make the Copy Files step NOT do a Build? 我是否可以使“ Copy Files步骤不进行构建?

Here is the steps that my script is curently doing: 这是我的脚本当前正在执行的步骤:

在此处输入图片说明

As you can see, there is only one step (Copy Files) but it still does the Get sources and copies everything into a new folder on the build box like so (where the number keeps incrementing up with each run of the script): 如您所见,只有一个步骤(复制文件),但是它仍然执行Get sources并将所有内容复制到构建框上的新文件夹中,如下所示(其中数字随着脚本的每次运行而不断增加):

在此处输入图片说明

I just want to copy the files from the Source to the Target and not do a build or Get Sources . 我只想将文件从Source复制到Target ,而不要构建或Get Sources

It looks like you're still on TFS 2015 RTM or Update 1. Which is already pretty old technology if you compare it to the lifetime of the new build system which was introduced with this version. 看来您仍在使用TFS 2015 RTM或Update1。如果将其与该版本所引入的新构建系统的生命周期进行比较,则它已经是相当古老的技术。

TFS 2015 update 2 has introduced a similar system to the Build pipelines to orchestrate Releases . TFS 2015更新2已将类似的系统引入到构建管道以协调发行版中 This doesn't require you to map any workspaces or git repositories and can act on the artefacts of your builds or simply on the contents of file shares. 这不需要您映射任何工作空间或git存储库,并且可以对构建的工件或仅对文件共享的内容进行操作。

在此处输入图片说明

It makes sense that a Build has to build something and in order to build something, it has to get the things to build. 有意义的是,Build必须构建某些东西,并且为了构建某些东西,它必须获取要构建的东西。 If you're actually not building something, then you're probably deploying or releasing or packaging something else. 如果您实际上不是在构建某些东西,则可能是在部署,发布或打包其他东西。 Hence the distinction between Build and Release pipelines. 因此,构建和发布管道之间的区别。

TFS 2017+ has an option to disable the syncing of sources . TFS 2017+可以选择禁用源同步 Primarily to allow people to get the sources themselves in creative ways (eg a custom powershell script that invokes git.exe). 主要是为了使人们能够以创造性的方式(例如,调用git.exe的自定义powershell脚本)获取源代码。

My primary advice would be to upgrade to TFS 2018 update 3 or at least TFS 2017 update 3.1 , worst case TFS 2015 update 4.1 . 我的主要建议是升级到TFS 2018更新3或至少升级到TFS 2017更新3.1 ,最坏的情况是TFS 2015更新4.1 The fact that versions older than update 2015.4.1 have a known XSS scripting security bug may be reason enough to convince your organisation to perform this update. 早于更新2015.4.1的版本具有一个已知的XSS脚本安全漏洞 ,这一事实可能足以说服您的组织执行此更新。

Barring that option you're left with one solution: 除非您选择该选项,否则您将获得一个解决方案:

Link your build definition either to a git repository with only a single commit (If I remember correctly the 2015 agent still crashes when syncing an empty Git repo) or link it to a TFVC repository and set the workspace settings to cloak everything. 只需一次提交即可将您的构建定义链接到git存储库(如果我没记错的话,如果同步一个空的Git存储库,2015代理仍然崩溃),或者将其链接到TFVC存储库并设置工作区设置以隐藏所有内容。 This essentially causes the build to sync an empty folder, which it can cache, before calling your powershell script. 这实质上会导致构建在调用Powershell脚本之前同步一个可以缓存的空文件夹。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM