This sample attempts to establish a pattern to use Centos CI with JJB and python-cicoclient in a clean manner avoiding curl calls. This is from an actual example we're using in Gluster.
This leverages python-cicoclient which provides an ansible module and CLI client to consume the ephemeral bare metal provisioning infrastructure.
You need to set your ci.centos.org API key when connecting to the nodes as environment variables on your slave node(s).
This is done in Managed Jenkins
-> Managed Nodes
-> <node> ->
Configure
-> Node properties
-> Environment variables
-> Add
:
name: CICO_API_KEY
value: <api key>
To get the node, you include the get-node.sh script as a shell
builder. This will use the python-cicoclient on the commandline to get
you nodes for your test. The hosts will be written to $WORKSPACE/hosts
and the
ssid to $WORKSPACE/cico-ssid
by default.
If you have more than one host, you may want to add an extra shell script to convert the host file into an ansible host file.
To release the node, you need to use a post-task publisher. This way even when the job fails, the nodes are released back into the pool. We match the line "Building remotely" which should happen on every single job. This will catch all failures and soft abort (clicking the x button in the UI once). This will not run in a hard abort (clicking the x button in the UI twice).
The scripts and patterns are extracted from dmsimard's work for the RDO Project.