16

Here is our situation-- sometimes we need to run a vNext build without needing to pull any source code from TFS server.

But we don't want to change the workspace mappings. Is there a related setting simply ignore or disable the get source step in the build definition. Unlike any other task, the "Get sources" task added automatically when you create a new build definition, which is not able to disable or remove the task by right click it.

Any suggestion appreciated!

Tomhans.J
  • 440
  • 1
  • 4
  • 15

3 Answers3

19

Update:

Now you should use below to avoid syncing sources at all:

Classic Editor: agent.source.skip=true

YAML:

steps:
- checkout: none

It's not able to directly disable/remove the Get Sources task. However, you could add a variable to achieve it:

Build.SyncSources = false

enter image description here

You can see from below screenshot, the Get Sources operation started and finished without fetching the data from TFS version control

enter image description here

Note: This variable works with TFS 2017 and above/VSTS vNext builds.

More detail info please take a look at this helpful blog.

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • 5
    However, this setting enforces leaving System.DefaultWorkingDirectory variable to be `undefined` which causes to `Path must be a string. Received undefined` error when, for example, trying to execute Queue Jenkins Job step – Leo Y Jun 06 '18 at 14:44
  • 1
    $(Build.SourcesDirectory) for instance is obviously also undefined. So if you are just looking for disabling the Get Sources step as a temporary solution for winning some time on a 100.000 files build, it may mess up with your other build steps... But this solution may be indeed applicable to other cases. – sɐunıɔןɐqɐp Feb 07 '19 at 07:55
  • What if we only want to skip this step for a specific phase in a multi-phase build? – itsho May 30 '19 at 07:10
  • @itsho did you get a solution for this? I also want to disable it for one phase only. – Mehul Parmar Sep 04 '20 at 08:14
  • @MehulParmar yes - see my answer below - https://stackoverflow.com/a/56374099/426315 – itsho Sep 04 '20 at 13:31
  • @itsho but this will disable for all phases – Mehul Parmar Sep 04 '20 at 13:39
  • @MehulParmar you are right. I've misread your question. it will be disabled for all phases. sorry about that. – itsho Sep 04 '20 at 14:42
6

I tried using agent.source.skip = true (instead of Build.SyncSources = false),

and it seems to keep the variables.

Found here: https://github.com/Microsoft/azure-pipelines-agent/issues/1465

itsho
  • 4,640
  • 3
  • 46
  • 68
0

From classic editor here is the way to skip "Get Sources".

enter image description here

enter image description here

Romesh
  • 2,291
  • 3
  • 24
  • 47