Add credentials to Jenkins

Click ‚Credentials‘, then follow .. no?

Then you’re right here. How to set up Jenkins from scratch an add some Credentials to it’s store automatically, or, at  least, in an automatic manner.

There are some great ways to build up jobs like the Jenkins Job-DSL and some, not that great, but still cool features like the Jenkins CLI. With that command line interface you are capable to script a lot of maintenance task on Jenkins (like: shutdown, credentials mgmt, job and plugin mgmt – look into it). Unfortunately some details of that calls are not well documented, so let’s provide some small examples to it.

Fetch Credentials (w/o password)

java -jar jenkins-cli.jar -s http://localhost:8080/ \
get-credentials-as-xml \
system::system::jenkins _ some_credential_id

This is quite cryptic for my old eyes. You have to provide „STORE DOMAIN CREDENTIAL“ as parameters, but how to get it’s system::system::jenkins for „STORE“?  I don’t know. It’s in the tests of the source code as mentioned on the net, of course it is.

Create Credentials

Don’t wait too long, here it is:

echo '<com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl>                                      
 | java -jar jenkins-cli.jar -s http://localhost:8080/ \
   create-credentials-by-xml system::system::jenkins _

Gorgeous, isn’t it? Of course you may try to replace _  with a „DOMAIN“ you like, but remember: Don’t touch a running system.

Is there a better way?

Probably, but that depends. On you, of course. Maybe it’s better to get your passwords from some sort of vault, if you have. Some application, even some plugin could provide such data to your job and then, you don’t even  have to set up passwords in jenkins. No maintenance, just some time to get the passwords while you’re build’s running is needed though.

How does Jenkins store it’s passwords?

Look into DefaultConfidentialStore. Then you learn, it stores a master password  on: $JENKINS_HOME/secrets/master.key. This master key encodes all your passwords to a cipher string which itself will get stored on: $JENKINS_HOME/credentials.xml. That last one was easy of course.

It’s quite easy as well to decode that cipher texts from credentials.xml. Just land on the jenkins script page (http://localhost:8080/script ) and put in:

import hudson.util.Secret
def secret = Secret.fromString("..your_cipher_text..TsnOBWqAo4=")

Maybe hudson gets replaced by jenkins, but at the end of 2016 it’s not the case on that package name.



Schreibe einen Kommentar

Jenkins Job DSL

Some notes, just to remember:

Schreibe einen Kommentar

image tools

Handling images should be easy if you dare to trust one of the big player tools like picasa or adobe lightroom.

If not some work has to be done. Some of this work could be done with one of the following tools.

– Bilderordner (german):
sorts images from one directory into multiple directories according to the day, the image was taken. That’s handy if you’re faced with more than one hundred of images or more than twenty different shooting situations, that to say, when you’re backing up your images from a point-and-click cam after a year of convenience.

– EXIF Date Changer:
Facing the situation that the battery of the cam has been empty and you missed to reconfigure the right date and time.

– Image Resizer:
Let you resize images from the (windows) context menu.

Schreibe einen Kommentar

Running Jenkins


Jenkins could run on its own with the winestone http server included.
To run it, simply call:

java -jar jenkins.war

But that’s no real life example, mine is:

JENKINS_HOME=/var/cit/jenkins java -jar /opt/jenkins/jenkins.war --httpPort=8082 --httpListenAddress=127.0.1 1> /opt/jenkins/jenkins.log 2>&1 &

And BTW, access it through an apache, only:


Jenkins folks update their software frequently, this is a simple update tool chain:

$ ps -ef | grep jenkins
$kill -9 ...
$ cd /opt/jenkins
$ wget -O jenkins-1.234.war
$ rm jenkins.war; ln -s jenkins-1.234.war jenkins.war
$ # run.. , see above

Schreibe einen Kommentar

Java, SQL with Maven, HSQLDB and Eclipse

Keep it simple, but not too simple [Einstein]


It’s not trivial to create a simple java project, at least there are these dependencies to manage. Further you may need an database server to do the first steps to an serious application (and testing)

A Solution

My solution uses

  • maven to create the application structure. Mind that a lot of open source applications use that structure
  • maven to manage the dependencies of the application
  • hsqldb as a lightweight database server
  • eclipse to code and test

Create the application structure

Here is what I use [theReference]

mvn archetype:generate \
  -DgroupId=your_tld.your_groupId \
  -DartifactId=your_app_name \
  -DarchetypeArtifactId=maven-archetype-quickstart \

(remember to replace: „your_tld.your_groupId“ and „your_app_name“)

So I get, what I want, an simple java project:

$ find your_app_name/

So maven created an source tree, an file „pom.xml“ an application file and it’s test pendant, too.

Now create the eclipse files, that’s simple, merely call:

$ cd your_app_name
$ mvn eclipse:eclipse

and get the files (.classpath and .project):

$ ls -alh
. .. .classpath .project pom.xml src

You may run this application file now with mvn package, but that’s not my focus here.

Handle an dependency

Let’s explain how to add an dependency, wisely that for [hsqldb]. To find the latest version use the product homepage or one of the repository viewers [example]. Mind: there is hsqldb/hsqldb and org.hsqldb/hsqldb, use the later one for current releases.

Dependencies with maven are managed within the file „pom.xml“

Due to the created test file there already is an dependency to JUNIT, so place the one we want to need beside of it:


Now it’s time to retrieve the dependency from the (default) repository „maven-central“. You may do this implictly by building the application (mvn package) but there’s an explicit command as you may expect:

mvn dependency:resolve

See what you’ve done:

$ ls -1 $HOME/.m2/repository/org/hsqldb/hsqldb/2.2.4/

Now again you may update your eclipse file (mvn eclipse:eclipse):

<classpathentry kind="var" path="M2_REPO/org/hsqldb/hsqldb/2.2.4/hsqldb-2.2.4.jar"/>

It created an Eclipse-Classpath-Variable called M2_REPO, which abstractly define the real path under your home-directory (see above).

Manage HSQLDB through Eclipse

I prefer to create one or more run configurations  in eclipse to run the hsqldb and it’s manager application.

First, for the server

  • Name: hsqldb-server
  • Main class: org.hsqldb.Server
  • Programm arguments: --database.0 file:your_db_name --dbname.0 your_db_name
  • Mind: replace „your_db_name“ (twice)

Second, for the Swing-Manager

  • Name: hsqldb-manager
  • Main class: org.hsqldb.util.DatabaseManagerSwing
  • Programm arguments: --driver org.hsqldb.jdbcDriver --url jdbc:hsqldb:hsql://localhost/your_db_name --user "SA" --password ""
  • Mind: replace „your_db_name“ again and realize that works only if you provide this configuration by the first time you start the manager and providing your settings.

Mind, that creates files in your „.metadata“ which you may want to backup:

$ ls -1 ..\.metadata\.plugins\org.eclipse.debug.core\.launches | grep hsqldb

Schreibe einen Kommentar

Apple Alu Keyboard unter Windows 7 nutzen

Nach meinem Umstieg auf Windows 7 war es leider gar nicht so leicht, dass Apple Alu-Keyboard unter Windows 7 in Betrieb zu nehmen.


Meine Probleme waren allerdings erstmal nur:

  • Alt-Tasten sind nicht „an ihrem Platz“. Hier ist also der Austausch der linken Alt-Taste mit der Apple-Cmd-Taste notwendig

Unter Ubuntu war das noch relativ leicht. Das hatte ich für Windows 7 auch erwartet.


Nach einiger Suche bin ich auf folgenden Einträge gestossen:

Das Video selbst ist nicht viel wert, wohl aber die Links darunter:

  • Tool: Sharp Keys
    Dies erlaubt den Austausch der linken Alt-Taste mit der Apple-Cmd-Taste
    Das Programm erzeugt Registry-Einträge für Key-Mappings in Windows. Damit kann man den Austausch echt durchführen. Wie das aussieht, beschreibt der im Youtube-Video referenzierte Blog-Eintrag, hier die wesentlichen Angaben, die ich genutzt habe:
    – „Special Left Alt“ => „Special Left Windows“
    – „Special Left Windows“ => „Special Left Alt“
    (Neuanmeldung oder Reboot notwendig)
  • Tool: Apple Wireless Keyboard
    Erhält bestimmte Funktionen, die man vom Mac gewohnt ist, behebt leider den Austausch von Alt und Cmd nicht zuverlässig.
    Da Funktionen wie
    – Screenshot (F3)
    – Medien-Kontrolle (Laut-Leiser-Mute – F7-F11)
    ganz nützlich sind, nutze ich das auch.

Schreibe einen Kommentar