Some Important Concept In Jenkins

Some Important Concept In Jenkins

Schedule Project:-

You have already some jobs that are available in Jenkins. You need to do a manual build every time. Now you want to do it automatically then you have to follow the below steps.

Go to the Job first ---> Configure ---> Build Triggers ---> Build Periodically

Where "* * * * *" is your scheduling structure.
1st * is for Minute
2nd * is for Hour
3rd * is for Day
4th * is for Month
5th * is for Week

This is how you can do building activities automatically. If you schedule your service like this then Jenkins will pull out the code from the GitHub repository and start building the job. Whether you change the code or not Jenkins will trigger it for every 1 minute and start building the job and this is the drawback of build triggering.

So for this, there is another way to do scheduling.

---------------------------------------------------------------------------------------

Source Code Polling (Poll SCM):-

Now go to the Jenkins Homepage.

Goto your project or job ---> Configure ---> Tick on Poll SCM ---> Schedule your Job

With Poll SCM also you can schedule your job but it will trigger or start the building activity whenever we do some changes in the GitHub repository.

----------------------------------------------------------------------------------------

Linked Projects:-

There are two ways in Jenkins to link your project.

1. Upstream Linked Project
2. Downstream Linked Project

Upstream Linked Project:-

You have 3 jobs in your Jenkins View Job A, Job B and Job C.

Now you want to link Job A with Job B and Job B with Job C.
So first You have to go to,
Job A ---> Configure ---> Post Build Action ---> Build Other Project ---> Project to Build,
and here Project to Build you have to mention Job B.

So once Job A finishes his build action automatically Job B will trigger and perform his build action.
Likewise, you have to mention Job C in Job B Project to Build.

Downstream Linked Project:-

You have 3 jobs in your Jenkins View Job A, Job B and Job C.

Now you want to link Job A with Job B and Job B with Job C.
So first You have to go to,
Job B ---> Configure ---> Build Trigger ---> Build after other projects are built (tick on this) ---> Project to watch (Job A)

Job B will watch Job A and once Job A finishes his build action Job B will trigger automatically and start his building activity.

----------------------------------------------------------------------------------------

User Management:-

With the help of User Management, you will able to manage your user's permission.

Go to Jenkins Homepage ---> Manage Jenkins ---> Manage Users

Create 2 Users --> User1 and User2

Once the User is created, log in with that User. By default, you have all the permissions.

Now Login as Admin again,
Jenkins Homepage ---> Manage Jenkins ---> Manage Plugins and you have to install the "Role-Based authorization strategy" plugin.

Jenkins Homepage ---> Manage Jenkins ---> Configure Global Security ---> Authorization ---> Role-Based Strategy
and Save it.

Now log in as a User, and you will get a pop-up message as "Access Denied".

Again log in as admin.
Now you have to attach permissions.
Jenkins Homepage ---> Manage Jenkins ---> Manage and Assign Role ---> Manage Roles

Likewise, you will able to give permission to your Users and give them access as per their working module.

----------------------------------------------------------------------------------------