DevOps Classroom Series – 04/Dec/2021

Fixing the Problem mvn not found

  • Lets try to set MAVEN_HOME path in the Global Tool Configuration
  • Go to Manage Jenkins => Global Tool Configuration Preview
  • Solution-1: Now configure your project to use Invoke top-level maven targets and select the maven version Preview
  • Solution-2: Add environmental variables related to path in /etc/environment and reboot the system if required. Then the invoke shell and mvn clean package works as shown in the class.
  • Solution-3: Add export statements in the invoke Shell
export M2_HOME=/usr/local/apache-maven-3.8.4
export PATH=$PATH:$M2_HOME/bin
mvn clean package
  • The solution 1 is adopted in Jenkins a lot as we can multiple versions of maven created as global tools.

Showing Test Results to the users

  • In the Post-Build Actions Select the following Preview Preview
  • Now manually trigger the build Preview Preview
  • We can configure the Plugin to pick xmls from any folder using regular expression **/TEST-*.xml Preview

Showing the Build artifacts to the user

  • In the Jenkins, we can ask jenkins to archive the build artifacts locally in the Jenkins server and that can be done by adding the following in post build steps Preview Preview
  • Now build the project and look into the project page Preview

Jenkins Plugins

  • Jenkins has extension architecture and it can be extend by adding plugins.
  • These plugins enhance jenkins functionality.
  • There are lot of plugins available and also if required you can create your own extensions by using JAVA language
  • Refer Here for the jenkins plugin index
  • Navigate to Manage Jenkins —-> Manage Plugins
  • Lets create a plugin which will add the functionality of
    • Subversion (version control) to the jenkins ui
    • Approach 1: Using available plugins Preview Preview
    • Approach 2: offline installation Refer Here
      • Jenkins plugins are majorly available with two extension
        • .jpi (jenkins plugin interface)
        • .hpi (hudson plugin interface)
      • Manage Jenkins => Plugins => Advanced and upload plugin Preview
  • Jenkins backup and restore:
    • Install the Periodic Backup plugin Preview
    • Once the plugin is installed navigate to Manage Jenkins => Uncategorized => Periodic Backup Manager Preview Preview Preview Preview Preview Preview Preview

User Administration

  • Configure Global Security Preview
  • Authentication Methods Preview
    • Delegate to servlet container:
      • This option can be used only when you are running your jenkins server from a servlet container such as Tomcat.
      • Enabling this option allows jenkins to authenticate user using servelt container realm (tomcat-users.xml)
    • Jenkins own user database:
      • This is default option, jenkins stores all the information inside xml files in JENKINS_HOME_DIRECTORY
    • LDAP:
      • This is one of the most widely used authentication methods in most organization Preview
      • In this settings we connect jenkins to the LDAP Server (Active Directory) of your organization
    • Unix user/group database:
      • The following options works if Jenkins master is installed on Unix/Linux Machine
      • When enabled, Jenkins delegates the authentication to the underlying OS.
      • So all the users/groups that are configured on the OS get access to jenkins
      • Ensure all user on the underlying OS have access to /etc/shadow file sudo chmod g+r /etc/shadow
  • Creating a new user in jenkins
    • Manage Jenkins => Manage Users => Create User Preview Preview Preview
    • Navigate to the people page Preview
  • Authorization Methods Preview
  • Anyone can do anything: This optionis not recommended as even anonymous users can do anython on jenkins server
  • Legacy Mode:
    • Jenkins behaves the way it used to behave before release 1.164
    • In simple terms, Jenkins will look for a user named Admin. The Admin user will be provide administrative privilege & rest of the users will be tread as anonymous users
    • This option is also not recommended
  • Logged-in user can do anything
  • Matrix-based security:
    • This is one of the most widely use Authorization methods in Jenkins Preview Preview
    • Lets login as developer Preview Preview
    • Lets login as tester and Remove the build option from matrix security. Tester will not have build options Preview
  • Project Based Matrix Authorization Strategy
    • Consider the situation wehre you have hundreds of jenkins jobs & Many users & you want to control user permissions at the job level (project level), In such case we use Project-Base Matrix Authorization Strategy Preview
    • Now configure the jenkins job and enable project based authorization Preview
    • Login as qttest, No jenkins job have been configured Preview
    • Now lets give view permission to qttest Preview
    • Similarly you can expand on permissions to specific users or groups

Note:

  • Jenkins build stability can be understand by sun & cloud notation Preview

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Floating Social Media Icons by Acurax Wordpress Designers

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube