Fix the 'Expected a Step on Line' error in Jenkins

preview_player
Показать описание
Did you create a declarative pipeline with some script in it? I think you did. Otherwise you wouldn't get the 'Expected a Step on Line' Jenkins error. Fortunately, this Jenkins error fix is easy. Just put a script tag around your scripts. A recent release made the Jenkins declarative pipeline syntax much more strict, so if you do a script in your pipeline without a script tag, you'll hit the Jenkins 'expected a step on line' error. Fix it with a script tag. It's that easy.
Or better yet, stop doing scripts in your Jenkins pipelines and use a shared library. But that's a bit more work. For now, the script tag addition will fix the 'expected a step on line' Jenkins error quickly.
Рекомендации по теме
Комментарии
Автор

This fixed one of my expected a step errors. Still got others though that this doesn’t fix. Still giving a thumbs up though. Thanks!

ivanphone