Alternatively, you can create your own Pipeline method, a bit like this one
: https://github.com/jenkinsci/pipeline-examples/blob/master/
pipeline-examples/slacknotify/slackNotify.groovy
Since it's a simple curl, you can then directly use all the existing
options/parameters offered by the Slack REST API.

Note that it's better to centralized this method inside a Global Shared
Library (just in case you are not already using it :))


2017-06-30 16:11 GMT+02:00 Idan Adar <[email protected]>:

> Anyone? :)
>
> On Tuesday, June 27, 2017 at 8:13:35 PM UTC+3, Idan Adar wrote:
>>
>> In a Node.js app, one can use the slack-notify package to send something
>> like this:
>>
>>
>> slack.send({
>>       "username": "myBotName",
>>       "icon_emoji": ":robot_face:",
>>       "mrkdwn": true,
>>       "attachments": [
>>          {
>>             "mrkdwn_in": ['text','pretext'],
>>             "color": "#199515",
>>             "text": message,
>>             "fallback": "*my*: _markdown_ message."
>>          }
>>       ]
>>    });
>>
>> In a Jenkinsfile, one can do this:
>> slackSend (
>>        color: '#F01717',
>>        message: "$JOB_NAME: <$BUILD_URL|Build #$BUILD_NUMBER>, my
>> message."
>> )
>>
>> I'm looking for a way to accomplish the Node implementation, but using
>> slackSend so that the message dispatched from the Jenkinsfile will be
>> on-par with the Node.js-sent message.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jenkinsci-users/deaa0550-128a-4513-8972-0cf991d49bbd%40googlegroups.
> com
> <https://groups.google.com/d/msgid/jenkinsci-users/deaa0550-128a-4513-8972-0cf991d49bbd%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAPO77c2qac4BS3ue%3DbPCVo-4JAyEQkNLymm6%2B6AWx0tuxKvf%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to