jenkinsci / nomad-plugin

Nomad cloud plugin for Jenkins
https://plugins.jenkins.io/nomad/
MIT License
56 stars 41 forks source link

Added constraints to Nomad Cloud plugin #17

Closed scarvel8 closed 6 years ago

scarvel8 commented 7 years ago

This adds the ability to impose constraints on a job submitted to Nomad via the Nomad Cloud plugin.

https://www.nomadproject.io/docs/job-specification/constraint.html

This plugin uses the JSON form to submit jobs (https://www.nomadproject.io/docs/http/json-jobs.html), therefore it uses the LTarget, RTarget, and Operand form to impose constraints. ${ } is automatically wrapped around the LTarget as most job constraints would use this parameter.

For example, to restrict to linux machines, you would add to the constraint field: attr.kernel.name,windows,=

Items are comma separated, groups of three are required, the field is optional.

jippi commented 7 years ago

The code looks good, though we should either document the caveats of some features, probably, not working atm - that said, having basic constraints working is better than no constraints at all !

scarvel8 commented 7 years ago

Working on an update that will cover all contraints and be a lot more friendly in the UI, stay tuned :)

jippi commented 7 years ago

Exciting stuff @scarvel8 !

jippi commented 7 years ago

did this stall @scarvel8 ? :)

scarvel8 commented 7 years ago

Implemented the GUI changes and it works when saved, but had some problems getting values to recall back into the GUI when you re-enter Configure System. Hopefully will get the chance to work on this by the end of the week

jippi commented 7 years ago

Nice! good job!

scarvel8 commented 7 years ago

Updated PR and tested, usage should be pretty straightforward (this version allows symbols in the text fields and uses a Jelly repeatable to be able to add and remove constraints easily from the GUI). @jippi

antweiss commented 7 years ago

Not finding the time to test this. Anyone volunteering to test and confirm it works?

jippi commented 7 years ago

@scarvel8 what did the status for this PR end with? stable?

zstyblik commented 7 years ago

Hello, are there plans to merge this?

jovandeginste commented 7 years ago

@jippi @scarvel8 I built and installed this fork in our production environment. I will start using it for production load today and report back. First tests and impressions seem to indicate it works as expected.

jovandeginste commented 7 years ago

Seems to work so far with some production load.

scarvel8 commented 7 years ago

@jovandeginste sounds good, @jippi it has been working for me for my minor use case, but I admit I have not tested exhaustively

zstyblik commented 6 years ago

It works for me as well, although I have only one constrain so far :)

jovandeginste commented 6 years ago

Had no issues so far, lgtm

scarvel8 commented 6 years ago

Any reason against merging this?

zstyblik commented 6 years ago

@jippi ?