Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: multiple channels #8

Open
hedin-hiervard opened this issue Apr 28, 2019 · 8 comments
Open

Feature Request: multiple channels #8

hedin-hiervard opened this issue Apr 28, 2019 · 8 comments
Labels
help wanted Extra attention is needed

Comments

@hedin-hiervard
Copy link

It's currently not possible to notify 2 channels and to add the plugin to the post-build step twice (it's greyed out). I think it's possible from a Pipeline, but I don't have a Pipeline job. Maybe as a workaround, someone could provide a simple downstream Pipeline job that only takes the upstream job info and sends it to Discord?

@KocproZ
Copy link

KocproZ commented Apr 28, 2019

Jenkins doesn't allow to add post build action more than once, and it can't be changed.
I think that using pipeline is the only way to do this.

@KocproZ KocproZ added the help wanted Extra attention is needed label Apr 28, 2019
@hedin-hiervard
Copy link
Author

I think that using pipeline is the only way to do this.

Can you please help me to create a pipeline job that is run after the main job and the only thing it does - sends the messages to the several Discord channels with build summary and artifact links?

@melt7777
Copy link

melt7777 commented Apr 28, 2019

If you do not want to make pipeline jobs,

You could use the post-build action "Build other projects" to have it call downstream freestyle or multi-configuration projects that have the Discord notifier as post-build actions.

Hope this is helpful.

Thanks for the great work!

~ melt
getpimp.org | miner.farm

@hedin-hiervard
Copy link
Author

If you do not want to make pipeline jobs,

You could use the post-build action "Build other projects" to have it call downstream freestyle or multi-configuration projects that have the Discord notifier as post-build actions.

Yeah, but will it have access to the artifacts of the upstream project?

@melt7777
Copy link

Ah, I didn't think of that. Still learning! :)

@KocproZ
Copy link

KocproZ commented Apr 29, 2019

Sadly I can't help you with creating such pipeline as I don't know how to do it :/

@melt7777
Copy link

melt7777 commented Sep 17, 2019

If you do not want to make pipeline jobs,
You could use the post-build action "Build other projects" to have it call downstream freestyle or multi-configuration projects that have the Discord notifier as post-build actions.

Yeah, but will it have access to the artifacts of the upstream project?

You're right. I've explored a bit and it looks like you're going to need to do a pipeline for this one. The Journey into learning Groovy and making Pipelines stored in Github or other version control is a beautiful thing and makes life so much better. It's worth checking out.

Simply create a new pipeline and use the following snippet inside it. Note: I use the declarative pipeline syntax.

Here's a snippet with pipeline example for discordSend function:

node ('master') {
    stage ('Notify') {
def discordDesc = "Description here.."
(...)
discordSend description: discordDesc, 
                  footer: discordFooter, 
                  link: env.JOB_URL, 
                  result: currentBuild.currentResult, 
                  title: discordTitle, 
                  webhookURL: discordURL, 
                  successful: currentBuild.resultIsBetterOrEqualTo('SUCCESS'),
                  thumbnail: discordImage,
                  notes: "Here's some Notes! @<id_to_mention>"
   }
}

You can set the variables and then call discordSend however you like, or put the fields as inline strings.

@bkostrowiecki
Copy link

Maybe is it a good idea to have multiple Webhook URL fields in Discord Notifier post build action?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants