Hide downgrade option of Jenkins CI Server - jenkins

The Manage Jenkins page shows a div with a caption and a button that offers to downgrade to the lastly installed version, as shown on the picture. Here is a screenshot showing the respective part highlighted in red.
I checked the HTML and I could manipulate the CSS .downgrade class to hide the <div>, but maybe I am missing out a configuration option.
Does Jenkins offer a way to disable or hide the possibility to downgrade?

To remove the downgrade button you need to remove or rename the jenkins.war backup file in the Jenkins installation folder. For example in the case of my Jenkins installation (1.625.3) the UI shows:
And (part of) the Jenkins installation folder looks like this:
Note that the folder has a jenkins.war.bak file. If you rename this file to anything else Jenkins will assume that there is no older version to downgrade to so it will not display the downgrade button.
In other words if I rename jenkins.war.bak to jenkins.war.bak.old like this:
Then the management UI page will look like this:
Which accomplishes the goal you were after.

Related

Jenkins - Update / Edit the left panel label

I have configured Jenkins in my system and running fine. But I need to configure the jenkins UI.
a) I want to remove the "Jenkins" logo in header and instead of that I need to add "some text title".
b) I want to edit the left panel labels.
Ex. Build history to Workflow history, My View to Workflow View and Build Executor Status to Workflow Executor Status
Do we have any option to edit the html/config file directly or need to install any plugin to edit these labels. Thanks for your valuable time.
You can use the Jenkin's plugin simple theme:
https://wiki.jenkins.io/display/JENKINS/Simple+Theme+Plugin
You can personalize the CSS, the home page, the favicon. Pretty much everything that you need.
If you just need to do minor changes, you can have a look at https://github.com/jenkinsci/jenkins/tree/master/src/site (site.xml). And the resources folder where the logo is stored.

Jenkins: prevent from reloading configuration

I am currently doing an analysis whether jenkins could fit for our needs.
Therefore I need to know something about (NOT) reloading configurations:
I know that there is an explicit way to reload a configuration (via WebGUI and CLI).
BUT:
Is there also a way to PREVENT Jenkins from reloading configs?
One requirement is that the CI-System reads in all config-files (general and job-configs) ONCE at the start of the ci-system. And afterwards a modification of the config-files shall take NO effect!
Do you know whether this is already the case (except I press that button under "manage Jenkins" | "reload Configuration from hard disk" [exact options might sound a little different because I only have a German version here])
Would be very thankful for your help,
Lukas
I run a Git repo to control the config.xml files so have experience of the xml files changing while Jenkins is running.
I can confidently state that Jenkins will not reread the config.xml file unless you specifically ask it to via the UI or cli. In fact if the config is changed via the UI any changes that has been done to the config.xml file will be overwritten with the in-memory version.

Moving Jobs in Jenkins

So I have been asked to create a job on a Jenkins system that is on the university servers. The problem is I was asked to create it in a specific folder. However I accidentally created in the root folder. Is there a way to move the job from the root to the specific folder or do I have to delete it and create a new one?
There is a move option on the GUI:
Stand on the little triangle near the job you want to move/copy/delete, and on the popup menu - choose the wanted operation. On move you can move to another folder.
But, There is also an open issue about this (opened on 2016):
https://issues.jenkins-ci.org/browse/JENKINS-35093
I had to restart Jenkins after doing it to a job with some history.
So maybe re-create/copy and delete is a better solution (but no history is saved).
Go to your job's configuration page and from 'Advanced Project Options' check 'Use custom workspace'. Enter the path of the directory where you want the files to be created.

Jenkins: Display last console output on project page

When viewing a project in Jenkins, I'd like to see the last console output displayed on the project page.
This satisfies two needs:
I most often just want to see what the output of the build was; clicking through to the last console output seems needlessly cumbersome
Non-technical management can't remember how to / aren't sufficiently motivated to click through to the last console output in cases where the output is relevant to them if only they were to easily see it
I've looked for plugins that support this but can't find any.
What options do I have?
First an easy solution: job descriptions (push 'edit description' button on the main job page) admit HREF links. Make that link your latest build console permalink (http://[jenkins_server]/job/[job-name]/lastBuild/console).
If even one click is too much, here's a possible solution: you can use log contents as the description of your job. You can update your job via Jenkins CLI with:
java -jar jenkins-cli.jar -s http://[jenkins-server] update-job [job-name] < config.xml
So what you need to do is this: after your jobs run, trigger another job that will take the triggering job and console output file as parameters, substitute <description> in the job's config.xml with the contents of the console file (with proper escaping, etc.), and run the update command as above. Of course, this solution is labor-intensive and bug-prone.
I had this same questions myself and I ended up finding this option useful...
http://[jenkins-server]/job/[job-name]/[build-number|lastBuild]/logText/progressiveText?start=0
Edit: This no longer works in the current version of Jenkins
Similar to malenkiy_scot's answer, you can actually embed iframes in the description.
I use:
<iframe src='lastBuild/consoleText' style='width: 80%; height: 500px'></iframe>
as my project description, and it shows the latest console text in the project description page.
I just created a plugin that displays console output of latest build at the project page.
https://github.com/jenkinsci/display-console-output-plugin
To use this plugin, you have to type mvn hpi:hpi to create a display-console-output.hpi file. Then upload this plugin from http://localhost:8080/pluginManager/advanced.
You can simply just use one of these plugins:
http://wiki.hudson-ci.org/display/HUDSON/Hudson+Personal+View
https://wiki.jenkins-ci.org/display/JENKINS/Console+Column+Plugin
May be you don't need it, you can click in the status button in the left of each build, each button show console output for each build.
Of course, this feature may not be operative in all Jenkins versions.
The solution for your problem is the https://wiki.jenkins-ci.org/display/JENKINS/Extra+Columns+Plugin plugin for Jenkins. After installing it you may modify your view to add a button for the console output as an additional column.
For a declarative pipeline, you can show a link to the console right where the progress bar shows up by adding this line at the very top of the file:
currentBuild.description = """Job console"""
This depends on a plugin and a setting, both of which were already on my system:
The OWASP Markup Formatter plugin provides the setting Security > Configure Global Security > Markup Formatter, which should be set to "Safe HTML".
The setting Jenkins -> Manage Jenkins -> Configure System -> Jenkins Location -> Jenkins URL needs to be the URL of your Jenkins installation.

Teamcity custom reports tab

I am trying to create a custom tab in my Build reports. I followed this link given under teamcity manual. But the tab simply does not appear for me. What am I doing wrong?
I see an entry being created in the config/main-config.xml like this. But still this does not help me showing the specific tab.
<report-tab title="Koverage" basePath="/usr/braga/helloworld" startPage="braga.html" />
By the way, I am trying to integrate the .html generated for rcov code coverage gme within my Rails project.
I finally found out what I was doing wrong. Actually, I have to first create artifacts and have them saved in the artifact directory. Then, I will have to include those artifacts in the build I choose. The base path has be "." (meaning current directory) and the filename can be index.html. Here is a screenshot after I configured it.

Resources