parsing pipeline files to CST or AST

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

parsing pipeline files to CST or AST


I'd like to obtain some information about pipeline files I have in our
repository. Such information is whether the pipeline is declarative,
whether it defines parameters, list parameter names and similar.

So I'm trying to create a CST or AST that I can scan through to see
certain properties of these pipelines.

After looking at the available options I tried the following:

> groovy:000> parser = SourceUnit.create("some.jenkinsfile", s, /*tolerance*/ 1)
> groovy:000> parser.parse()
===> null
groovy:000> parser.getCST()
===> null
> groovy:000> parser.getConfiguration().getPluginFactory().createParserPlugin().parseCST(parser, new StringReader(s));
===> null

`s` is the string source of the pipeline. Basically parses to nothing.

Can anybody advise me how to do it?

Thank you.

You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit