In jenkinsfile, I have a parallel logic that runs on several nodes, how can I get the agent's name on which the code is being executed on?
These new parameter types are 'Node' and 'Label'. This is specially useful if you want to execute the job on different nodes without changing the configuration. It also allows you to use Jenkins in a scenario where you would like to setup different nodes with the same script/jobs configured - e.g. SW provisioning.
Visit a url like http:``//myslave:3141 to see whether a slave is running and how much memory it is using. Configure the port used by clicking Manage Jenkins on the dashboard.
An agent is typically a machine, or container, which connects to a Jenkins controller and executes tasks when directed by the controller. Artifact. An immutable file generated during a Build or Pipeline run which is archived onto the Jenkins Controller for later retrieval by users.
You can use the NODE_NAME
environment variable to fetch the Agent name within the Jenkinsfile. Here is a simple example:
node('master') {
stage('GetNodeName') {
def node_name = "${NODE_NAME}"
echo "The Node Name is: ${node_name}"
}
}
Here is the link to all the Environment Variables
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With