Set global description for Jenkins instance - jenkins

Using Jenkins we would like to set this global description by default. We have used groovy scripts to set other global variables but I'm struggling to find what methods / classes I need to call in order to set this description for our Jenkins instance. I see many description plugins for builds but this is instead the description you see on the Jenkins homepage (not per build). In the image below I clicked "Edit description" and then typed "test" in the box and pressed save.
That's the workflow we'd like to automate using Jenkins groovy code :)
Thanks!

The description that is shown in your image, is not a global Jenkins description but rather the description of the current view you are looking on - in this case the All view. If you switch to another view it will change.
To modify this via groovy code you need to modify the description of the view by its name:
Jenkins.instance.getView('all').setDescription("My New Description")
If you do want a global message that will appear always regardless of the selected view you can use the System Message option (configurable via the Configure System menu):
This message will be displayed at the top of the Jenkins main page.
This can be useful for posting notifications to your users
To update the system message via groovy code you can use the flowing:
Jenkins.instance.setSystemMessage("My System Message")

Related

Does Jenkins have a feature like credentials for non-secrets?

real simple question today.
Does Jenkins have a feature like credentials that is for non-secret information?
My use case is that I want to specify some values in jenkins to make them easily available to all of my pipelines. (e.g. an Azure subscription id) I tried to just use 'secret text' type credentials, but the magic that jenkins does to protect those credentials make it difficult to work with them.
I imagine it would be called something like global environment variables, or named values, but I haven't been able to find anything with my googling.
Thanks!
The following steps will help you setup global environment variables which can be used within various builds and pipelines. The steps may be slightly different based on the version of Jenkins installed. The steps noted below are based on version 2.7.4:
Navigate to Manage Jenkins on the left side menu
Click "Configure System"
Scroll down to find "Global properties"
Check "Environment variables"
Click "Add"
Add the name and value in correct input area (Example: arg_name & arg_value)
Click "Save" at the bottom of the page
To use this global environment variable, navigate to an input area within a build definition and use: ${arg_name}

Not able to access custom parameters passed to the jenkins build script

I want to add some parameters from the web hooks into the mail sent from the Jenkins. I tried solutions provided in StackOverflow and elsewhere. No success yet.
I have the following in place:
Checked This is a parameterized build
The build script looks like http://JENKINS_URL/job/android02/buildWithParameters?token=<My Token>&PARAM=<My Custom Params>
In the mail content, I try to access the custom parameters by ${PARAM}, $PARAM.
In the mail, however, I'm not getting the values I'm setting. If I set default values for PARAM, it is correctly displayed in the mail I receive. I tried http://JENKINS_URL/job/android02/build?token=<My Token>&PARAM=<My Custom Params> URL as well thinking just in case if it works. The mail is sent as Editable email Notification config.
Basically, everything is working except that I'm not able to access the custom parameters I have passed via Trigger builds remotely option.
Edit1:
If I keep a default value, say, test for the parameter, PARAM, in the mail received, I can see test displayed. But I need to get the value I'm passing in the build script.
From the "tool tip" that you get when you click on the question mark next to "":
${ENV,var="VARIABLENAME"}
Expands to an environment variable (specified here as VARIABLENAME) from the build environment. Note that this does not include any variables set by the build scripts themselves, only those set by Jenkins and other plugins.
So, use ${ENV,var="PARAM"}.

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).

Is it possible to show all the submits from a Perforce depot without having to select a job?

We are currently attempting to setup an instance of Jenkins as our build system for our code base. We have multiple jobs setup (all using the same depot) to build different sections of the code.
We would now like to show the submits from all users pertaining to this depot on the main Jenkins screen rather than being able to view the change lists involved with a certain build (e.g. by selecting a certain job and then the link leading to the build information, etc...). I've looked into possible plugins and the closest one I was able to find was the "All Changes Plugin". This is exactly what we would like, but this is only visible when viewing the details of a build (e.g. which CLs were used to create the build), but would it be possible to show this type of information on the main Jenkins page instead?
Thank you in advance for your help.
You could write an extension for the Dashboard View plugin to provide a portlet containing an aggregated list of changes from perforce, though if you aren't experienced with writing plugins then you might be better off using a separate repository browser such as Fisheye or P4Web to display your changes.

Cloudbees Jenkins dashboard customization

I would like to know how to customize dashboard on Jenkins under Cloudbees.
In the build execution I'm generating different reports (PMD, Cobertura, etc) but I don't know how to add/publish these reports in the dashboard.
Looking on Jenkins Wiki I've found this topic. It says:
On the create new view page, give your view a name and select the Dashboard type
The problem is that there isn't any "Dashboard type" and only the following options are available:
Groovy Script View
List View
My View
and none of these options allows to add reports.
"Free" and "Base" cloud plans provides only the essenstial jenkins plugins. Please
Refer: https://grandcentral.cloudbees.com/services/plans/dev.
Try a "List view" instead. You can make this the default view under using the /configure page.

Resources