Friday, July 21, 2017

Setup Jenkins Bit-bucket environment in Windows Server 2008

Steps for setting Jenkins/Bitbucket CI environment in Windows - little trickier than Linux

1) Download and Install Jenkins-2.60.1(current as of the day written)

2) Once installed changed the port from C:\Program Files (x86)\Jenkins\jenkins.xml to ‘9090’ and
restart jenkins

3) Set security options to “false” from config.xml

4) Then open localhost:8090 and see if you can see Jenkins Interface

5) Install all default plugins plus following plugins to work Jenkins correctly with Bitbucket and
dev requirements for my workflow
        a. Bitbucket pull request builder plugin
        b. Maven integration plugin
        c. MS build plugin
       d. Next build number plugin
       e. NodeJS plugin
       f. SSH Agent Plugin      
       g. SSh plugin
       h. Self-organizing swarm plugin
       i. Categorized view plugin
       j. Publish-over ssh
       k. Schedule build
       l. Nugget
       m. Vagrant

6) Install git bash in the machine

7) From git bash, generate ssh-keys , ssh-keygen

8) Add the public key(id_rsa.pub) in BitBucket under group account


9) Install PsTools, extract it into C:\ PSTools. Get it from http://technet.microsoft.com/en-
http://technet.microsoft.com/en- us/sysinternals/bb896649.aspx

10) Run the following in a command shell running as administrator: C:\PsTools\PsExec.exe -i -s
cmd.exe

11) Do echo %USERPROFILE% in the shell to find out where this user’s home directory is
          C:\Windows\system32\config\systemprofile

12) Make a folder named .ssh in that home directory

13) Copy the keys (private and public) to the Windows machine in the .ssh folder

14) Run to generate known_hosts - C:\Program Files(x86)\Git\bin\sh.exe" -T git@bitbucket.org

    If no known_hosts generated from above method, open bash and run
    xxxx@computername23810BJ MINGW32 ~ ssh –T git@bitbucket.org

15)If not already available, you can copy your existing private key and known_hosts into the
correct location for the Local System User, for me this was something like the following:
   /c/Users//.ssh/id_rsa ~/.ssh/


Jenkins credentials setup for bitbucket.org  1. http://localhost:8090/credentials
  2. Add credentials
  3. Ssh username with private key
  4. Username – Jenkins
  5. Private key – copy and paste private key generated from above.


It should work. I have 

Reference-
https://noteits.net/2017/01/13/git-clone-via-ssh-using-jenkins-on-windows/
http://www.geekheads.net/getting-jenkins-on-windows-working-with-git/
https://wiki.jenkins.io/display/JENKINS/Git+Plugin

Jenkins

0 comments :

Post a Comment

 

© 2011 GIS and Remote Sensing Tools, Tips and more .. ToS | Privacy Policy | Sitemap

About Me