jenkinsci / jenkinsfile-runner

A command line tool to run Jenkinsfile as a function
MIT License
1.14k stars 292 forks source link

unable to use declarative-linter option with jenkins/jenkinsfile-runner image #461

Open armorKing11 opened 3 years ago

armorKing11 commented 3 years ago

When i try to use the jenkins/jenkinsfile-runner image to validate a Jenkinsfile in cli mode as follows

docker run --rm -i -v $(pwd)/Jenkinsfile:/workspace/Jenkinsfile jenkins/jenkinsfile-runner --cli

I either dont get any output in the console if i enter declarative-linter

WARNING: Using the deprecated CLI mode. Use the 'cli' subcommand instead of passing the argument or an environment variable
Connected to Jenkins!
Type 'help' for a list of available commands, or 'exit' to quit.
 > declarative-linter

or if i use the format declarative-linter < /workspace/Jenkinsfile , it throws an error

WARNING: Using the deprecated CLI mode. Use the 'cli' subcommand instead of passing the argument or an environment variable
Connected to Jenkins!
Type 'help' for a list of available commands, or 'exit' to quit.
 > declarative-linter <  /workspace/Jenkinsfile

ERROR: No argument is allowed: <
java -jar jenkins-cli.jar declarative-linter
Validate a Jenkinsfile containing a Declarative Pipeline

Can you tell me the correct way to use the declarative-linter option or is this a bug ? Thanks

oleg-nenashev commented 3 years ago

https://github.com/jenkinsci/jenkinsfile-runner/issues/225 needs to be implemented to support such mode in JFR

armorKing11 commented 3 years ago

Hi @oleg-nenashev , so can we not use just the declarative-linter option ,ie, not specifying the the file like < /workspace/Jenkinsfile ,assuming that it is aware of the file in /workspace/Jenkinsfile ?