Commit Graph

65 Commits

Author SHA1 Message Date
R Tyler Croy e0d13a696c Use a regular expression for a quick sanity check to identify Scripted Pipelines
Fixes #16
2020-12-25 21:48:00 -08:00
R Tyler Croy daa04b0020 Handle very complex environment settings
Did you know you could shove steps into here? Neither did I!
2020-12-25 21:07:07 -08:00
R Tyler Croy ddf1eabcd2 Support hudson.foo references in parameters 2020-12-20 16:05:47 -08:00
R Tyler Croy d0fd928f40 Forgot that there's a shorthand for docker agent specifications 🤦 2020-12-20 15:57:25 -08:00
R Tyler Croy 281857cdc6
Merge pull request #6 from v1v/feature/monorepo-with-shared-library-steps
Declarative pipeline for the monorepo elastic/beats.git
2020-12-20 14:57:24 -08:00
R Tyler Croy ad1c466f7a Parse more complex nested stages, etc
This adds some more logic to the parser rather than the grammar to ensure that
the stage {} directive has the necessary children blocks

The errors are pretty sweet too:

    ❯ ./target/debug/jdp check data/invalid/no-steps-in-stage/Jenkinsfile

    data/invalid/no-steps-in-stage/Jenkinsfile
    ------------------------------------------
    0: pipeline {
    1:     agent any
    2:     stages {
    3:         stage('Build') {
      --------^

    Fail: A stage must have either steps{}, parallel{}, or nested stages {}
2020-12-20 14:51:46 -08:00
Victor Martinez 7f3e025e24 Update data/valid/monorepo-with-shared-library-steps/Jenkinsfile 2020-12-20 14:05:22 -08:00
Victor Martinez bdd4491b9c Declarative pipeline for the monorepo elastic/beats.git 2020-12-20 14:05:22 -08:00
R Tyler Croy 235a34292f Allow just about any junk to be thrown into the file before `pipeline` 2020-12-20 14:04:26 -08:00
R Tyler Croy 37122ab900 Handle errors a bit more gracefully in the CLI
Noticed an overflow error right after I pushed 0.2.0 🤦
2020-12-20 09:49:46 -08:00
R Tyler Croy f176c4d9d5 Show some better errors in the CLI, highlighting the failed line
Fixes #9
2020-12-19 22:19:40 -08:00
R Tyler Croy e5bb3f5f65 Some installation instructions 2020-12-19 21:29:11 -08:00
R Tyler Croy fa509c25db Add some Cargo metadata for release
Fixes #10
2020-12-19 21:25:38 -08:00
R Tyler Croy beaaef9c59 Prep for v0.1.1 release 2020-12-19 21:23:19 -08:00
R Tyler Croy 57747e0fbc cargo fmt && cargo up 2020-12-19 21:22:44 -08:00
R Tyler Croy c256dffa50 Support some awkward string concatenation with magic variables 2020-12-19 21:22:36 -08:00
R Tyler Croy 6eca8bfd7d Add tests for the varying string quotes
The contents of these parsed strings I don't believe is going to be correct, but
it kind of doesn't matter at this point

Fixes #2
2020-12-19 20:55:50 -08:00
R Tyler Croy 69c582b87e cargo fmt 2020-12-19 20:51:37 -08:00
R Tyler Croy 024d305e79 Enable another Jenkinsfile in the test directory 2020-12-19 20:51:09 -08:00
R Tyler Croy 65b5d55752 Support stage-level options 2020-12-19 20:50:01 -08:00
R Tyler Croy 5af75a4811 Parse a few more wacky Jenkinsfiles 2020-12-19 20:47:50 -08:00
R Tyler Croy 47025ae6a2 Support steps without arguments properly, and clean up script {} 2020-12-19 20:41:42 -08:00
R Tyler Croy ec6dd18be7 Support the `checkout scm` step 2020-12-19 16:08:01 -08:00
R Tyler Croy 24aefec961 Add a bunch of @MarkEWaite's `Jenkinsfiles`
Many of these don't yet parse and are marked as such, will need to start working
through them
2020-12-19 16:04:30 -08:00
R Tyler Croy 38c3b3bb1c Add support for the wnen { tag '' } expression 2020-12-19 16:04:15 -08:00
R Tyler Croy 0f3c6b5c87 Add support for more when expressions 2020-12-19 15:17:29 -08:00
R Tyler Croy 9f694a94e6 Add support for more when predicates and nesting 2020-12-19 12:49:36 -08:00
R Tyler Croy 299259bc50 Add support for when { branch 'foo' } 2020-12-19 12:42:30 -08:00
R Tyler Croy b67f9bf7f8 Validate ordering is not important 2020-12-19 12:30:49 -08:00
R Tyler Croy b856eecf7c Add a couple more negative test cases 2020-12-19 12:28:39 -08:00
R Tyler Croy 92a18886d7 Ensure the parser is failing on empty stages 2020-12-19 12:27:10 -08:00
R Tyler Croy c70f5ea77e Return proper errors when the parser sees redundant stages/agent directives 2020-12-19 12:24:14 -08:00
R Tyler Croy f93df5dd4a Propagate the nonzero failure status 2020-12-19 12:13:50 -08:00
R Tyler Croy 5ed1040b5c Correct an invalid pipeline (agent is required at the top level) 2020-12-19 12:12:20 -08:00
R Tyler Croy 112e7f617a Add a little more smarts to the parser for finding required directives
This commit also adds some failing test cases
2020-12-19 12:11:42 -08:00
R Tyler Croy 4eb6bfe406 Add a simple release action 2020-12-13 16:00:21 -08:00
R Tyler Croy c2989458b1 Update the readme with a modicum of documentation 2020-12-13 15:59:40 -08:00
R Tyler Croy 266ab91832
Merge pull request #7 from rtyler/complex-deploy
Add a modified (redacted) complex deployment pipeline for some ECS mess
2020-12-13 15:57:35 -08:00
R Tyler Croy a5d8c36e19 cargo fmt 2020-12-13 15:55:25 -08:00
R Tyler Croy db489b81a6 Allow fugly method chaining on steps which is legal but so gross 2020-12-13 15:55:06 -08:00
R Tyler Croy 8d54dcc8fe Correct a typo in this Jenkinsfile
Redacted a few too many parenthesis
2020-12-13 15:54:46 -08:00
R Tyler Croy ee93883548 Support using steps as parameters for other steps 2020-12-13 15:51:35 -08:00
R Tyler Croy 3ba6ade4f3 Add support for parsing the script step
This basically treats everything _within_ the script step as a black box
2020-12-13 15:46:47 -08:00
R Tyler Croy b1e69f07b6 Parse parameter blocks into oblivion 2020-12-13 15:18:12 -08:00
R Tyler Croy de42727f85 Support optional parenthesis when dealing with nested function nonsense in options{} 2020-12-13 15:06:51 -08:00
R Tyler Croy 5bfa5915a9 Add a modified (redacted) complex deployment pipeline for some ECS mess 2020-12-13 14:55:03 -08:00
R Tyler Croy 0753be9f63 Teach JDP how to parse really gnarly invocation syntaxes for steps
Groovy lists and maps leak into declarative in ways that I have always really
despised.
2020-12-13 14:53:25 -08:00
R Tyler Croy 8e126eaa6b Add a *lot* more parsing code, this parses the Jenkins Evergreen file now
There may be some bugs here in the stage declaration that expect a specific
ordering of directives.
2020-12-08 21:07:22 -08:00
R Tyler Croy cb4aa6e5c5 Add the Jenkins Evergreen (now defunct) Jenkinsfile
Thanks to @batmat for the reminder 😄
2020-12-07 21:29:00 -08:00
R Tyler Croy 76938b1f13 Working on parsing much more complex pipelines
This is kind of a grab-bag of syntax changes, I'm working through some more
complex pipelines which are still failing and therefore not checked in at the
moment.

This does also handle a little bit more complex string quoting behaviors

See #2
2020-12-07 21:26:16 -08:00