Run a remote command on all Jenkins slaves via Masters's script console

后端 未结 4 1765
执念已碎
执念已碎 2021-01-02 04:29

I want to run same shell command (very simple shell commands like ls) on all the UNIX slaves which are connected to the master by using the master\'s script co

4条回答
  •  南方客
    南方客 (楼主)
    2021-01-02 04:52

    Pretty old thread.

    I managed the same situation in next way. I have a pipeline jobs that is doing next stages: - first it checks online agents (since they are physical machine it may happen to be down) using something like: for "(slave in hudson.model.Hudson.instance.slaves)..." - next stage is to create jobs for each found agent using DSL plugin and list_of_agents.each. Besides jobs for every online agent, it's created a job that will run all of them in parallel. Of course, the new created jobs contains the commands that I want to run on agents. When I run the pipeline, on all agents will run the same script/commands and output is returned to master pipeline job.

提交回复
热议问题