For some other reasons, that PR did not get merged. However, even if that
did get merged, running multiple agents with the same work dir would not be
possible/advisable. They would totally step over each other. Moreover,
there would be no guarantee that the second stage runs on the same agent,
right after the first stage. It's possible that the first stage runs again,
for a new commit, before the second stage is picked up.

The recommended solution would be to use artifacts (publish in first stage,
fetch in second). However, you already mentioned that you tried it and it
was too slow for your case.


Another approach could be to use some kind of a cache or artifact
repository (Nexus, etc).


If that is too heavyweight, I guess you can see if you can implement a
simple cache on the agent. Something like this:

   1. Finish stage 1. At the end, copy artifacts into:
   
C:\my-artifacts\pipeline-name\pipeline-counter\stage-name\stage-counter\job-name\
   2. In stage 2, see if those artifacts exist, using the corresponding
   environment variables
   
<https://docs.gocd.org/current/faq/environment_variables.html#standard-gocd-environment-variables>
   and copy them back and use them. If not, build them.

This takes a little more scripting, but it ensures that the correct
artifacts will be used, rather than hoping that the second stage runs on
the same agent machine, immediately after the first stage.
Cheers,
Aravind




On Thu, Oct 26, 2017 at 5:16 AM, Raghu Gattapur <[email protected]> wrote:

> In the scenario where Stage 1  would checkout the source from git and
> restore nuget packages then build the application. In second stage multiple
> services and local nuget packages are being produced which is a time
> consuming process with one working Agent. So thought of running tasks in
> parallel which can only be accomplished by multiple agents, for that
> initially tried using artifacts but that increased the time lapse even
> more.
> The only reason to have same work directory(sandbox) is to share the
> existing result of previous stage in same machine.
>
> On Thursday, 26 October 2017 04:04:50 UTC+1, David Rice wrote:
>>
>> Can I ask why you want to do that? Even if you got it to work, the
>>  agents would be stepping all over each other. What are you trying to
>> accomplish? Maybe we can help you figur out a different approach.
>>
>> On Wed, Oct 25, 2017 at 5:22 PM Raghu Gattapur <[email protected]> wrote:
>>
>>> Tried settings -Dagent.work.dir as suggested here
>>> https://github.com/gocd/gocd/pull/2754 but no success.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "go-cd" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "go-cd" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to