Looking for a way to run a workflow on all self-hosted agents in a pool

I’m trying to run a maintenance workflow on all agents.
It’s a cleaning job like “docker system prune”. I wish it runs on all self-host agents (about 12 agents) weekly on Sunday night.
I noticed that workflows can run with on schedule event. This is great.
But I didn’t find a way to make all self-hosted agents to run the workflow. Any suggestions?

Do not try to use workflows for maintenance of the runners machines (“agents”). Beyond groups you can’t control where a job ends up, and jobs aren’t meant to change the agents themselves.

There are two options I can recommend:

  • Set up cron jobs on the agents. Cron lets you define commands to run at certain times. This way each of your agents cleans up on its own, no external instruction needed. I think that’s the best tool for your regular cleanup.

  • Use a remote management tool, e.g. Ansible. Simply put, you can configure which hosts to manage, and then tell Ansible what to do with all of them. It’s probably a bit overcomplex for your task, but if you want to maintain the agents automatically it’s probably worth a closer look.

Of course you could also use Ansible to configure the cron jobs. :grinning_face_with_smiling_eyes: