Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The parameters of withNewSpan step are not optional #1035

Open
taro-yanagiya opened this issue Feb 5, 2025 · 1 comment
Open

The parameters of withNewSpan step are not optional #1035

taro-yanagiya opened this issue Feb 5, 2025 · 1 comment

Comments

@taro-yanagiya
Copy link

taro-yanagiya commented Feb 5, 2025

Jenkins and plugins versions report

Environment
Jenkins: 2.479.3
OS: Linux - 6.5.0-41-generic
Java: 17.0.13 - Eclipse Adoptium (OpenJDK 64-Bit Server VM)
---
ansicolor:1.0.5
ant:511.v0a_a_1a_334f41b_
antisamy-markup-formatter:162.v0e6ec0fcfcf6
apache-httpcomponents-client-4-api:4.5.14-208.v438351942757
apache-httpcomponents-client-5-api:5.4-136.v5a_21779c63f8
artifactory:4.0.8
asm-api:9.7.1-97.v4cc844130d97
authentication-tokens:1.119.v50285141b_7e1
blueocean:1.27.16
blueocean-bitbucket-pipeline:1.27.16
blueocean-commons:1.27.16
blueocean-config:1.27.16
blueocean-core-js:1.27.16
blueocean-dashboard:1.27.16
blueocean-display-url:2.4.3
blueocean-events:1.27.16
blueocean-git-pipeline:1.27.16
blueocean-github-pipeline:1.27.16
blueocean-i18n:1.27.16
blueocean-jwt:1.27.16
blueocean-personalization:1.27.16
blueocean-pipeline-api-impl:1.27.16
blueocean-pipeline-editor:1.27.16
blueocean-pipeline-scm-api:1.27.16
blueocean-rest:1.27.16
blueocean-rest-impl:1.27.16
blueocean-web:1.27.16
bootstrap5-api:5.3.3-1
bouncycastle-api:2.30.1.80-256.vf98926042a_9b_
branch-api:2.1208.vf528356feca_4
build-timeout:1.35
caffeine-api:3.1.8-133.v17b_1ff2e0599
checks-api:2.2.1
cloud-stats:377.vd8a_6c953e98e
cloudbees-bitbucket-branch-source:934.4.1
cloudbees-folder:6.980.v5a_cc0cb_25881
commons-compress-api:1.26.1-2
commons-lang3-api:3.17.0-84.vb_b_938040b_078
commons-text-api:1.13.0-153.v91dcd89e2a_22
config-file-provider:982.vb_a_e458a_37021
credentials:1405.vb_cda_74a_f8974
credentials-binding:687.v619cb_15e923f
dark-theme:524.vd675b_22b_30cb_
display-url-api:2.209.v582ed814ff2f
docker-commons:445.v6b_646c962a_94
docker-java-api:3.4.1-96.v77147a_de67f8
docker-plugin:1.9.0
docker-workflow:592.v1001d948426c
durable-task:581.v299a_5609d767
echarts-api:5.5.1-5
eddsa-api:0.3.0-4.v84c6f0f4969e
email-ext:1876.v28d8d38315b_d
envinject:2.922.v2274200dd258
envinject-api:1.235.va_14c74f8f487
favorite:2.225.v68765b_b_a_1fa_3
font-awesome-api:6.6.0-2
git:5.7.0
git-client:6.1.1
github:1.41.0
github-api:1.321-478.vc9ce627ce001
github-branch-source:1810.v913311241fa_9
gradle:2.14
gson-api:2.12.1-113.v347686d6729f
handy-uri-templates-2-api:2.1.8-30.v7e777411b_148
htmlpublisher:1.37
http_request:1.20
instance-identity:201.vd2a_b_5a_468a_a_6
ionicons-api:74.v93d5eb_813d5f
jackson2-api:2.17.0-379.v02de8ec9f64c
jakarta-activation-api:2.1.3-1
jakarta-mail-api:2.1.3-1
javadoc:310.v032f3f16b_0f8
javax-activation-api:1.2.0-7
javax-mail-api:1.6.2-10
jaxb:2.3.9-1
jenkins-design-language:1.27.16
jersey2-api:2.45-154.v4ded3dc34f81
jjwt-api:0.11.5-112.ve82dfb_224b_a_d
joda-time-api:2.13.1-115.va_6b_5f8efb_1d8
jquery3-api:3.7.1-2
jsch:0.2.16-86.v42e010d9484b_
json-api:20250107-125.v28b_a_ffa_eb_f01
json-path-api:2.9.0-138.vc943da_d833b_6
junit:1312.v1a_235a_b_94a_31
ldap:776.vddf3e325103b_
mailer:489.vd4b_25144138f
matrix-auth:3.2.4
matrix-project:845.vffd7fa_f27555
maven-plugin:3.24
metrics:4.2.21-461.v881e35d8fa_b_a_
mina-sshd-api-common:2.14.0-143.v2b_362fc39576
mina-sshd-api-core:2.14.0-143.v2b_362fc39576
okhttp-api:4.11.0-183.va_87fc7a_89810
opentelemetry:3.1487.vf27fcf83deb_b_
opentelemetry-api:1.44.1.40.v93f5f8ca_42c3
pam-auth:1.11
pipeline-build-step:551.v178956c49ef8
pipeline-github-lib:61.v629f2cc41d83
pipeline-graph-analysis:216.vfd8b_ece330ca_
pipeline-graph-view:407.v7857c9611b_44
pipeline-groovy-lib:749.v70084559234a_
pipeline-input-step:508.v584c0e9a_2177
pipeline-milestone-step:119.vdfdc43fc3b_9a_
pipeline-model-api:2.2221.vc657003fb_d93
pipeline-model-definition:2.2221.vc657003fb_d93
pipeline-model-extensions:2.2221.vc657003fb_d93
pipeline-stage-step:312.v8cd10304c27a_
pipeline-stage-tags-metadata:2.2221.vc657003fb_d93
pipeline-utility-steps:2.18.0
plain-credentials:183.va_de8f1dd5a_2b_
plugin-util-api:5.1.0
pubsub-light:1.18
rebuild:332.va_1ee476d8f6d
resource-disposer:0.25
scm-api:703.v72ff4b_259600
script-security:1369.v9b_98a_4e95b_2d
snakeyaml-api:2.3-123.v13484c65210a_
sse-gateway:1.27
ssh-credentials:349.vb_8b_6b_9709f5b_
ssh-slaves:3.1021.va_cc11b_de26a_e
sshd:3.330.vc866a_8389b_58
structs:338.v848422169819
theme-manager:278.v2e3c063e42cc
timestamper:1.28
token-macro:442.v4f452dc3c7c0
trilead-api:2.147.vb_73cc728a_32e
variant:70.va_d9f17f859e0
workflow-aggregator:600.vb_57cdd26fdd7
workflow-api:1363.v03f731255494
workflow-basic-steps:1079.vce64b_a_929c5a_
workflow-cps:4014.vcd7dc51d8b_30
workflow-durable-task-step:1405.v1fcd4a_d00096
workflow-job:1498.v33a_0c6f3a_4b_4
workflow-multibranch:800.v5f0a_a_660950e
workflow-scm-step:427.v4ca_6512e7df1
workflow-step-api:686.v603d058a_e148
workflow-support:944.v5a_859593b_98a_
ws-cleanup:0.48

What Operating System are you using (both controller, and any agents involved in the problem)?

Docker image (jdk17) on Ubuntu

Reproduction steps

  1. Run this pipeline:
pipeline {
    agent any

    stages {
        stage('build') {
            steps {
                withNewSpan(label: 'custom-build-span') {
                    echo 'Hello'
                }
            }
        }
    }
}

Expected Results

The document says "Only the label parameter is required, all others are optional."

From this statement, this pipeline should be successful

Actual Results

This pipeline fails with the logs:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 7: Missing required parameter: "attributes" @ line 7, column 17.
                   withNewSpan(label: 'custom-build-span') {
                   ^

WorkflowScript: 7: Missing required parameter: "setAttributesOnlyOnParent" @ line 7, column 17.
                   withNewSpan(label: 'custom-build-span') {
                   ^

2 errors

	at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:309)
	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1107)
	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:624)
	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:602)
	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:579)
	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:323)
	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:293)
	at PluginClassLoader for script-security//org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox$Scope.parse(GroovySandbox.java:163)
	at PluginClassLoader for workflow-cps//org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:190)
	at PluginClassLoader for workflow-cps//org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:175)
	at PluginClassLoader for workflow-cps//org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:652)
	at PluginClassLoader for workflow-cps//org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:598)
	at PluginClassLoader for workflow-job//org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:335)
	at hudson.model.ResourceController.execute(ResourceController.java:101)
	at hudson.model.Executor.run(Executor.java:445)
Finished: FAILURE

Anything else?

No response

Are you interested in contributing a fix?

No response

@Artalus
Copy link

Artalus commented Feb 7, 2025

Just in case: somehow this is a Declarative Pipeline quirk; rewriting that snippet into a Scripted Pipeline works exactly as the docs suggest

stage('build') {
    withNewSpan(label: 'custom-build-span') {
        echo 'Hello'
    }
}

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants