How to trigger a jenkins build from slack via middleware - jenkins

I am trying to trigger a Jenkins build from Slack and it looks like I might have to write new Middleware. Can anyone help with this as I am not really strong in programming and scripting?

There is a pretty detailed blog post here by Nguyen Sy Thanh Son that delineates how to do this in detail. At a high level, it basically comes down to configuring your Jenkins job so that it can be triggered remotely and creating a new Slack command that triggers the Jenkins job.

Related

How to trigger Jenkin Jobs from Microsoft Team Channel?

I am looking to trigger Jenkins's job from the Microsoft team's channel. Can anyone provide step by step implementation of this?
There are two nice options you can use:
Outgoing Webhook - Will scan for words in the chats and send a notification to your Jenkins server.
Commander - Second and more customizable option is using the Commander add on for teams, which in addition to builtin commands provides the ability to Create your own Custom Commands.
With both options you will be able to tigger Jenkins jobs via the Remote Access API, see the This Question for additional info on remote execution.

How can I trigger jenkins jobs with a slack bot?

I have Jenkins running on one of the VMs on GCP. I have a bunch of jobs and I want to give my team access to run them from Slack. They haven't used Jenkins earlier, and not at all familiar with the UI. So, they want to run it from Slack. We already have a slack bot. So, here are my following questions:
Can I integrate our existing slackbot with jenkins, so that it can trigger the jobs? If yes, how can I do it? (any tutorial would be greatly appreciated)
I know there is a way to do this with slash commands. But I don't want run a different command for each job, it's actually not really clean. Cause if I have 20 jobs, I have to create tokens for all of them, and configure 20 slash commands.
What are the other ways of triggering Jenkins jobs from Slack?
PS: I'm looking for something like #bot run "job" "parameter" or #bot run "job". And it would be great if the bot can tag the user and respond to a request
you have to create a slack app for this and enable events and interactivity.
https://api.slack.com/apis/connections/events-api#the-events-api__subscribing-to-event-types__events-api-request-urls__request-url-configuration--verification__url-verification-handshake

What is the best way to generate events from Jenkins?

I have a series of jenkins pipeline jobs to move Apps to Cloud Foundry. My client application need to be able to listen to all the updates of a push. I.e. apart from getting text logs, i need other events like Git repo cloned, cloud foundry logged in, App pushed.
One crud way of doing this is to submit POST requests to an event server from a shell script(Curl). However, I think it is unlikely that such a functionality does not exist already on Jenkins(either through a plugin or something like that).
I need an advice from best practices point of view.
Thanks.
As commented by mdabdullah. But this needs a person to set up kibana or splunk. (I did not try this).
Statistics gatherer plugin
https://plugins.jenkins.io/statistics-gatherer/
Jenkins notification plugin
https://plugins.jenkins.io/notification/
Both 2,3 are available plugins in the Jenkins community. They need to configured for server endpoints before use.

How can I send the Jenkins environmental variables as a response back to REST API?

Generally, we can send the variables dynamically through the parameterized project in Jenkins using the REST API. Now, in the same way, I want to send Jenkins current build number as a response to REST API. Is it possible? or Any alternative way means any plugins could help to achieve this?
Could anybody suggest me on this?

JIRA Integration with external systems

I'm working on a POC to automate downstream processes in external systems based on JIRA processes and have hit a wall with the API. It appears to have great integration for pulling data about tickets out of JIRA and for the ability to externally generate tickets into JIRA.
However I don't see how to trigger external calls as a part of my workflows. For example if a ticket should be prevented from being routed to the next stage of a workflow without accessing a database to ensure availability of inventory first how could I do that in JIRA?
Based on attributes in the JIRA ticket upon final completion of the workflow we'd like to send a JMS or REST message or possibly update an external database. Is this possible?
Thanks all in advance for the help!
If you want to do a "before" check, use a Validator on the Workflow Transition.
I strongly suggest deploying the (free) Script Runner add-on. There you can implement a ton of things. For example, you'll get a new validator option "Script Validator", where you can specify a Groovy script that decides if it lets through the transition or aborts it.

Resources