In an ideal world our less tech-knowledgeable employees could just use a Slack command to run a job and get the results slacked back to them, negating the use of the Jenkins GUI. I found Start a build in Jenkins using a Slack Command on GitHub, but it's got a few limitations including that it seems to require a 1:1 ratio Heroku instance to Jenkins job, which isn't great for our purposes.
My thought is to have people use a singular command like
/jenkins, and use parameters after it that will be parsed by one job, and used to kick off others downstream. That keeps us to one slack command / one instance, but still gives us all the flexibility we need.
The issue falls in getting the parameters to Jenkins. I'm picturing something like the following workflow;
/Jenkins job2 param1 param2in Slack. This is calling an umbrella job that will parse the parameters to find out what to run.
Command is somehow sent to the umbrella jenkins job. Heroku instance, direct integration, w/e.
Umbrella job receives
job2 param1 param2as a string. (Perhaps as the value of a single parameter, perhaps pre-split into multiple fields)
Umbrella job splits the string if it hasn't already been done, and figures out that the user wants
job2run, using parameters
Umbrella job does a buildjob to run the downstream job as called, which will Slack back to the user their results.
It's steps 2-3 that are tripping me up. How can I pass a string (with spaces!) from Slack to my Jenkins job?
If my entire premise is wrong I'm also open to having my frame challenged.