[Solved] jenkins-deleteDir Error (FilePath is missing)

Today’s development feedback has been using the good Jenkins compilation service, but it reported an error

Look at the log and say something is wrong with deletedir

org.jenkinsci.plugins.workflow.steps.MissingContextVariableException: Required context class hudson.FilePath is missing
Perhaps you forgot to surround the code with a step that provides this, such as: node

Then after development and adjustment

Start reporting another error

After developing no solution, he found me

I looked at the pipeline

pipeline {
    agent{ label 'qa-gpu016.test.cn' }
    parameters {
        string(defaultValue: '0.0.0', description: '版本号', name: 'version', trim: false)

The discovery task is scheduled to · qa-gpu016 test.cn , and then log in to qa-gpu016 test.cn View

It was found that the disk was full. Because I didn’t know who to clean, I could only clean some unused images and containers

[email protected]:/# docker system df
TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              12                  5                   21.67GB             20.58GB (94%)
Containers          6                   6                   4.765MB             0B (0%)
Local Volumes       544                 2                   197.3GB             197.1GB (99%)
Build Cache         0                   0                   0B                  0B
[email protected]:/home# docker system prune -a 
WARNING! This will remove:
        - all stopped containers
        - all networks not used by at least one container
        - all images without at least one container associated to them
        - all build cache
Are you sure you want to continue?[y/N] y
Deleted Containers:

Deleted Images:
untagged: be510_test:0.0.217
deleted: sha256:cc9822c1c293e75b5a2806c2a84b34b908b3768f92b246a7ff415cf7f0ec0f37
deleted: sha256:f21a13c9453fb0a846c57c285251ece8d8fc95b803801e9f982891659217527a
deleted: sha256:38c1da0485daa7b5593dff9784da12af855290da40ee20600bc3ce864fb43fc0
[email protected]:/#

Then inform the developer to remove the judgment and keep it as it is

        cleanup {
            /* clean up our workspace */
            /* clean up tmp directory */
            dir("${workspace}@tmp") {
            /* clean up script directory */
            dir("${workspace}@script") {

Reconstruction, development feedback, pulling an image, and now entering the compilation process. Before, an error was reported on the outside

So far, the problem has been solved

Read More: