2. About me
● TOKUNO, Hirokazu
● IT system at Manufacturing site
● 4th year since assigned to IT at age of 39
– Learning a lots to catch up
● Little experience
– VBA, Java, Perl, Shell...
● Love to minimize code
– Pentaho ETL, Mojolicious
3. Purpose
● Jenkins to manage automation test although no
install allowed to server
● Pre-conditions
– No install on server
– Have Windows PC
– No install on Windows
– An account that can directory login and execute test
● Expected Results
– Trigger test from Jenkins and collect results
4. Preparation
● Putty Portable : To connect server
● Jenkins : Continuous Integration server
● Some xUnit
– In this example, a unit test for shell shunit2 is used
● Passion!
5. Putty Portable 1/2 Generate key
● PUTTYGEN to generate key
– Run %PuTTYPortable%
¥App¥putty¥PUTTYGEN.EXE
– Click Generate
– Move mouse!!!!
● Save keys as id_rsa.ppk,
id_rsa.pub for private key and
publick key
– Key passphrase
● Better to set a password for using key,
not same as password to login server
6. Putty Portable 2/2 Register key
● Copy public key to server
– pscp id_rsa.pub yourname@mycompany.com:id_rsa.pub
– Type “Y” for first connection, following message shall be
displayed.
– The server's host key is not cached in the registry.
~ some lines ~
Store key in cache? (y/n)
● Register public key on server
mkdir ~/.ssh
chmod 700 ~/.ssh
cd ~/.ssh
ssh-keygen -i -f ~/id_rsa.pub >> authorized_keys
chmod 600 authorized_keys
rm ~/id_rsa.pub
7. Pagent
● Use Pagent to omit password for every use
%PuTTYPortable%AppputtyPAGEANT.EXE "%HOMEDRIVE%%HOMEPATH%id_rsa.ppk"
● It may be good idea to put in startup
10. Configure Jenkins 2/2
● Build / Add build step / Execute Windows batch
command
– PUTTY_PATH and RSA_FILE shall be modified to
environment
setlocal
set PUTTY_PATH="D:PortableAppsPuTTYPortableAppputty"
set USER=your_user
set SERVER=some_server
set RSA_FILE="%HOMEDRIVE%%HOMEPATH%id_rsa.ppk"
set SERVER_COMMAND=sh ~/Test/test_pass.sh
%PUTTY_PATH%plink -batch -ssh -i %RSA_FILE% %USER%@%SERVER% %SERVER_COMMAND%
15. Conclusion
● Test can be executed from Jenkins without any
installation
– Script on server can be kicked from local PC
● Jenkins can judge the results from shunit2 on
server