Workspace deleted on build node when Jenkins controller restarted

I am executing a pipeline job on a build node and observed that the workspace is getting deleted from the build node whenever the Jenkins controller restarts. I have observed this consistently for multiple times.
I could not find if it is expected behavior of Jenkins or not from the documentation.

Can anyone let me know how can I preserve the workspace when the controller restarts while job is in progress?

Hello @chakravarthy392 and welcome to this community :wave:

What is the list of installed plugins on your controller? You could have one plugins that does it for you without you knowing.
To get the list, you can go to http://<yourcontroller>/script and enter this script in the textbox and then click Run.

Jenkins.instance.pluginManager.plugins.each{
  plugin -> 
    println ("${plugin.getDisplayName()} (${plugin.getShortName()}): ${plugin.getVersion()}")
}

Hi @poddingue ,
Seems too many plugins are installed.

Result: [Plugin:blueocean-commons, Plugin:structs, Plugin:junit, Plugin:workflow-cps-global-lib, Plugin:workflow-step-api, Plugin:workflow-scm-step, Plugin:credentials, Plugin:branch-api, Plugin:ssh-credentials, Plugin:variant, Plugin:git-client, Plugin:scm-api, Plugin:display-url-api, Plugin:jackson2-api, Plugin:mailer, Plugin:workflow-multibranch, Plugin:script-security, Plugin:matrix-project, Plugin:git, Plugin:mercurial, Plugin:metrics, Plugin:ace-editor, Plugin:docker-commons, Plugin:jquery-detached, Plugin:workflow-api, Plugin:workflow-support, Plugin:blueocean-web, Plugin:workflow-cps, Plugin:blueocean-rest, Plugin:workflow-job, Plugin:multiple-scms, Plugin:bitbucket, Plugin:bitbucket-build-status-notifier, Plugin:durable-task, Plugin:authentication-tokens, Plugin:ant, Plugin:windows-slaves, Plugin:icon-shim, Plugin:blueocean-jwt, Plugin:matrix-auth, Plugin:pipeline-stage-step, Plugin:antisamy-markup-formatter, Plugin:token-macro, Plugin:docker-workflow, Plugin:plain-credentials, Plugin:favorite, Plugin:stashNotifier, Plugin:github-api, Plugin:github, Plugin:github-branch-source, Plugin:pipeline-input-step, Plugin:git-server, Plugin:pipeline-graph-analysis, Plugin:workflow-basic-steps, Plugin:credentials-binding, Plugin:pipeline-model-definition, Plugin:pipeline-model-api, Plugin:pipeline-model-extensions, Plugin:cloudbees-folder, Plugin:resource-disposer, Plugin:workflow-durable-task-step, Plugin:nodejs, Plugin:pipeline-stage-tags-metadata, Plugin:pipeline-model-declarative-agent, Plugin:blueocean-rest-impl, Plugin:ws-cleanup, Plugin:blueocean-pipeline-api-impl, Plugin:email-ext, Plugin:mapdb-api, Plugin:ssh-slaves, Plugin:blueocean-git-pipeline, Plugin:blueocean-config, Plugin:sse-gateway, Plugin:bouncycastle-api, Plugin:blueocean-events, Plugin:extended-choice-parameter, Plugin:blueocean-personalization, Plugin:blueocean-display-url, Plugin:configurationslicing, Plugin:blueocean-pipeline-editor, Plugin:custom-tools-plugin, Plugin:blueocean-autofavorite, Plugin:pubsub-light, Plugin:blueocean-i18n, Plugin:skip-certificate-check, Plugin:blueocean-dashboard, Plugin:StashBranchParameter, Plugin:cloudbees-bitbucket-branch-source, Plugin:bitbucket-pullrequest-builder, Plugin:subversion, Plugin:pam-auth, Plugin:ldap, Plugin:external-monitor-job, Plugin:cvs, Plugin:greenballs, Plugin:JDK_Parameter_Plugin, Plugin:javadoc, Plugin:jquery, Plugin:pipeline-milestone-step, Plugin:pipeline-rest-api, Plugin:handlebars, Plugin:momentjs, Plugin:publish-to-bitbucket, Plugin:pipeline-build-step, Plugin:workflow-aggregator, Plugin:config-file-provider, Plugin:maven-plugin, Plugin:m2release, Plugin:rundeck, Plugin:release, Plugin:command-launcher, Plugin:apache-httpcomponents-client-4-api, Plugin:pipeline-utility-steps, Plugin:blueocean-pipeline-scm-api, Plugin:stash-pullrequest-builder, Plugin:blueocean-github-pipeline, Plugin:git-changelog, Plugin:jdk-tool, Plugin:blueocean-core-js, Plugin:blueocean-jira, Plugin:pipeline-stage-view, Plugin:discard-old-build, Plugin:permissive-script-security, Plugin:jira, Plugin:htmlpublisher, Plugin:jsch, Plugin:gradle, Plugin:blueocean, Plugin:cloudbees-disk-usage-simple, Plugin:pipeline-multibranch-defaults, Plugin:nexus-artifact-uploader, Plugin:build-user-vars-plugin, Plugin:sonar, Plugin:scm-filter-branch-pr, Plugin:slack, Plugin:hudson-wsclean-plugin, Plugin:modernstatus, Plugin:saferestart, Plugin:blueocean-bitbucket-pipeline, Plugin:jenkins-design-language, Plugin:jquery-ui, Plugin:hashicorp-vault-plugin, Plugin:handy-uri-templates-2-api, Plugin:http_request, Plugin:allure-jenkins-plugin, Plugin:git-parameter, Plugin:run-condition, Plugin:serenity, Plugin:conditional-buildstep, Plugin:parameterized-trigger, Plugin:purge-build-queue-plugin, Plugin:ansible, Plugin:Parameterized-Remote-Trigger, Plugin:ignore-committer-strategy, Plugin:blueocean-executor-info, Plugin:uno-choice, Plugin:lockable-resources, Plugin:ansible-tower, Plugin:jobConfigHistory, Plugin:plugin-util-api, Plugin:extensible-choice-parameter, Plugin:mask-passwords, Plugin:ssh-agent, Plugin:leastload, Plugin:trilead-api, Plugin:dynamic_extended_choice_parameter, Plugin:role-strategy, Plugin:parameterized-scheduler, Plugin:caffeine-api, Plugin:hashicorp-vault-pipeline, Plugin:echarts-api, Plugin:emailext-template, Plugin:sshd, Plugin:extended-read-permission, Plugin:pipeline-groovy-lib, Plugin:jmh-report, Plugin:okhttp-api, Plugin:javax-mail-api, Plugin:next-build-number, Plugin:font-awesome-api, Plugin:popper2-api, Plugin:jjwt-api, Plugin:build-name-setter, Plugin:rebuild, Plugin:veracode-scan, Plugin:javax-activation-api, Plugin:thinBackup, Plugin:popper-api, Plugin:jquery3-api, Plugin:bootstrap4-api, Plugin:openshift-client, Plugin:jaxb, Plugin:checks-api, Plugin:performance, Plugin:ansicolor, Plugin:bootstrap5-api, Plugin:scm2job, Plugin:azure-commons, Plugin:snakeyaml-api, Plugin:global-build-stats, Plugin:chromedriver, Plugin:openJDK-native-plugin, Plugin:saml, Plugin:adoptopenjdk, Plugin:azure-sdk, Plugin:azure-credentials, Plugin:notification, Plugin:jakarta-activation-api, Plugin:jakarta-mail-api]

1 Like

I can see a few plugins that could take care of removing resources without asking…

I guess the ws-cleanup plugin gives options to clean up the workspace before starting the job/ after completing the job but it should not delete the workspace when Jenkins restarts. Anyway, I will check the documentation of those plugins just to be sure.

1 Like