Skip to content

Unstashing file parameter fails when building with parameters through REST API and no file is provided #217

@felipecrs

Description

@felipecrs

Jenkins and plugins versions report

Environment
Jenkins: 2.492.2
OS: Linux - 6.8.0-52-generic
Java: 21.0.6 - Eclipse Adoptium (OpenJDK 64-Bit Server VM)
---
Parameterized-Remote-Trigger:3.2.1
allure-jenkins-plugin:2.32.0
ansicolor:1.0.6
antisamy-markup-formatter:173.v680e3a_b_69ff3
apache-httpcomponents-client-4-api:4.5.14-269.vfa_2321039a_83
artifactory-artifact-manager:198.v70e5f9e07b_22
artifactory-client-api:2.19.0-82.va_7314a_427046
asm-api:9.7.1-97.v4cc844130d97
audit-trail:395.vce180b_359a_b_5
authentication-tokens:1.131.v7199556c3004
authorize-project:2.0.0
basic-branch-build-strategies:228.v68c089762a_db_
blueocean:1.27.17
blueocean-bitbucket-pipeline:1.27.17
blueocean-commons:1.27.17
blueocean-config:1.27.17
blueocean-core-js:1.27.17
blueocean-dashboard:1.27.17
blueocean-display-url:2.4.4
blueocean-events:1.27.17
blueocean-git-pipeline:1.27.17
blueocean-github-pipeline:1.27.17
blueocean-i18n:1.27.17
blueocean-jwt:1.27.17
blueocean-personalization:1.27.17
blueocean-pipeline-api-impl:1.27.17
blueocean-pipeline-editor:1.27.17
blueocean-pipeline-scm-api:1.27.17
blueocean-rest:1.27.17
blueocean-rest-impl:1.27.17
blueocean-web:1.27.17
bootstrap5-api:5.3.3-2
bouncycastle-api:2.30.1.80-256.vf98926042a_9b_
branch-api:2.1214.v3f652804588d
build-name-setter:2.5.0
build-timeout:1.37
caffeine-api:3.2.0-161.v691ef352cee1
checks-api:367.v18b_7f530e54a_
cloudbees-bitbucket-branch-source:935.1.3
cloudbees-disk-usage-simple:239.v6a_f1a_c1c8046
cloudbees-folder:6.991.v1d5f531726d0
cloudbees-jenkins-advisor:374.v194b_d4f0c8c8
command-launcher:118.v72741845c17a_
commons-compress-api:1.27.1-3
commons-lang3-api:3.17.0-84.vb_b_938040b_078
commons-text-api:1.13.0-153.v91dcd89e2a_22
configuration-as-code:1947.v7d33fe23569c
copyartifact:765.v0357cc6e6eb_3
coverage:2.2.0
credentials:1413.va_51c53703df1
credentials-binding:687.v619cb_15e923f
cucumber-reports:5.8.5
dark-theme:524.vd675b_22b_30cb_
data-tables-api:2.2.2-1
display-url-api:2.209.v582ed814ff2f
docker-commons:451.vd12c371eeeb_3
docker-workflow:611.v16e84da_6d3ff
durable-task:587.v84b_877235b_45
echarts-api:5.6.0-2
eddsa-api:0.3.0.1-19.vc432d923e5ee
email-ext:1876.v28d8d38315b_d
embeddable-build-status:548.v5653c6e28c41
extended-read-permission:61.vf24570ff3b_e9
favorite:2.225.v68765b_b_a_1fa_3
file-parameters:367.vc2cc39fb_b_593
flatpickr-api:4.6.13-18.vcf5f6a_5b_8468
font-awesome-api:6.7.2-1
forensics-api:3.1.0
gerrit-code-review:0.4.9
gerrit-trigger:2.42.0
git:5.7.0
git-client:6.1.2
github:1.42.0
github-api:1.321-478.vc9ce627ce001
github-branch-source:1810.v913311241fa_9
gitlab-api:5.6.0-100.v83f8f4b_f1129
gitlab-branch-source:718.v40b_5f0e67cd3
gson-api:2.12.1-113.v347686d6729f
handy-uri-templates-2-api:2.1.8-36.v85e4cb_234a_13
htmlpublisher:425
instance-identity:203.v15e81a_1b_7a_38
ionicons-api:82.v0597178874e1
jackson2-api:2.18.3-402.v74c4eb_f122b_2
jacoco:3.3.7
jakarta-activation-api:2.1.3-2
jakarta-mail-api:2.1.3-2
javadoc:310.v032f3f16b_0f8
javax-activation-api:1.2.0-8
javax-mail-api:1.6.2-11
jaxb:2.3.9-133.vb_ec76a_73f706
jdk-tool:83.v417146707a_3d
jenkins-design-language:1.27.17
jersey2-api:2.45-154.v4ded3dc34f81
jjwt-api:0.11.5-120.v0268cf544b_89
job-dsl:1.91
joda-time-api:2.13.1-115.va_6b_5f8efb_1d8
jquery3-api:3.7.1-3
jsch:0.2.16-95.v3eecb_55fa_b_78
json-api:20250107-125.v28b_a_ffa_eb_f01
json-path-api:2.9.0-148.v22a_7ffe323ce
jsoup:1.19.1-36.v63b_c859911d0
junit:1319.v000471ca_e5e2
kubernetes:4324.vfec199a_33512
kubernetes-client-api:6.10.0-251.v556f5f100500
kubernetes-credentials:192.v4d5b_1c429d17
ldap:780.vcb_33c9a_e4332
lockable-resources:1349.v8b_ccb_c5487f7
mailer:489.vd4b_25144138f
matrix-auth:3.2.5
matrix-project:847.v88a_f90ff9f20
metrics:4.2.21-464.vc9fa_a_0d6265d
mina-sshd-api-common:2.14.0-143.v2b_362fc39576
mina-sshd-api-core:2.14.0-143.v2b_362fc39576
next-executions:424.v631378313e29
okhttp-api:4.11.0-183.va_87fc7a_89810
pipeline-build-step:557.v95d96f77b_2b_8
pipeline-graph-analysis:231.v56354571a_da_0
pipeline-graph-view:423.v765c49ca_da_3f
pipeline-groovy-lib:752.vdddedf804e72
pipeline-input-step:517.vf8e782ee645c
pipeline-milestone-step:127.vb_52887ca_3b_6d
pipeline-model-api:2.2247.va_423189a_7dff
pipeline-model-definition:2.2247.va_423189a_7dff
pipeline-model-extensions:2.2247.va_423189a_7dff
pipeline-rest-api:2.37
pipeline-stage-step:322.vecffa_99f371c
pipeline-stage-tags-metadata:2.2247.va_423189a_7dff
pipeline-stage-view:2.37
pipeline-utility-steps:2.19.0
plain-credentials:183.va_de8f1dd5a_2b_
plugin-usage-plugin:4.10
plugin-util-api:6.1.0
prism-api:1.30.0-1
prometheus:819.v50953a_c560dd
pubsub-light:1.19
purge-build-queue-plugin:88.v23b_97b_f2c7a_d
rebuild:338.va_0a_b_50e29397
resource-disposer:0.25
role-strategy:756.v978cb_392eb_d3
saferestart:102.v4dc1b_9636a_ee
schedule-build:649.vd4058b_a_a_cf54
scm-api:704.v3ce5c542825a_
script-security:1373.vb_b_4a_a_c26fa_00
snakeyaml-api:2.3-123.v13484c65210a_
sonar:2.18
sonar-gerrit:388.v9b_f1cb_e42306
sse-gateway:1.28
ssh-credentials:355.v9b_e5b_cde5003
sshd:3.353.v2b_d33c46e970
structs:343.vdcf37b_a_c81d5
support-core:1686.va_77077e932eb_
theme-manager:278.v2e3c063e42cc
timestamper:1.28
token-macro:444.v52de7e9c573d
trilead-api:2.192.vc50a_d147e369
uno-choice:2.8.6
variant:70.va_d9f17f859e0
workflow-aggregator:608.v67378e9d3db_1
workflow-api:1366.vf1fb_e1a_f6b_22
workflow-basic-steps:1079.vce64b_a_929c5a_
workflow-cps:4046.v90b_1b_9edec67
workflow-durable-task-step:1405.v1fcd4a_d00096
workflow-job:1506.v77f78a_b_8cc5e
workflow-multibranch:803.v08103b_87c280
workflow-scm-step:437.v05a_f66b_e5ef8
workflow-step-api:700.v6e45cb_a_5a_a_21
workflow-support:963.va_600813d04a_a_
ws-cleanup:0.48

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

Ubuntu 22.04 LTS

Reproduction steps

  1. Create a job with a stashed file parameter
  2. Do unstash in the Jenkinsfile:
steps {
  unstash "MY_FILE_PARAM"
}
  1. Confirm it does not fail when triggering the build through the UI when not passing any file
  2. Now try triggering the buildWithParameters REST API without passing any file. It should fail with:
ERROR: Failed to stash MY_FILE_PARAM from artifacts/myjob/1/stashes/MY_FILE_PARAM.tgz

Expected Results

To not fail like it doesn't fail when triggering the build from UI.

Actual Results

Fails the build with:

ERROR: Failed to stash MY_FILE_PARAM from artifacts/myjob/1/stashes/MY_FILE_PARAM.tgz

Anything else?

  1. This issue is somewhat related to Different error handling needed when Job is triggered by user or by Timer if no file is provided #54, but the error message is not mentioned anywhere there, thus I'm reporting as a separate issue.

  2. This issue started happening after Migrate to Commons FileUpload 2.x #215. If you revert the plugin to the previous version, you should no longer observe this issue.
    EDIT: Sorry, I'm not 100% sure about this anymore, I need to re-do this test with the old plugin version to be sure.

Are you interested in contributing a fix?

No, sorry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions