rESETTING JENKINS CREDENTIAL IF WE LOST ONE

Overview

In this tutorial, you will learn how to reset the admin user’s password in Jenkins.

Have you ever created a Jenkins instance for your local development needs and then forget the username you set? Don’t fret, we’ve all done this before. Thankfully, the password can be reset by doing a number of tasks from the command-line.

You will need elevated privileges to perform a Jenkins admin password reset. We will be modifying the security context of the Jenkins instance, and essentially turning authentication off temporarily.

Once we have disabled password authentication, we will log into the Jenkins web console and set a new password for our user.

Disable Jenkins Security

Log onto your Jenkins server using an account with root privileges. Once logged in, look open Jenkin’s configration XML file into a text editor.

In the example below, we are opening the file in VIM.

sudo vi /var/lib/jenkins/config.xml

With the configuration file opened, perform a search for the useSecurity string. This can be done in VIM by pressing ESC and then entering /useSecurity.

The line you are looking for should resemble the following.

<useSecurity>true</useSecurity>

Press i to enter VIM’s insert mode. Modify the value between the <useSecurity> tags and set the value to false.

<useSecurity>false</useSecurity>

Save your changes and then exit the text editor. If you are using VIM, press ESC and then enter wq! to write your changes and then exit the editor.

Your changes will not take affect until Jenkins is restarted. Restart the service now.

sudo systemctl restart jenkins

Reset Jenkins Admin’s Password

After Jenkins restarts navigate to the web console. Notice that you were not prompted for a username or password. This is because we disabled security in Jenkins’ configuration file.

If this is a publicly shared Jenkins instance, you should disable public access to the server until the password reset is complete.

To reset admin’s password, do the following.

  1. Click on People on the left-hand navigation menu.
  2. Click on the Admin.
  3. Delete the user account.
  4. Navigate to Jenkins / Manage Jenkins.
  5. Click on Configure Global Security
  6. Check the Enable Security check box
  7. Under Security Realm, select Jenkins’ own user database
  8. In the Authorization section, select Logged-in users can do anything.
  9. Unselect Allow anonymous read access.
  10. Click Save to save your changes.

Create New Jenkins Admin User

Once you have completed the tasks above, you will be redirect to a page where a new Admin user can be created. Fill in your new details and then click Create First Admin User.

You have no created a new Admin user with a new password.

Conclusion

Reseting the admin’s password is not a simple process. It also exposes us to dangers by disabling user logins, allowing anonymous users full control over the Jenkins server.

This tutorial showed you how to reset the admin password by removing the current account, and then recreating it. A better solution would be to have multiple admins, where possible, and have another admin reset the password.

INTEGRATING CLOUD JIRA AND GITHUB COMMITS

PROBLEM STATEMENT

Connecting cloud GITHUB and JIRA so that whenever there is a GITHUB commit it should get reflected over JIRA development dashboard.

Applicable to: – Jira and GITHUB cloud version

Plugin Required: – https://marketplace.atlassian.com/apps/1219592/github-for-jira?hosting=cloud&tab=overview

STEPS INVOLVED

INSTALLATION OF GITHUB FOR JIRA PLUGIN INSTALLATION

Click over the plugin link provided above under plugin required section then over the marketplace page click on option Get it now make sure we have choosen cloud version.

Choose your cloud site on which you want to install this plugin

Once configured properly it should shown under your manage app section of JIRA as added

INTEGRATION STEPS POST PLUGIN INSTALLATION

Post this addition your GITHUB cloud might ask some authentication to allow your JIRA cloud to access your GITHUB repository give the required permission post this we are done.

Now if we commit anything over GITHUB and provide the JIRA story/task id in GITHUB commit message box as shown below.

Next if we see now the JIRA dashboard under that particular story ID it should show the GIT commits done against that particular story/task.

BAMBOO ELASTIC CONFIGURATION FOR AWS AGENTS

We can use the elastic bamboo configuration of atlassian bamboo to get it connected to AWS EC2 instances as agent. Elastic bamboo uses remote agent (Amazon Machine Image) to create instances of remote agents within amazon ec2.

We can executed our builds on these elastic agents in similar way we we use to run it over our local agents and remote agents.

REQUIREMENTS

  • Having appropriate access over bamboo instance to modify and update the elastic configuration config
  • Access to AWS account with secret key and access key

CREATING ACCESS KEY UNDER AWS FOR CONNECTING VIA BAMBOO

Login to your AWS account go to my security credentials next click on create new access key

CONFIGURATION AT ATLASSIAN BAMBOO LEVEL

Next login to your bamboo account then go under overview and then to elastic configuration under ELASTIC BAMBOO option.

Next add all your AWS related authentication details under Elastic Bamboo configuration as given below.

We can change the various option available here as per need like we can keep the values on how many instances are required at maxium or we can setup Shutdown delay option (TIme before the instance shuts down automatically.)

We can setup maxium number of elastic agents and shutdown delay

Once the setting is done we can click on Save Changes. Post we can click on start a new instance or manage instances

Enter the values like number of instances required what kind of image is required to be build like ubuntu stock image or windows stock image

Once we click on Submit bamboo should create elastic agent for us same we can go and check and verify under our AWS console account.

CHECKING THE AGENT UNDER AWS CONSOLE