I want to be able to pause and then resume a particular job. While the job is paused, I would like the executor to be free to carry out other tasks instead of being tied up waiting for the same job

Jenkins setup:

Jenkins: 2.375.3
OS: Windows 10 - 10.0
Java: 11.0.15 - Amazon.com Inc. (OpenJDK 64-Bit Server VM)

ant:481.v7b_09e538fcca
antisamy-markup-formatter:155.v795fb_8702324
apache-httpcomponents-client-4-api:4.5.13-138.v4e7d9a_7b_a_e61
bootstrap5-api:5.2.1-3
bouncycastle-api:2.27
branch-api:2.1071.v1a_188a_562481
build-timeout:1.28
caffeine-api:2.9.3-65.v6a_47d0f4d1fe
checks-api:1.8.1
cloudbees-folder:6.800.v71307ca_b_986b
command-launcher:90.v669d7ccb_7c31
commons-lang3-api:3.12.0-36.vd97de6465d5b_
commons-text-api:1.10.0-27.vb_fa_3896786a_7
config-file-provider:3.11.1
credentials:1214.v1de940103927
credentials-binding:523.vd859a_4b_122e6
display-url-api:2.3.7
durable-task:504.vb10d1ae5ba2f
echarts-api:5.4.0-1
email-ext:2.94
font-awesome-api:6.2.1-1
git:5.0.0
git-client:4.1.0
github:1.36.1
github-api:1.303-400.v35c2d8258028
github-branch-source:1701.v00cc8184df93
gradle:2.2
instance-identity:142.v04572ca_5b_265
ionicons-api:31.v4757b_6987003
jackson2-api:2.14.2-319.v37853346a_229
jakarta-activation-api:2.0.1-2
jakarta-mail-api:2.0.1-2
javax-activation-api:1.2.0-5
javax-mail-api:1.6.2-8
jaxb:2.3.8-1
jdk-tool:63.v62d2fd4b_4793
jjwt-api:0.11.5-77.v646c772fddb_0
jquery3-api:3.6.1-2
jsch:0.1.55.61.va_e9ee26616e7
junit:1177.v90374a_ef4d09
ldap:659.v8ca_b_a_fe79fa_d
mailer:448.v5b_97805e3767
matrix-auth:3.1.6
matrix-project:785.v06b_7f47b_c631
mina-sshd-api-common:2.9.2-50.va_0e1f42659a_a
mina-sshd-api-core:2.9.2-50.va_0e1f42659a_a
nodejs:1.6.0
okhttp-api:4.10.0-117.vf786fdfa_22c0
pam-auth:1.10
pipeline-build-step:2.18.1
pipeline-github-lib:38.v445716ea_edda_
pipeline-graph-analysis:202.va_d268e64deb_3
pipeline-groovy-lib:629.vb_5627b_ee2104
pipeline-input-step:466.v6d0a_5df34f81
pipeline-milestone-step:111.v449306f708b_7
pipeline-model-api:2.2118.v31fd5b_9944b_5
pipeline-model-definition:2.2118.v31fd5b_9944b_5
pipeline-model-extensions:2.2118.v31fd5b_9944b_5
pipeline-rest-api:2.31
pipeline-stage-step:305.ve96d0205c1c6
pipeline-stage-tags-metadata:2.2118.v31fd5b_9944b_5
pipeline-stage-view:2.31
plain-credentials:143.v1b_df8b_d3b_e48
plugin-util-api:2.20.0
popper2-api:2.11.6-2
postbuildscript:3.2.0-460.va_fda_0fa_26720
powershell:2.0
publish-over:0.22
publish-over-ssh:1.24
resource-disposer:0.20
scm-api:631.v9143df5b_e4a_a
script-security:1229.v4880b_b_e905a_6
snakeyaml-api:1.33-90.v80dcb_3814d35
ssh-credentials:305.v8f4381501156
ssh-slaves:2.854.v7fd446b_337c9
sshd:3.275.v9e17c10f2571
structs:324.va_f5d6774f3a_d
timestamper:1.21
token-macro:321.vd7cc1f2a_52c8
trilead-api:2.84.v72119de229b_7
variant:59.vf075fe829ccb
workflow-aggregator:590.v6a_d052e5a_a_b_5
workflow-api:1208.v0cc7c6e0da_9e
workflow-basic-steps:994.vd57e3ca_46d24
workflow-cps:3618.v13db_a_21f0fcf
workflow-durable-task-step:1223.v7f1a_98a_8863e
workflow-job:1268.v6eb_e2ee1a_85a
workflow-multibranch:733.v109046189126
workflow-scm-step:400.v6b_89a_1317c9a_
workflow-step-api:639.v6eca_cd8c04a_a_
workflow-support:839.v35e2736cfd5c
ws-cleanup:0.44

What you mean with pause exactly?
You can pause pipeline jobs by using an input step. When this input step is outside of a node step, then no executor is consumed.
An executor is consumed as long as the node step is running, when you have an input step inside a node step, this means that the job is waiting at the input and still occupies the executor.
It is not possible to pause freestyle jobs or pause pipeline steps without an input step.

Within my multi-step pipeline, there is a stage that requires external input. I want the ability to pause the pipeline at this specific step and wait for the needed input. Once I receive the external input, I want to resume the process from the same point where it was paused. During the time when the pipeline is in a paused state, I would like to use the executor to work on other job executions, rather than having it remain idle while waiting for the input.

I hope this will clear the problem statement.

As explained this can be done when the input step is outside of a node. You could stash the workspace (maybe you don’t need all files but only a few, e.g. a build result you want to deploy), leave the node, wait for input, have a new node (this might not be the same node if you use labels that are served by more than 1 machine) unstash and then continue.
Also consider that in case you have concurrent execution of jobs, the run that starts while a build is waiting for input could use the same workspace that was used by the now waiting run, so you shouldn’t make any assumptions here. And when it resumes it could run in a concurrent folder (those that end with e.g. @2) on the same machine when you have more than 1 executor.

I have the same requirement.
I understand your description, but I still don’t know how to write a pipeline script to implement this requirement.
Here is my pipeline script.
Could you help me create a demo based on this?
@mawinter69

pipeline {
    agent any
    stages {
        stage("step1") {
            steps {
                sh '''
ls -la
touch step1
export step1=111
'''
            }
        }
        stage("step2") {
            steps {
                sh '''
ls -la
touch step2
export step2=222
echo export1=$export1
'''
            }
        }
        stage("step3") {
            steps {
                sh '''
ls -la
touch step3
export step3=333
echo export2=$export2
'''
            }
        }
        stage('input') {
            steps {
                script {
                    sh "pwd"
                }
                script {
                    def userInput = input(id: '1', message: '', parameters: [choice(name: 'continueBuild', choices: 'true\nfalse'), string(name: 'note'),])
                    if (userInput.continueBuild == 'false') {
                        currentBuild.result = 'ABORTED'
                        error('stop')
                    } else {
                        echo 'continue'
                    }
                }
            }
        }
    }
    stage("step4") {
        steps {
            sh '''
ls -la
touch step4
export step4=444
echo export3=$export3
'''
        }
    }
    stage("step5") {
        steps {
            sh '''
ls -la
touch step5
export step5=555
echo export4=$export4
'''
        }
    }

}


Refer to a stackoverflow article for more details.

The key problem in your example is that you started with agent any at the topmost level. That needs to be replaced with agent none and then each stage that needs an agent will need to declare that agent within the stage.

it works!
Thanks, You helped me a lot.