Creating a scaling pipeline
Now comes the exciting part. We're about to start writing a Pipeline job that will serve as the base for the first self-adaptation script.
open "http://$(docker-machine ip swarm-1)/jenkins/newJob"
Once inside the New Job screen, please type service-scale
as the item name. Select Pipeline
as job type and click the OK
button.
Since Jenkins service we created comes with enabled authorization, we need an authentication mechanism for triggering builds. We could use the administrative username and password. A better option is to make a trigger that will be independent of any particular user. That can be accomplished with tokens.
Please select the Trigger builds remotely
checkbox from the Build Trigger section of the job configuration screen. Type DevOps22
as the Authentication Token. We'll use it to authenticate remote requests which will trigger a build of this job.
Now we can start writing a Pipeline script. There are quite a few things that it should do so we'll go step...