piyush0101 / jenkins-view-builder

Other
6 stars 12 forks source link

cannot serialize regex #3

Closed mark-casey closed 9 years ago

mark-casey commented 9 years ago

Please let me know if there is a better place for asking this. I didn't see any specific guidance but I may have missed it. :)

I am able to test and update a handful of view configs, but when I try to use the regex: tag in the YAML I get:

jenkins@mack:~$ jenkins-view-builder test jenkins_CUSTOM/jvb/faster.yml
cannot serialize {'regex': '.*-faster(-.*|$)'} (type dict)
jenkins@mack:~$

Some research on the Google seems to indicate this may be coming from eTree? I tried it in a straightforward way, and also tried to use an Anchor and Alias to see if I could change the evaluation order a bit and trick it into a happier codepath. Here are those:

normal

- view:
    type: list
    name: faster
    description: faster
    jobs:
     - regex: '.*-faster(-.*|$)'
    columns:
     - status
     - weather
     - build_button
     - job
     - last_duration
     - last_success
     - last_failure
    recurse: False

attempt at being clever

- view:
    regex: &regex_anchor { regex: '.*-faster(-.*|$)' }
    type: list
    name: faster
    description: faster
    jobs:
     - *regex_anchor
    columns:
     - status
     - weather
     - build_button
     - job
     - last_duration
     - last_success
     - last_failure
    recurse: False

I was wondering if anything jumps out at you in this, or what steps I might take next.

piyush0101 commented 9 years ago

Can you try the following yaml. You can omit the jobs section all together and just include the includeRegex flag. I do agree that its not very intuitive. We should have regex instead of an includeRegex flag. Please let me know how it goes.

- view:
    type: list
    name: faster
    description: faster
    includeRegex: '.*-faster(-.*|$)'
    columns:
     - status
     - weather
     - build_button
     - job
     - last_duration
     - last_success
     - last_failure
    recurse: False
piyush0101 commented 9 years ago

e83ebe0d7ec2 includeRegex flag was included twice in the generated xml. Removing it from the list template.

mark-casey commented 9 years ago

Thanks, that is working!

I'm not sure if it was immediately necessary, but I did also manually edit the list template to remove the duplicate includeRegex line since it seems to be related.

piyush0101 commented 9 years ago

I think that might be necessary. I also made a commit with that fix and will do a 0.5.1 release very soon.

On Wednesday, May 27, 2015, Mark Casey notifications@github.com wrote:

Thanks, that is working!

I'm not sure if it was immediately necessary, but I did also manually edit the list template to remove the duplicate includeRegex line since it seems to be related.

— Reply to this email directly or view it on GitHub https://github.com/piyush0101/jenkins-view-builder/issues/3#issuecomment-106083608 .

Piyush

mark-casey commented 9 years ago

Oh, yes. Well that removal certainly made sense, but in this case I was just manually recreating your commit. Not that it matters much, but it wasn't that I just happened to see it at the same time or something.

Thanks again.