Details
-
Type:
Bug
-
Status: Closed (View Workflow)
-
Priority:
Major
-
Resolution: Fixed
-
Component/s: pipeline-model-definition-plugin
-
Labels:None
-
Environment:* CloudBees Jenkins 2.73.3.1-rolling (Jenkins LTS 2.73.3 Core)
* Declarative Pipeline 1.2.5
-
Similar Issues:
Description
Hello here!
I am currently trying to build a Declarative Pipeline with a conditional stage.
The condition should be triggered by the result of a shell command on my project (following the pipeline-as-glue pattern: my developer needs to know this on another environments as Jenkins, so using a script).
This shell command respond the string "false" or "true".
Based on this feedback, then I run the stage or not.
After some digging, it appears calling a "sh" step within an expression is no longer working: it throws the following exception "
java.lang.IllegalStateException: Can't send a remote FilePath to a different remote channel
I tried the pipeline on https://jenkins.io/blog/2017/01/19/converting-conditional-to-pipeline/#longer-pipeline and I got the same error.
Here is the full exception: https://gist.github.com/dduportal/7ae612501b848a55ad29fe421d775b96
I am currently trying with a shared library to see if the same issue occurs, I'll let you know.
Don't hesitate to ask if you miss information from me.
Thanks in advance for your time!
Attachments
Issue Links
- links to
Activity
I got the following plugins:
Async Http Client (async-http-client): 1.7.24.1 Common API for Blue Ocean (blueocean-commons): 1.3.3 bouncycastle API Plugin (bouncycastle-api): 2.16.2 CloudBees License Manager (cloudbees-license): 9.17 CloudBees Jenkins Enterprise License Entitlement Check (nectar-license): 8.6 Structs Plugin (structs): 1.10 Credentials Plugin (credentials): 2.1.16 Jackson 2 API Plugin (jackson2-api): 2.8.7.0 Metrics Plugin (metrics): 3.1.2.10 Support Core Plugin (support-core): 2.43 Beekeeper Upgrade Assistant Plugin (cloudbees-assurance): 2.73.0.2 CloudBees Blue Ocean Default Theme (cloudbees-blueocean-default-theme): 0.3 Folders Plugin (cloudbees-folder): 6.2.1 CloudBees Folders Plus Plugin (cloudbees-folders-plus): 3.2 Display URL API (display-url-api): 2.1.0 Durable Task Plugin (durable-task): 1.17 Form element path plugin (form-element-path): 1.8 Icon Shim Plugin (icon-shim): 2.0.3 JUnit Plugin (junit): 1.22.2 Mailer Plugin (mailer): 1.20 MapDB API Plugin (mapdb-api): 1.0.9.0 Variant Plugin (variant): 1.1 CloudBees Role-Based Access Control Plugin (nectar-rbac): 5.17 One-Shot Executor Plugin (one-shot-executor): 1.2 Operations Center Agent (operations-center-agent): 2.73.0.1 Operations Center Analytics Configuration (operations-center-analytics-config): 2.73.0.2 Token Macro Plugin (token-macro): 2.3 Script Security Plugin (script-security): 1.35 Unique ID Library Plugin (unique-id): 2.1.3 Operations Center Context (operations-center-context): 2.73.0.3 Operations Center Analytics Reporter (operations-center-analytics-reporter): 2.73.0.2 Operations Center Client Plugin (operations-center-client): 2.73.0.1 CloudBees PSE Tenant plugin (tiger-tenant): 1.0.14 Palace Cloud Plugin (palace-cloud): 2.0.2 PSE CJE Client License Plugin (pse-cje-client-license): 1.6.3 CloudBees Amazon Web Services Credentials Plugin (aws-credentials): 1.23 Pipeline: Step API (workflow-step-api): 2.14 CloudBees Back-up Plugin (infradna-backup): 3.34 Plain Credentials Plugin (plain-credentials): 1.4 CloudBees Support Plugin (cloudbees-support): 3.11 Credentials Binding Plugin (credentials-binding): 1.13 CloudBees Monitoring Plugin (cloudbees-monitoring): 2.7 Pipeline: Model API (pipeline-model-api): 1.2.5 REST API for Blue Ocean (blueocean-rest): 1.3.3 JavaScript GUI Lib: ACE Editor bundle plugin (ace-editor): 1.1 CloudBees Template Plugin (cloudbees-template): 4.33 JavaScript GUI Lib: jQuery bundles (jQuery and jQuery UI) plugin (jquery-detached): 1.2.1 Pipeline: Stage View Plugin (pipeline-stage-view): 2.9 Pipeline: SCM Step (workflow-scm-step): 2.6 HTML Publisher plugin (htmlpublisher): 1.14 SCM API Plugin (scm-api): 2.2.5 Pub-Sub "light" Bus (pubsub-light): 1.12 Pipeline: API (workflow-api): 2.23.1 CloudBees Pipeline Stage View Extensions (cloudbees-workflow-ui): 2.1 Pipeline: Supporting APIs (workflow-support): 2.16 Web for Blue Ocean (blueocean-web): 1.3.3 Pipeline: Groovy (workflow-cps): 2.41 JWT for Blue Ocean (blueocean-jwt): 1.3.3 Pipeline: Job (workflow-job): 2.15 Gradle Plugin (gradle): 1.28 Blue Ocean (blueocean): 1.3.3 Pipeline: Declarative Extension Points API (pipeline-model-extensions): 1.2.5 Pipeline: Milestone Step (pipeline-milestone-step): 1.3.1 SSH Credentials Plugin (ssh-credentials): 1.13 Favorite (favorite): 2.3.1 Git client plugin (git-client): 2.6.0 JIRA plugin (jira): 2.5 GIT server Plugin (git-server): 1.7 Node Iterator API Plugin (node-iterator-api): 1.5.0 Pipeline: Shared Groovy Libraries (workflow-cps-global-lib): 2.9 Config API for Blue Ocean (blueocean-config): 1.3.3 Branch API Plugin (branch-api): 2.0.15 Pipeline: Build Step (pipeline-build-step): 2.5.1 Pipeline: Multibranch (workflow-multibranch): 2.16 Pipeline (workflow-aggregator): 2.5 Authentication Tokens API Plugin (authentication-tokens): 1.3 CloudBees WikiText Security Plugin (wikitext): 3.8 Docker Commons Plugin (docker-commons): 1.9 Operations Center Cloud (operations-center-cloud): 2.73.0.1 Pipeline: Nodes and Processes (workflow-durable-task-step): 2.17 LDAP Plugin (ldap): 1.18 Docker Pipeline (docker-workflow): 1.14 Pipeline Graph Analysis Plugin (pipeline-graph-analysis): 1.5 Pipeline: Stage Tags Metadata (pipeline-stage-tags-metadata): 1.2.5 CloudBees SSH Build Agents Plugin (cloudbees-ssh-slaves): 2.1 Pipeline: Declarative Agent API (pipeline-model-declarative-agent): 1.1.1 Git plugin (git): 3.6.4 Pipeline: Stage Step (pipeline-stage-step): 2.3 GitHub API Plugin (github-api): 1.90 Pipeline: Basic Steps (workflow-basic-steps): 2.6 Amazon Web Services SDK (aws-java-sdk): 1.11.226 Pipeline: Declarative (pipeline-model-definition): 1.2.5 GitHub plugin (github): 1.28.1 CloudBees Nodes Plus Plugin (cloudbees-nodes-plus): 1.15 CloudBees Groovy View Plugin (cloudbees-groovy-view): 1.6 Pipeline: Input Step (pipeline-input-step): 2.8 CloudBees View Creation Filter Plugin (cloudbees-view-creation-filter): 1.4 Pipeline: REST API Plugin (pipeline-rest-api): 2.9 CloudBees Fast Archiving Plugin (cloudbees-jsync-archiver): 5.6 GitHub Branch Source Plugin (github-branch-source): 2.3.1 Matrix Project Plugin (matrix-project): 1.12 Mercurial plugin (mercurial): 2.2 Email Extension Plugin (email-ext): 2.61 JSch dependency plugin (jsch): 0.1.54.1 AnsiColor (ansicolor): 0.5.2 CloudBees Pipeline: Templates Plugin (cloudbees-workflow-template): 2.7 JavaScript GUI Lib: Moment.js bundle plugin (momentjs): 1.1.1 CloudBees Pipeline: Groovy Checkpoint Plugin (workflow-cps-checkpoint): 2.4 JIRA Integration for Blue Ocean (blueocean-jira): 1.3.3 JavaScript GUI Lib: Handlebars bundle plugin (handlebars): 1.1.1 Pipeline: GitHub Groovy Libraries (pipeline-github-lib): 1.0 GitHub Organization Folder Plugin (github-organization-folder): 1.6 Apache HttpComponents Client 4.x API Plugin (apache-httpcomponents-client-4-api): 4.5.3-2.0 Bitbucket Pipeline for Blue Ocean (blueocean-bitbucket-pipeline): 1.3.3 Personalization for Blue Ocean (blueocean-personalization): 1.3.3 Blue Ocean Pipeline Editor (blueocean-pipeline-editor): 1.3.3 Display URL for Blue Ocean (blueocean-display-url): 2.1.1 Server Sent Events (SSE) Gateway Plugin (sse-gateway): 1.15 Autofavorite for Blue Ocean (blueocean-autofavorite): 1.1.0 Bitbucket Branch Source Plugin (cloudbees-bitbucket-branch-source): 2.2.7 Dashboard for Blue Ocean (blueocean-dashboard): 1.3.3 Pipeline SCM API for Blue Ocean (blueocean-pipeline-scm-api): 1.3.3 REST Implementation for Blue Ocean (blueocean-rest-impl): 1.3.3 Pipeline implementation for Blue Ocean (blueocean-pipeline-api-impl): 1.3.3 Git Pipeline for Blue Ocean (blueocean-git-pipeline): 1.3.3 GitHub Pipeline for Blue Ocean (blueocean-github-pipeline): 1.3.3 Events API for Blue Ocean (blueocean-events): 1.3.3 i18n for Blue Ocean (blueocean-i18n): 1.3.3
If I try the pipeline you gave me, I got the same error: https://gist.github.com/dduportal/8855456bac79b484732a6977d4199987
Still can't reproduce this in any other environment. Fun! It seems the real underlying problem is like JENKINS-30864 but I can't reproduce it even in your environment outside of a declarative pipeline yet...
Same on my side:
- Cannot reproduce on a 2.72.3 LTS with Blue Ocean installed, plugins to latest.
- On my "buggy" environment, same error when loading from a shared library
Welp, I finally reproduced it by pulling in all the CloudBees proprietary stuff. Now to trim down until I find which plugin is the problem.
whoooo. Figured out exactly where the problem is. PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/223
Code changed in jenkins
User: Andrew Bayer
Path:
pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ASTParserUtils.groovy
pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/when/impl/ExpressionConditional.java
pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/DurabilityTest.java
pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/WhenStageTest.java
pipeline-model-definition/src/test/resources/whenExprDurableTask.groovy
http://jenkins-ci.org/commit/pipeline-model-definition-plugin/f601a676095b65b559a88b8374532cd9d4b074ac
Log:
[FIXED JENKINS-48209] Prevent serialization of when expression closure
This shouldn't really matter, in truth - I believe we actually
regenerate the whole Root object from scratch on resume, though I
could be misremembering. Regardless, even having the when expression
closure be transient, the durability test (with when expressions
added) still works right.
As to why we need to do this in the first place? Because something
weird could be out there trying to some non-standard serialization of
Describables. Ok, spoiler, there definitely is such a thing, and it
does a straight XStream serialization of every Describable. But we use
Describables as more than just UI config stuff - we use them for
syntax validation and such for our internal extension points, like
when conditions. And if that XStream serialization of a when
expression with a sh step kicks in, well, all hell breaks loose. This
works around that.
Hrm, can't reproduce this with the following Pipeline:
Wonder if I need newer versions of dependencies...