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
  • Solution-1: Now configure your project to use Invoke top-level maven targets and select the maven version
  • 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
  • Now manually trigger the build
  • We can configure the Plugin to pick xmls from any folder using regular expression **/TEST-*.xml

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
  • Now build the project and look into the project page

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
    • 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
  • Jenkins backup and restore:
    • Install the Periodic Backup plugin
    • Once the plugin is installed navigate to Manage Jenkins => Uncategorized => Periodic Backup Manager

User Administration

  • Configure Global Security
  • Authentication Methods
    • 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
      • 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
    • Navigate to the people page
  • Authorization Methods
  • 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
    • Lets login as developer
    • Lets login as tester and Remove the build option from matrix security. Tester will not have build options
  • 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
    • Now configure the jenkins job and enable project based authorization
    • Login as qttest, No jenkins job have been configured
    • Now lets give view permission to qttest
    • Similarly you can expand on permissions to specific users or groups

Note:

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

Leave a ReplyCancel reply

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

Please turn AdBlock off
Social Network Integration by Acurax Social Media Branding Company

Discover more from Direct DevOps from Quality Thought

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

Continue reading

Exit mobile version
%%footer%%