Pipeline 'does not define any stages', but it does?

Hello there!

I am new to Jenkins and have decided to learn about the Pipeline declarative script. After reading and watching several tutorials on writing a simple Pipeline script, I had decided to give it a go on Jenkins.

When running the simple script, it displays the following error message - ‘This Pipeline has run successfully, but does not define any stages. Please use the stage step to define some stages in this Pipeline’,

However, after combing through the script and comparing it to the tutorial scripts online, everything appears to be precisely the same. So what is going on here? Is it perhaps a plugin issue?

Many thanks for your support in advance.

Please click this link to view screenshots of the script itself and the console output.

1 Like

Are you sure you that run in your screenshots is after the script was run? You have no echo statement in the logs.

I’m guessing for some reason a run happened. Then the pipeline script was added. Then you saw those messages. You’ll have to run it again. Jenkins is only able to talk about the last run (s) not the current state of the script

Hey @halkeye! And thanks for the feedback!

Yeah, the script is present before the build.

I can post more screenshots but they will be exactly the same as the OP.

EDIT: Grammar.

This also happens to me with a Jenkins started from docker image jenkins/jenkins:2.332.3 and any pipeline (including your hello world pipeline). Since this is also the first google result to the problem, it would be nice if there would be a possible solution.

Hello @AxlInvk @DaGeRe , could you please check if the plugin https://plugins.jenkins.io/pipeline-model-definition is installed on your Jenkins controller? If yes, could you try to uninstall and reinstall it (to ensure that its dependencies are present).

The described behavior feels like that there is only the pipeline support for scripted syntax (a subset of all the pipeline plugins), not the declarative (another subset). usually, both are installed if you install Blue Ocean, or if you proceeded with the “install recommended plugins” with the UI wizard.

1 Like

Thanks, for me, this really was the problem.

The log of the container contained:

2022-06-06 09:13:56.896+0000 [id=40]	SEVERE	jenkins.InitReactorRunner$1#onTaskFailed: Failed Loading plugin Pipeline: Nodes and Processes v1144.vd77b_57189936 (workflow-durable-task-step)
java.io.IOException: Failed to load: Pipeline: Nodes and Processes (workflow-durable-task-step 1144.vd77b_57189936)
 - Update required: Pipeline: API (workflow-api 1153.vb_912c0e47fb_a_) to be updated to 1162.va_1e49062a_00e or higher
	at hudson.PluginWrapper.resolvePluginDependencies(PluginWrapper.java:1018)
	at hudson.PluginManager$2$1$1.run(PluginManager.java:542)
	at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:175)
	at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:305)
	at jenkins.model.Jenkins$5.runTask(Jenkins.java:1156)
	at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:222)
	at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:121)
	at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)

which is surprising to me, since my /usr/local/bin/install-plugins.sh contains

workflow-aggregator:latest
workflow-basic-steps:latest
workflow-durable-task-step:latest

(also all other version were only latest versions).

Changing to

workflow-aggregator:latest
workflow-basic-steps:latest
workflow-durable-task-step:1139.v252a_e12e8463

fixes the issue. It seems like the workflow-durable-task-step update to 1144.vd77b_57189936 does not work with Jenkins LTS 2.332.3 (with version 2.350, latest also works).

1 Like

You’re correct. That plugin version had an issue and could not be installed. Issue is documented at JENKINS-68727.

That plugin version has been excluded from the update center and is no longer listed on the releases list of the plugins page