1.

How do you create a Job in Jenkins?

Answer»

As a part of the FIRST step we need to visit the Jenkins URL, once we are on Jenkin page we need to click "New Job", then we need to click on  "Build a free-style software project". The above activity consists of SEVERAL components: like SCM, for instance, CVS or Subversion where our source code abides. optional triggers to control when builds will be performed by Jenkins.some sort of script that plays out the build(ant, maven, shell script and so on.) where the veritable work happens optional steps to accumulate information out of the build, for instance, archiving the artifacts along with recording Javadoc and test results.

Please FIND the below steps for creating jobs in Jenkins :

  • Stage 1: First of all we need to sign in to Jenkins Dashboard for creating a freestyle job. Usually, Jenkins hosted locally at only if we have configured Jenkins in some other way, use the hosted URL to get to our Jenkins dashboard.

  • Stage 2: In the upper left-hand side of our dashboard click the "New Item".

  • Stage 3: In the following screen, we need to enter the name of the item which we would like to create. We will create the "Hello WORLD" for this exercise: Choose Freestyle project and click OK

  • stage 4: Let's enter some project details like below screen :

  • Step 5: Now we can click on the Source Code Management section and enter our repository URL. We have a test repository hosted at https://github.com/*/*.git

We can also leverage local repo as well in case if we have.

On the off chance that if our GitHub repo is private, Jenkins will initially approve our login accreditation with GitHub and after validation pulls the source code from our GitHub repo.

  • Stage 6: Once all configuration settings completed, it's an ideal OPPORTUNITY to build the code. We can change the settings under the build segment to build the code at the time whenever we need. Build can be scheduled as well to trigger it at the specified time.

In the build section we need to do below two things :

  1. We need to first click on "Add build step"
  2. We need to click on  "Execute Windows batch command" to execute the commands we wanted to trigger during the build process.

Let's add some sample java commands to test the workflow :

We can add below commands for our testing :

javac HelloWorld.java java HelloWorld

  • Stage 7: Once we are done with all the changes, we can click apply and then save the project.
  • Stage 8: We should click the Build Now button which is on the left-hand side to trigger the build.

  • Stage 9: Under build history section we can check the status of every build triggered.

  • Step 10: Click on the build number and then Click on console output to see the status of the build you run. It should show you a success message, provided you have followed the setup properly.



Discussion

No Comment Found