huserben / TfsExtensions

Extensions for TFS 2015+ such as custom Widgets (require TFS 2017) and Build Tasks
MIT License
45 stars 22 forks source link

feature req: Possibility to add Demands #27

Closed veepee78 closed 6 years ago

veepee78 commented 6 years ago

Would it be possible to add possibility to add demands also for the build? Then I would be able to force used agent, for example.

huserben commented 6 years ago

Hi @veepee78

sounds like a good idea. I wasn't even aware that you can specify demands on the level of a single build, so far I just used it for a complete build configuration always.

I quickly checked and from the API perspective it is rather simple to achieve. However there are 2 different kinds of demands, "exists" and "equals" and we have to see how we manage to bring this properly in the configuration of the Task.

My proposal would be we simply add a "Demands" textbox and then we can specify the demands in a comma-separated way, where a "=" will be used for the equals and without the "=" it will just do a exists: Demands: "Demand1, Demand2=Test"

What do you think about that? I'm open for counter-proposals :-)

huserben commented 6 years ago

Hi again

so I have a running implementation that looks like this. In the configuration section under advanced we have now a new textbox:

grafik

This then will trigger the build with the specified demands, during initialization of the task the demands that check against a value will convert the syntax from "Demand = Value" to "Demand -equals Value" and try to queue a build with those demands:

grafik

Then we will try to kick off a build. However if no agent is found with those demands we will fail the task with the validation error message as given by TFS: grafik

The additional demands you can see in the log message are the ones defined by the tasks you are using in your build definition and that you cannot overwrite or anything. The demands additionally specified when triggering the build are just added on top of those.

Would this fit your requirement or do you have any other proposals on how to solve it?

Otherwise my plan is to update the Task during the course of this week (tomorrow or probably Thursday).

veepee78 commented 6 years ago

Hi, proposal sounds good to me.

VP:>_

On 12 Sep 2017 7.09 PM, "Benj Huser" notifications@github.com wrote:

Hi @veepee78 https://github.com/veepee78

sounds like a good idea. I wasn't even aware that you can specify demands on the level of a single build, so far I just used it for a complete build configuration always.

I quickly checked and from the API perspective it is rather simple to achieve. However there are 2 different kinds of demands, "exists" and "equals" and we have to see how we manage to bring this properly in the configuration of the Task.

My proposal would be we simply add a "Demands" textbox and then we can specify the demands in a comma-separated way, where a "=" will be used for the equals and without the "=" it will just do a exists: Demands: "Demand1, Demand2=Test"

What do you think about that? I'm open for counter-proposals :-)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/huserben/TfsExtensions/issues/27#issuecomment-328900165, or mute the thread https://github.com/notifications/unsubscribe-auth/AC7XSgrFJfwmxCQ6djoF1bcr1J6R32V_ks5shqvtgaJpZM4PUKmP .

huserben commented 6 years ago

Hi

I just uploaded version 2.2 of the Task which includes the option for specifying demands. Please check it out and let me know if it works as you want it to.

veepee78 commented 6 years ago

Seems to work. Demand has to be written exactly as in your example, with spaces. I did write it first time like xxx=yyy and it didn't work as it compiled the demand all together.

Any idea how to start build without sources? Don't really need any when just starting other builds. Not a big deal though to add some small directory as sources.

Thanks for fast response!

veepee78 commented 6 years ago

One more, would it be possible to run the "sub" build against same source / build agent directory as the main build? I guess vsts cannot do that? That would give an option to modularize bigger builds. A bit like task group.

huserben commented 6 years ago

Hi @veepee78 I adjusted the parsing so that the spaces around the "=" will be added automatically. Thanks for the feedback, didn't think about that before 👍

Without sources you mean that you basically skip the "GetSources" Task in the beginning. If so I am not aware of a possibility to do that. Regarding your second question, you mean that we sort of reuse the same workspace on the agent? Again I'm not aware of any option to achieve that. However I think those questions would be better directed towards the VSTS/TFS guys directly. In case you would get a positive answer feel free to add another issue so I could see if this could be built into the task

In case you don't have any more feedback for the demands I will close the feature in the coming days.

Thanks again for the feature request, I hope as well others can profit from it.

huserben commented 6 years ago

As I did not hear any complaints, I will close the issue.