hudson CI: how to delete all jobs?

前端 未结 4 751
死守一世寂寞
死守一世寂寞 2020-12-28 15:43

I have about 100 jobs on my hudson CI, possible to mass delete them ?

4条回答
  •  粉色の甜心
    2020-12-28 16:14

    I had similar manageability problems with a Hudson instance that was running 500+ build jobs - it was impractical to manually maintain that many jobs using the gui. However, you can provision jobs in Hudson remotely and programatically by using the CLI - which is supplied as a jar file [http://wiki.hudson-ci.org/display/HUDSON/Hudson+CLI].

    The command to delete a job would be something like:
    **java -jar hudson-cli.jar -s http://host:port/ delete-job jobname**
    
    And the rest of the commands you will need are here:
    **java -jar hudson-cli.jar -s http://host:port/** help
    

    I wrapped the cli in python and created an XML file from which to hold the build configuration - then I could use this to manipulate my running instances of Hudson. This also provided the ability to 'reset' the CI instance back to a known configuration - handy if you suspect build failures were caused by manual changes in the UI or if you are using a different CI server for each environment you deploy to (ie dev, test, prod) and need to provision a new one.

    This has also got me out of a few binds when badly written plugins have mangled Hudson's own XML and I've needed to rebuild my instances. Hudson is also I/O bound and for really loaded instances it is often faster to boot Hudson from scratch and populate it's configuration this way.

提交回复
热议问题