Jenkins - Cancel Uninstall Plugin - jenkins

I clicked uninstall for a plugin and now the Plugin Manager is showing me "Uninstallation pending" for that plugin, however, I have decided to keep the plugin. Since I cannot restart Jenkins and reinstall it at the moment, is there a way that I can cancel the request to uninstall this plugin?
Thanks!

Jenkins plugin's are under $JENKINS-HOME/plugins, [plugin].jpi files (similar content to war files, WEB-INF, META-INF) are located under this folder.
Jenkins extract these files into folder with the same name
$ ls $JENKINS-HOME/plugins/gradle*
gradle.jpi //installation file
gradle.jpi.pinned // flag file for pinned plugin
gradle.jpi.disabled // flag file for disabled plugin
gradle.bak // previous version jpi file
gradle: // extracted folder
help-GradleInstallation-home.html help-GradleInstallation-name.html help.html META-INF WEB-INF
if [plugin].jpi.pinned exists the plugin is pinned
if [plugin].jpi.disabled exists the plugin is disabled
when you upgrade plugin the old [plugin].jpi is renamed to [plugin].bak
the new one is [plugin].jpi this allows the rollback (downgrade) option
if [plugin].jpi is missing the plugin is pending uninstallion, on next restart Jenkins will delete all the files relevant to the plugin
So,
all you need to do is copy the [pluging].jpi* and [plugin] folder into $JENKINS-HOME/plugins/ folder and refresh the page, you will see it is not pending uninstall anymore.
*always recomanded to keep backup of $JENKINS-HOME dir

Related

How to update log4j-1.2.12.jar file in jenkins

I have this log4j-1.2.12.jar file in my jenkins server
Path to it: /data/jenkins/.m2/repository/log4j/log4j/1.2.12/log4j-1.2.12.jar I got this Apache Log4j Unsupported Version Detection message from security team, how to resolve this I tried downloading the latest version but it is something like this log4j-api-2.19.0.jar
No, it's not "in Jenkins", more accurately, log4j is not a part of Jenkins. Jenkins consumes its jars from the exploded war in ${JENKINS_HOME}/war/WEB-INF/lib. It is not located there.
If a plugin consumes log4j, that would be found within the exploded plugin directory at ${JENKINS_HOME}/plugins/<plugin_name>/WEB-INF/lib. The status of log4j as it related to most plugins was tracked under JENKINS-67353.
What you are referencing is the maven local repository, .m2/repository. This structure is created when running a maven build on the controller; the dependency jars specified in (one of) your build's pom.xml.
The guidance in the comments is correct; find the appropriate pom.xml and update it, then rebuild.
You can verify these claims by deleting the entire .m2 directory (or moving / zip;delete if you are paranoid) and restarting Jenkins. You'll discover Jenkins is running fine and the directory remains empty. Run your maven jobs and it will repopulate, including log4j-1.2.12.jar, assuming it's still specified in your pom.xml. Fix your maven pom.xml, delete the directory, rerun your jobs and it should not reappear.
Perhaps you have already updated your pom.xml but never cleared out your local maven repository, then it will not repopulate (you could check the timestamp of the directory to know when it was first/last downloaded).
You can also delete referenced portions of the repository by specifying mvn dependency:purge-local-repository and adding -DreResolve=false to avoid re-resolving. Of course, if you've already updated the pom.xml, it would remain since it's not referenced in the pom.xml` (yes, it would be nice if there was an option to purge all or most of a repository or all version of a given jar, but ...).

Use a plugin's fork for Jenkins

Instead of using this Jenkins plugin https://github.com/jenkinsci/quality-gates-plugin, I am trying to use a forked version of it: https://github.com/sarg/quality-gates-plugin that has some extra functionality.
I've downloaded the forked version as a .zip file. I changed the termination of the file from .zip to .hpi. Then, I added it to Jenkins's plugins directory.
This should have installed the plugin, right?
I am looking at installed plugins, but I can't find Quality Gates Plugin.
Do I need to do something else to install the plugin?
You have to build the plugin before uploading / installing the plugin in Jenkins. You do this by unzipping the downloaded zip file. Then, using your favorite terminal or command prompt that has maven on the path, you run mvn install. If successful, it will build the .hpi file for the plugin and can be found in the target folder, e.g. target/pluginname.hpi
For more info on plugin development and building plugins, look here.

Jenkins Artifactory Plugin (gradle) doesn't read version from gradle.properties

Currently I try to configure Jenkins, so I can do my release builds automatically. It should change the version number from SNAPSHOT to a release version, and do all the SVN commit stuff. After this is done, it should switch it back to a new SNAPSHOT version and commit it, too. Before I switched from maven to gradle, the same plugin worked correctly.
I already created a gradle build, that works correctly. It is reading the version from the property "version" in the gradle.properties file. This version is the one that is used in the gradle build. It's also possible to run "artifactoryPublish" to publish the JAR to my artifactory.
The problem:
When I open the dialog "Artifactory Pro Release Staging" (http://imgur.com/T44BtQB) it is not filling the fields "Release version", "Next development version", and none of the other fields. If I fill the fields by hand, everything is working correctly. As well the version in gradle.properties is changed and checked in correctly.
How could I solve this problem?
Used Versions:
Jenkins Version 2.7.1
JFrog Artifactory 4.7.4 rev 40169 (free version)
Jenkins Artifactory Plugin 2.6.0 (https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Artifactory+Plugin+-+Release+Management)
Gradle 2.14.1
Thanks!
According to your description, when you access the "Artifactory Release Staging" page, the "Release version" and "Next development version" fields are empty. This might be because you did not define the property names for your version and next development version in your Jenkins job configuration.
Here's how you do it:
1. Open your gradle.properties file and find the name of your version property. For example, if your gradle.properties contains:
version=1.2-SNAPSHOT
then the name is "version".
2. Open your Jenkins job configuration, and put "version" in the "Release property" and "Next development properly" text fields. You should find them under the "Release Staging" configuration.
Now, the Artifactory Release Staging page should know where to take your versions from. This configuration is not required when using Artifactory Release Staging for Maven, because in Maven the version can be found at one place only - in the pom file.
Hope this helps
The way I see it, it seems your gradle.properties could not be committed with the rest of your files with SVN. Can you check this?
If it is committed and is effectively present with all the other source files when Jenkins executes the build job, it may be worth ensuring that the Jenkins build job is looking for the gradle.properties file at the right place. The Gradle plugin's default behaviour is to search for the gradle.properties file at the root of each project. If that's not where your gradle.properties file is, you may want to set the path manually. To do so, add the following under 'switches', in your Jenkins job:
-Dgradle.user.home=$HOME/.gradle
Let me know if this helps.
possibly this happens due to the below reason, while reading the properties
File permission - check the file group and owner in the work-space where your gradle.properties is located
2.(Not sure on details, it helped me in resolving) After updating the correct file owner group, removed the version property from jenkins artifactory release management section and triggered the build and once it is successful and included the version in jenkins artifactory release management section and triggered the build and it solved the problem.

Grails Plugins from GitHub

If I want to use a plugin for Grails from Git Hub. Do I just download the zip file and make it available in my local maven repository? I'm behind a firewall which doesn't let me just resolve the dependencies.
You can get the source and run maven-install to make it available in your local maven repository, then you declare the dependency in the plugins block of the BuildConfig.groovy.
You shouldn't build from the repo source since that might include unfinished features and bugs. At the very least use source tagged for a particular release (if there are any).
If you want to download released plugins, they're available at http://repo.grails.org/grails/plugins/org/grails/plugins/
Keep in mind that running grails install-plugin /path/to/zip no longer works in 2.3, so you should stay away from that approach. Instead, you could run a local Artifactory instance that acts as a cached plugin repo - see this thread for some information to get started: http://grails.1312388.n4.nabble.com/Caching-plugins-using-artifactory-td4640164.html
The zip file which will be downloaded will be the source of the plugin. You have to extract the zip, go to the root of the plugin, and run grails maven-install (from release plugin) which would build the plugin artifact for you in you local maven repository if you have one setup.
Then you can use the plugin.
OR
You can use the plugin inline as mentioned in this answer.
Proxy setting can also be configured in grails by add proxy and set proxy.
grails add-proxy myproxy "--host=myproxy" "--port=myport" "--username=proxyuser" "--password=mypassword"
grails set-proxy myproxy
see grails docs.
if above solution doesn't work try then
create ProxySettings.groovy in C:\Documents and Settings\user-name.grails folder
add following two lines to this file and save
myproxy=["http.proxyHost":"myproxy", "http.proxyPort":"4300", "http.proxyUserName":"proxyuser", "http.proxyPassword":"mypassword"]
currentProxy="myproxy"
please check this link for more options
You can also keep plugins locally as described here
http://blog.armbruster-it.de/2011/10/project-setup-for-grails-with-customized-plugins-using-git-submodules/
git submodule add git://github.com/sarmbruster/grails-spring-security-ui.git plugins/grails-spring-security-ui
git add .gitmodules plugins/
git commit -m "added submodule"
now add plugins/grails-spring-security-ui as a inline plugin by adding to grails-app/conf/BuildConfig.groovy
grails.plugin.location.'spring-security-ui'="plugins/grails-spring-security-ui"
That's all.
More info in section "Installing Local Plugins" and "Specifying Plugin Locations" in docs:
http://grails.org/doc/latest/guide/plugins.html#12.1%20Creating%20and%20Installing%20Plug-ins

Jenkins nodelabel plugin where does .jpi come from?

I am writing a puppet script that will automatically setup a jenkins instance with the nodelabel parameter plugins. It successfully downloads the .hpi but the plugin still doesn't work.
When I install it using the web UI I see that a working version has both .hpi and .jpi files. I can't find a link for a .jpi anywhere so I am guessing this is generated from the .hpi. I'd like to know if/how this is created during the automated install process so that I can mimic it in puppet.
The .jpi and .hpi files are just zip files (JPI = jenkins plug in, HPI = hudson plug in). If you put the .hpi in your plugins directory (probably /var/lib/jenkins/plugins) and restart Jenkins, it will install the plug in.
What I found was Jenkins-ci.org stores .hpi files, and installing this way will leave them as .hpi files. Installing through the gui changes them to .jpi.
You might also look at the one of the existing puppet modules for Jenkins.

Resources