Skip to content

allowNoFile attribute for withFileParameter step does not have the expected behavior #166

@RobinFauvel

Description

@RobinFauvel

Jenkins and plugins versions report

Environment
Jenkins: 2.387.2
OS: Linux - 5.4.0-146-generic
Java: 11.0.11 - AdoptOpenJDK (OpenJDK 64-Bit Server VM)
file-parameters:285.v757c5b_67a_c25

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

Ubuntu 20.04 and Windows 10 VMs

Reproduction steps

Scripted pipeline definition:

properties([
    parameters([
        base64File(name: 'myFile')
    ])
])

node {
    deleteDir()
    stage('test') {
        withFileParameter(name: 'myFile', allowNoFile: false) {
            echo readFile(file: myFile)
        }
    }
}

Expected Results

When a build is started without providing a file to the 'myFile' Job parameter, I expect the build to fail since the allowNoFile attribute is set to false.

Actual Results

The build does not fail when no file is given as a Job parameter, even though the allowNoFile argument is set to false.
However, the build fails if no parameters are declared in the Job configuration. This isn't absurd, but it's not what you'd expect from the allowNoFile argument. After all, the argument isn't called allowNoParameter.

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions