GitHub and Jenkins Integration on Windows 10
Here I am going to list down the steps which basically helps to any person who is trying to setup GitHub and Jenkins on Window 10 environment very first time-
In this integration, very first thing is you should have access to GitHub or you should create a GitHub account, as it is free.
Account and Project Creation on GitHub
1: Create a GitHub account or Login to GitHub using your login credentials.
2: Click on ‘Start a project’ button which is available on home page.
3: Provide Repository Name in ‘Repository Name’ edit field.
4: Leave the default setting.
5: Click on ‘Create repository’ button.
6: You will be navigated to your created black project page.
Install Git (v2.14) on your local machine and on Jenkins server (In my case, I did on Windows 10 Machines).
1: Download Git from https://git-scm.com/download/win.
2: Execute download exe file.
3: Go with default select option and click Next..Next..and Install button.
Note: Here I am giving reference to .Net project which we will push to GitHub and build with Jenkins.
Create .Net Console Application (In my case, I did on Windows 10 Machine).
Note: Using .Net 4.5.2 Framework
1: Open Visual Studio.
2: Click New > Project link.
3: Select Templates > Visual C# > Windows > Console Application.
4: Add some line of code and build the project from Visual Studio.
Push the code to GitHub
1: Open Git Bash
2: Go to your project location.
3: Type this command ‘git init’ and hit <ENTER> key.
4: Type this command ‘git add .’ and hit <ENTER> key.
5: Type this command ‘git commit -m “Comment”’ and hit <ENTER> key.
6: Now go back to your GitHub > Project and copy the location which would be like this-https://github.com/mayanktoc/TestProject.git
7: Now type this command in Git Bash ‘git remote add origin <Project Path> and hit <ENTER> key.
8: Type ‘git push origin master’ command and hit <ENTER> key.
9: Now refresh the GitHub project page and you would be seeing your project artifacts over there.
Install and Configure Jenkins (v2.86) Build Server on Windows 10 machine
Pre-requisite
1: Latest JDK should be installed on this system.
2: .Net 3.5 and 4.5 should be installed on this system.
1: Download Jenkins from https://jenkins.io/download/ (In my case, have v2.86).
2: Extract the Zip file in some location and execute Jenkins exe file.
3: Install with default selected options.
4: Click on Finish button and wait for few minutes as it will setup Jenkins for you automatically.
5: Cancel Customize Jenkins page.
6: Click on Start using Jenkins button.
7: Click on admin > configure link which displays at right top.
8: Change the password for admin user. Click on Apply and Save button.
9: Click on Jenkins link and come to home page.
10: Click on Manage Jenkins > Manage Plugins link.
11: Go to Available tab and filter for Git Plugin, GitHub Plugin, MSBuild Plugin.
12: After installation come to Home page.
13: Click on Manage Jenkins > Global Tool Configuration link.
14: Go to Git section and add path of git exe in ‘Path to Git executable’. In my case, it location in ‘C:\Program Files\Git\bin\git.exe’.
15: Go to MSBuild section and click on Add MSBuild button.
16: In our case, we are using .Net 4.5.2 framework, so give ‘v4.5.2’ in Name field.
17: Now provide the path of MSBuild in ‘Path to MSBuild’. In my case its located in ‘C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe’
18: Click on Apply and Save button.
Create New Jenkins Job
1: Home page, click on ‘create new jobs’ link.
2: Enter your project name and select Freestyle project.
3: Click on OK button.
4: Come to Source Code Management section and select Git radio button.
5: Click on Add > Jenkins button which displays next to Credential label
6: Provide your GitHub username and password.
7: Click on Add button.
8: Select the same added value in Credential select field.
9: Copy your project location from GitHub and paste in Repository URL text field.
10: Come to Build Triggers section and select Poll SCM radio field.
11: Enter “5 * * * *” in the Schedule text area, it will check for changes every 5 minutes.
12: Come to Build section and click on Add build step > Build a Visual Studio project or solution using MSBuild.
13: Select available option in MSBuild Version select field (This option is coming Global Tool Configuration page).
14: Provide your project .sln file name in MSBuild Build File text field.
15: Click on Apply and Save button.
16: Now click on Build Now link which display in left pane.
17: Now click on #1 link which is displaying under Build History and click on Console Output link to check the health of your build.
Thanks You!!

 

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s