I need my regression tests to run in a separate ec2 slave box that will be launched automatically when I trigger the tests' build.
What is done by now:
I installed EC2 Jenkins plugin, created AMI from required instance, set up Cloud provider in Manage Jenkins -> Configure System, tested connection to Amazone console and set labels to that AMI.
So Jenkins can define required AMI (1) and that AMI has a label "UI_TESTS" (2)
I also set restrictions in Job settings to run only on nodes with the "UI_TESTS" label:
Now when I go Manage Jenkins -> Manage Nodes I can start a new node using this cloud provider:
And Jenkins actually connects to that ec2 instance.
Problem:
In such a case the node is running permanently. And If I delete created agent and try to run the Job build, I'll get an error that there is no such a label - UI_TESTS:
Question:
What is the appropriate way to trigger slave ec2 instance creation right after the job build starts without creating a node manually?
What are the next steps of setting Job build configuration so that cloud provider start the slave instance right on a build start?
So, eventually... I just needed to wait a bit before creating this post. What actually happened: when I started a build, it REALLY called ec2 instance creation from the cloud provider (with no need to create a node manually). But because it took about 2 minutes to start the instance and to get it into the working form, the job was pending and I started a panic.
To summarize: the algorithm above works correctly to start remote ec2 slave node on demand.