Is there a way to force the use of the same agent directory for all jobs inside of a stage?

Viewed 746

So I'm setting up a new build pipeline, which is quite complex, it is multi stage and inside the stages multi job.

But I run into problems because when I try to save some tasks by relying on the second and third job of one stage being executed in the same agent working folder. Of course this doesn't really work. It actually works sometimes, but sometimes not. I would expect the different jobs to either always run in the same folder as the job before or never, but not sometimes.

Anyway, so I was wondering if there is a way of restraining the entire stage or pipeline to a single working directory. Anybody any ideas? Thanks!!!

1 Answers

is there a way of restraining the entire stage or pipeline to a single working directory

No, there isn't. The agent gets to pick what subdirectory of its working directory is used as the workspace for any given job, and that's not controllable.

Also, relying on the same workspace being used for each job assumes that the same agent is used for each job, which is not how jobs and agents are designed to work. Each job is assumed to be logically independent, and capable of running on whichever agent presents itself (from the pool) as available.

unless there is only a single agent in the pool that meets the demands, there is no guarantee that subsequent jobs will use the same agent as previous jobs.

Related