I want to make the nodes as one agent to run the scripts. How to add the agent label tag inside the stage by using the nodes?
{steps
{script
{last_started = env.STAGE_NAME
try{
def branches = [:]
def names = FAW_HOSTS.split(',')
for (int i=0; i<names.size(); ++i)
{def nodeName = names[i];
branches[nodeName] =
{node(nodeName)
{echo "Running patch oci vmscript.."
def exec = sh(script:"python $source_code_loc/patch_oci_vm.py $WORK_DIR", returnStdout:true).trim()
echo "$exec"}
}
}
parallel branches
}
catch (Exception e)
{currentBuild.result='FAILURE'
echo "The current status is ${currentBuild.result}"
echo "Failed: ${e}"
error "Run_task_on_multiple_host Stage Failed!"
}
} }
}