Complete the code to define a permanent Jenkins agent node.
node('[1]') { echo 'Running on a permanent agent' }
The label 'permanent' is used to specify a permanent Jenkins agent node.
Complete the code to launch a cloud agent using the Jenkins pipeline.
podTemplate(label: '[1]') { node('[1]') { echo 'Running on a cloud agent' } }
The label 'cloud' is commonly used to define cloud agents in Jenkins pipelines.
Fix the error in the Jenkins pipeline code to correctly use a permanent agent.
pipeline {
agent {
[1] 'permanent'
}
stages {
stage('Build') {
steps {
echo 'Building on permanent agent'
}
}
}
}The 'label' keyword is used to specify an agent with a label in declarative pipelines.
Fill both blanks to define a cloud agent pod template with a label and container.
podTemplate(label: '[1]', containers: [containerTemplate(name: '[2]', image: 'jenkins/inbound-agent')]) { node('[1]') { echo 'Running in cloud agent container' } }
The label 'cloud' is used for the podTemplate and 'jnlp' is the standard container name for Jenkins inbound agents.
Fill all three blanks to configure a permanent agent with a custom workspace and label.
node(label: '[1]', customWorkspace: '[2]') { stage('Test') { echo 'Running on [3] agent with custom workspace' } }
The label and agent type are 'permanent', and the custom workspace is '/home/jenkins/workspace'.