Can I set "data" properties on a Jenkins Logstash message? - jenkins

I'm sending build logs to Logstash via the logstashSend method at the end of a Jenkins declarative pipeline. The logs are being written to Logstash and I can query them in Kibana. The "data" section of the message contains what looks like a pre-configured set of Jenkins job properties. I'd like to add some properties to this set but I can't find any documentation that talks about how those properties are set.
Is there any way to add to/modify the properties in the data section of the message?

No, it is not supported yet, but is a highly requested feature.
You can see that there is an open issue (JENKINS-50455) for implementing this new feature.

Related

Is it ok to directly overwrite Dataflow template parameters that are set at build-time?

We would like to prevent certain parameters (namely filesToStage) of our Dataflow template from populating in the Dataflow Job page. Is there a recommended way to achieve this? We've found that simply specifying "filesToStage=" when launching the template via gcloud suffices, but we're not sure if this is robust/stable behavior.
For context, we are hosting this Dataflow template for customer usage and would like to hide as much of the implementation as possible (including classpaths).
Specifically the filesToStage can be sent as blank and the files will be inferred based on the Java classpath:
If filesToStage is blank, Dataflow will infer the files to stage based on the Java classpath.
More information on the considerations for this and other fields can be found here.
For other parameters, the recommendation is to use Cloud KMS to keep the parameters hidden.

Modify notifications on a running build in jenkins

I occasionally want to get notified when a particular jenkins job that is building finishes. Is there any way to do this?
Scripting it through the API would be fine. I already have the jenkins IRC bot that notifies me of many things, so if I could just dynamically modify the running job build, that would be enough to do what I want -- I'm just having a hard time finding how to accomplish that.
AFAIK, you cannot change a job's config while it's running.
Here is an idea: Use a post-build step to check for an external resource status (like a file containing an action by text) and running an action based on the content of the file.
The external file can be modified while the build is running, so when the post-build is executed, it will follow the logic defined based on the content of the file.
I hope this helps.
You can use email notifier, It will send you an email
https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin

How to use the 'Issue attribute path' in the parameter mapping of jenkins-trigger-plugin

I am willing to trigger my Jenkins job based on status change event from a JIRA issue. I am able to do it using jenkins-trigger-plugin. However I wish to get some more information about the issue like the description of the issue etc. I could see an environment variable named 'JIRA_ISSUE_KEY' but it gives me the key and nothing else.
As of the current release, the issue attribute path is currently resolved from this Issue object. All of jira-trigger-plugin configuration is documented in Jenkins help buttons, which is viewable in Jenkins job configuration.
description for example is retrievable via description path (which would call issue.getDescription() essentially).

Jenkins/Gerrit stream events - job triggered on newly created branch

I am using Jenkins in combination with the Git and Gerrit plugins. I would like to trigger a job on Ref Updated. However, I need to understand if the action behind this event is the creation of a new branch. If it is, then I will execute my shell script, otherwise not.
As far as I understood, this info is available in the Gerrit's event json response, but I do not know how to consume this json object via Jenkins in the first place.
Is there a way to achieve this easily via Jenkins (maybe something in the interface I missed)? Or is there another way to monitor the creation of a new branch while still in the Jenkins/Gerrit plugin environment?
So I just recalled there are a bunch of Gerrit environmental variables which are available to use in the building script,
namely these ones. I will just have to check if GERRIT_OLDREV is equal to 0000000000000000000000000000000000000000 and if so, it would mean the branch is newly created (for reference: here). Here is the picture I attached in full size.

How do I see detailed log messages from Jenkins emailing?

I am having trouble getting email-ext working. I've looked at the system log ("Manage Jenkins"/"System Log"), and it shows the job succeeded in running, but nothing about how email works.
Is there some way to turn up logging so I can watch the emailing portion of either default or email-ext firing? Maybe I can tell why email is not working if I can see what it's trying to do.
Edit: We're running Jenkins 1.484.
you can do this:
go to configure system-system log,and add a new recorder
Choose a name that makes sense to you.
configure loggers and their levels whose output you'd like to collect
you can look there:https://wiki.jenkins-ci.org/display/JENKINS/Logging

Resources