Search code examples
jenkinsmercurialjenkins-pipelinejenkins-plugins

Jenkins: mercurial scm: clean=false is not working as expected


EDIT: It seems as if the MercurialSCM plugin hardcodes the update to use the --clean option. See this line. Anyone have any ideas what's the idea?

I have the following checkout step in my Jenkinsfile:

checkout([
        scm: [
            $class: "MercurialSCM",
            source: "ssh://hg@bitbucket.org/xxxxx/${repo}",
            credentialsId: "jenkins",
            revision: params[branch] ? params[branch] : "default",
            subdir: (repo == "f8_root") ? "" : "aarch64/${repo}",
            clean: false,
        ],
        poll: true,
])

The argument for clean is set to false. But, the plugin still seems to issue an update with the --clean option. From the logs:

[Pipeline] checkout
[f8_fw] $ hg showconfig paths.default
[f8_fw] $ hg pull --rev feature/test-framework
pulling from ssh://hg@bitbucket.org/doblesc/f8_fw
no changes found
[f8_fw] $ hg update --clean --rev feature/test-framework

How can I fix this?


Solution

  • Seems like --clean is hardcoded into the MercurialSCM Jenkins plugin.

    See OP for the link to the culprit code.

    I have opened up a ticket on Jenkins jira.