Replacement for Jenkins Scriptler plugin? - security

It looks like the Jenkins Scriptler plugin is no longer available, due to security reasons: https://wiki.jenkins-ci.org/display/JENKINS/Scriptler+Plugin
"Distribution of This Plugin Has Been Suspended"
Is there a similar plugin that I could use to run saved Groovy scripts?

Hi you can store your groovy scripts in Managed Files and pass the parameters to groovy script through Extended Choice Parameters Plugin.
Or else you can download Scriptler plugin source code and add it to your /var/lib/jenkins/plugin folder and start Jenkins server. It will work fine.

For removed plugins: You can find the .hpi file on archive sites on the internet, and then in Jenkins in Manage Plugins, use the "Advanced" tab > "Upload Plugin" to install it.

Related

Run groovy scripts for jenkins in IDE

I wanted to run groovy scripts in my IDE instead of Jenkins Script console. is this possible? If so where i can download http://javadoc.jenkins-ci.org/ API so that i can put that in classpath.
I cannot refer hudson.model.* and other classes with jenkins CLI jar
There is a webpage that explains how to configure Eclipse on how to Write Groovy scripts for Jenkins with code completion
Short version:
create a new maven project,
add jenkins dependencies,
update settings.xml to include jenkins repo,
add Groovy support to Eclipse(optional),
convert project to groovy and you're good to go.
BTW, for Eclipse Mars, the Groovy plugin is here: http://dist.springsource.org/snapshot/GRECLIPSE/e4.5/

Jenkins to SCP a few folders and files from SVN to linux server?

I use jenkins to do auto deployment weekly to a tomcat server, and it is fairly simple to do using the "curl" with the tomcat manager. and since i am only uploading a .war file, so its very straight forward.
But when comes to a backend console application, Anyone has any idea how to use jenkins to upload an entire "set of folders with files" onto a linux box? The project that i have is built via ant and has all the folder inside the SVN.
A couple things come to mind.
Probably the most straightforward thing to do is use the ant scp task to push the directory / directories up to the server. You'll need the jsch jar on your Ant classpath to make it work, but that's not too bad to deal with. See the Ant docs for the scp task here. If you want to keep your main build script clean, just make another build script that Jenkins can run named 'deploy.xml' or similar. This has the added benefit that you can use it from places other than Jenkins.
Another idea is to check them out directly on the server from SVN. Again, ant can probably help you with this if you use the sshexec task, and run the subversion task inside of that. SSHexec docs here
Finally, Jenkins has a "Publish Over SSH" plugin you might try out. I've not used it personally, but it looks promising! Right over here!

Manipulating Jenkins build parameter with groovy script, used for sonar analysis

At the moment, i have Sourcetree making my branches, they will be called "feature/my-branch" and i can send that to my hg repo, and retrieve it from jenkins and build.
but, sonar does not accept "/" in the branch name, so i wanted to change "/" to "-" or something.. in a groovy script in the build phase.
Is something like that possible?
my solution so far:
parameter: BRANCH
default value: feature/my-branch
groovy scrips: def replaced = BRANCH.replaceAll(/\//, '-')
but it will not recognize my BRANCH, i've tried adding it in all sorts of ways..
any help to make my "feature/my-branch" be analyzed by sonar will be appreciated.
How are you invoking SonarQube on Jenkins? I assume it's via the SonarQube Jenkins Plugin. You could use the EnvInject Plugin to edit BRANCH. Here's an untested possibility for you to mull over:
SONAR_BRANCH=${BRANCH//\//-}
And in the SonarQube plugin's "Additional options":
sonar.branch=${env.SONAR_BRANCH}
If that won't work, or if you don't want EnvInject, you could do everything in one Execute Shell build step:
SONAR_BRANCH=${BRANCH//\//-}
mvn sonar:sonar -Dsonar.branch=${SONAR_BRANCH}

Eclipse Helios fails to load toy plugin

I am trying to install a toy plugin that I wrote in Eclipse Helios 20100617-1415 under Fedora 12. Attempts at installing the plugin have all failed. The plugin does actually run when executed as an Eclipse Application (another copy of Eclipse is loaded and the plugin appears on the menu and does what it's supposed to). I put the jar file for the plugin in the /dropins/plugins directory and after several reboots Eclipse fails to load it and seems to not generate any error messages either. I also tried to load it directly using the Install New Software UI and that failed (added a directory where the toy plugin is and the response is: a dialog box pops up: No software site found at DIR_NAME. Do you wish to edit the location? At the same time in the name list area box behind the popup it says: Could not find file:DIR_NAME (the directory is valid and the jar file is there) - the other attempts are to load the jar file directly selecting archive instead of local in the Add Repository dialog - that too fails: first the jar name is mangled somewhat to jar:file:/DIR_NAME/TOY_NAME.jar!/ and then the same error messages come up already mentioned for just trying to use the directory location). So the installation mechanism is a complete failure but - how can I get it working? (Yes I can install plugins from the Eclipse marketPlace and other repositories). Thanks!
There are several ways to install your plug-in,
put your plug-ins into "dropins" folder if your eclipse enables polling that folder. The structure should look like below,
-dropins
-cdt
-features
-plugins
-myplugin_1.0.0.jar
export your plug-ins to your eclipse via menu 'File' - 'Export' - 'Plug-in development' - 'Deploy plug-ins and fragments' - 'Install to'

How can scripts extending VIM be managed?

I use VIM for code development and lot of things. I see that there are lot of scripts, configurations shared at vim.org/scripts, also some at github. Time to time I would like to check which one of the scripts used by me were improved. This would need either manual checking of the scripts, but I am too lazy to do that. Writing some code to do the checking and upgrading is also an option, but I am not sure whether there is any agreement what all script contributors always follow. I would like to have a upgrader for these scripts. Is there any solution, or any practice for maintaining the VIM scripts?
I use pathogen.vim to make updating scripts stored on github trivial. Put pathogen.vim in .vim/autoload and add call pathogen#runtime_append_all_bundles() into your .vimrc file to set up pathogen. Then in .vim/bundle, I git clone [vim plugin], and updating is as simple as a git pull in the appropriate directories.
What about :h GetLatestVimScripts?
If you are using Ubuntu Linux, you can install the vim addon manager:
sudo apt-get install vim-addon-manager
You can use vim-addon-manager (not that one that can be found in debian/ubuntu repositories). It puts plugins each into its own directory like it will be done with pathogen and also supports installation of plugins with one command. It is able to use mainstream git/mercurial/subversion/bazaar repository (if it is known by one of its authors) and install plugins from vim.org.

Resources