Start a build in Jenkins using a Slack Command
Slack Command
Incoming Webhook
/jenkins MyAwesomeApp
/jenkins MyAwesomeApp param1=value1 param2=value2
/jenkins
Jenkins
or whatevsSLACK_TOKEN
- token from your "Slash Command"JENKINS_URL
- URL to your jenkins hosthttp://user:auth-token@your-jenkins-host:port
. To obtain user authentication token click your name on the top right corner on every page, then click "Configure" to see your API token. (The URL $host/me/configure
is a good shortcut.), JENKINS_TOKEN
- API token for jenkins job. Bild Triggers
section in job configuration. Then input any random token and save. You will need to use the same token for all jobs you are planning to build from slack remotely, otherwise jenkins will fail with authentication error.SLACK_WEBHOOK_URL
- your incoming webhook URL/jenkins MyAwesomeApp
I used ngrok.com with basic authentication to expose my Jenkins server
fastlane
and call different lanes?You can! Make a parameterized build with a name called lane
(or whatever you want to call it). Make this a string or choice parameter with all your build lanes available as choices (beta, inhouse, app_store). Then use this $lane
in your build shell command in your job's configuration - bundle exec fasltane $lane
.
To call this from Slack, all you need to do is send /jenkins MyAwesomeApp lane=beta
.
Josh Holtz, me@joshholtz.com, @joshdholtz
jenkins-slack-command is available under the MIT license. See the LICENSE file for more info.