Monday, December 31, 2018

Can not run elasticsearch as root sonarqube Error - SonarQube Elasticsearch do not run as root

When you tried to configure SonarQube, you may experience the below error:

2018.10.15 17:32:13 ERROR es[][o.e.b.Bootstrap] Exception
java.lang.RuntimeException: can not run elasticsearch as root
        at org.elasticsearch.bootstrap.Bootstrap.setup( 


SonarQube does not support being run as root user, so we need to create regular user like sonar and give privilege to that use.

Fix for the above issue:
create a user called sonar by executing below command:
sudo useradd sonar

sudo chown -R sonar:sonar sonar-install-folder/

Edit the start script and change the #RUN_AS_USER to be RUN_AS_USER=sonar

sudo vi /opt/sonarqube/bin/linux-x86-64/

now start the server 
sudo sh /opt/sonarqube/bin/linux-x86-64/ start

This should fix that issue.

Thursday, December 27, 2018

Jenkins Scripted Pipeline - Create Jenkins Pipeline for Automating Builds, Code quality checks, Deployments to Tomcat - How to build, deploy WARs using Jenkins Pipeline - Build pipelines integrate with Bitbucket, Sonarqube, Slack, JaCoCo, Nexus, Tomcat

What are Pipelines in Jenkins?

- Pipelines are better than freestyle jobs, you can write a lot of complex tasks using pipelines when compared to Freestyle jobs.
- You can see how long each stage takes time to execute so you have more control compared to freestyle.
- Pipeline is groovy based script that have set of plug-ins integrated for automating the builds, deployment and test execution.
- Pipeline defines your entire build process, which typically includes stages for building an application, testing it and then delivering it. 
 - You can use snippet generator to generate pipeline code for the stages you don't know how to write groovy code.
- Pipelines are two types - Scripted pipeline and Declarative pipeline. Click here to know the difference between them.

Install plug-ins
1. Install Deploy to container, Slack, Jacoco, Nexus Artifact Uploader and SonarQube plug-ins (if already installed, you can skip it)

Steps to Create Scripted Pipeline in Jenkins

1. Login to Jenkins

2. Create a New item

3. Give name as MyfirstPipelineJob and choose pipeline

4. Click ok. Pipeline is created now

5. Under build triggers, click on poll SCM, schedule as

H/02 * * * *

6. Go to Pipeline definition section, click on Pipeline syntax link. under sample step drop down, choose checkout: Checkout from version control. enter bitbucket or GitHub Repository URL, and enter right credentials. Click here to learn to use PAT if you are using GitHub. scroll down, click on Generate Pipeline script. Copy the code.

7. Now copy the below pipeline code highlighted section into Pipeline section in the pipeline. Please copy stage by stage

8. Change Maven3, SonarQube variables and also Slack channel name as highlighted above in red as per your settings.

9. For Nexus Upload stage, You need to change the Nexus URL and credentials ID for Nexus (which you can grab from Credentials tab after login)

10. For Dev Deploy stage, you can copy credentials ID used for connecting to Tomcat.

Pipeline Code:

node {

    def mvnHome = tool 'Maven3'
    stage ("checkout")  {
       copy code here which you generated from step #6

   stage ('build')  {
    sh "${mvnHome}/bin/mvn clean install -f MyWebApp/pom.xml"

     stage ('Code Quality scan')  {
       withSonarQubeEnv('SonarQube') {
       sh "${mvnHome}/bin/mvn -f MyWebApp/pom.xml sonar:sonar"
   stage ('Code coverage')  {

   stage ('Nexus upload')  {
        nexusVersion: 'nexus3',
        protocol: 'http',
        nexusUrl: 'nexus_url:8081',
        groupId: 'myGroupId',
        version: '1.0-SNAPSHOT',
        repository: 'maven-snapshots',
        credentialsId: '2c293828-9509-49b4-a6e7-77f3ceae7b39',
        artifacts: [
            [artifactId: 'MyWebApp',
             classifier: '',
             file: 'MyWebApp/target/MyWebApp.war',
             type: 'war']
   stage ('DEV Deploy')  {
      echo "deploying to DEV Env "
      deploy adapters: [tomcat9(credentialsId: '4c55fae1-a02d-4b82-ba34-d262176eeb46', path: '', url: 'http://your_tomcat_url:8080')], contextPath: null, war: '**/*.war'


  stage ('Slack notification')  {
    slackSend(channel:'channel-name', message: "Job is successful, here is the info -  Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")

   stage ('DEV Approve')  {
            echo "Taking approval from DEV Manager for QA Deployment"     
            timeout(time: 7, unit: 'DAYS') {
            input message: 'Do you approve QA Deployment?', submitter: 'admin'

stage ('QA Deploy')  {
     echo "deploying into QA Env " 
deploy adapters: [tomcat9(credentialsId: '4c55fae1-a02d-4b82-ba34-d262176eeb46', path: '', url: 'http://your_tomcat_url:8080')], contextPath: null, war: '**/*.war'


  stage ('QA notify')  {
    slackSend(channel:'channel-name', message: "QA Deployment was successful, here is the info -  Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")

stage ('QA Approve')  {
    echo "Taking approval from QA manager"
    timeout(time: 7, unit: 'DAYS') {
        input message: 'Do you want to proceed to PROD Deploy?', submitter: 'admin,manager_userid'

stage ('PROD Deploy')  {
     echo "deploying into PROD Env " 
deploy adapters: [tomcat9(credentialsId: '4c55fae1-a02d-4b82-ba34-d262176eeb46', path: '', url: 'http://your_tomcat_url:8080')], contextPath: null, war: '**/*.war'


11. Click Apply, Save
12. Now click on Build. It should execute all the stages and show pipeline view like this.

You can watch the Scripted pipeline video in my YouTube channel:

Wednesday, December 26, 2018

Pipeline code for uploading build artifacts to Nexus from Jenkins - How to upload build artifacts to Nexus from Jenkins

Here below is the pipeline code for uploading build artifacts to Nexus from Jenkins:

1) Install Nexus Artifact Uploader plug-in.

2) You also need to add Nexus credentials and use the credentials ID from Jenkins

Screen Shot 2018-12-12 at 6.53.40 PM.png

stage ('Nexus Artifact upload')
        nexusVersion: 'nexus3',
        protocol: 'http',
        nexusUrl: '',
        groupId: 'myGroupId',
        version: '1.0-SNAPSHOT',
        repository: 'maven-snapshots',
        credentialsId: '2c293828-9509-49b4-a6e7-77f3ceae7b39',
        artifacts: [
            [artifactId: 'MyWebApp',
             classifier: '',
             file: 'MyWebApp/target/MyWebApp.war',
             type: 'war']

Sunday, December 16, 2018

How to create S3 bucket in AWS using Terraform - Create S3 bucket in AWS using Terraform

Terraform is an infrastructure orchestration tool for creating web services in AWS automatically. You can use Terraform for provisioning S3 bucket in AWS.

sudo vi

resource "aws_s3_bucket" "mybucket" {
  bucket = "my-tf-test-bucket"
  acl    = "public-read"
  website {
    index_document = "hello.html"
   routing_rules = <<EOF
    "Condition": {
        "KeyPrefixEquals": "docs/"
    "Redirect": {
        "ReplaceKeyPrefixWith": "documents/"

  tags= {
    Name        = "My bucket"
    Environment = "Dev"

Once you create the above file, execute terraform plan and then terraform apply to create S3 bucket in AWS.

Saturday, December 15, 2018

Ansible Playbook for provisioning a new EC2 instance in AWS - Create a new EC2 Using Ansible Playbook

Please find the Ansible Playbook for provisioning a new EC2 instance. Please follow the below steps in the machine where you installed Ansible.

Steps to create EC2 instance using Ansible:

1. Login to AWS console, click on username and go to My security credentials.
2. Continue on security credentials, click on access keys
3. Create a new access key if you dont have one. Make sure you download the keys.
4. Login to EC2 instance using Git bash or ITerm where you installed Ansible.

execute the below command

sudo vi ~/.boto

add below three lines in the above file, replace the ?? with access key and secret key values.
aws_access_key_id = ??
aws_secret_access_key = ??

5. Edit Ansible hosts or inventory file
sudo vi /etc/ansible/hosts 
Add the below two lines in the end of the file:

6. cd ~
7. mkdir playbooks  
8. cd playbooks

Create Ansible playbook
9. sudo vi create_jenkins_ec2.yml 
(copy the below content in green color)
edit the create_jenkins_ec2.yml to make sure you update the key which is red marked below:
 - name:  provisioning EC2 Lab Exercises using Ansible
   hosts: localhost
   connection: local
   gather_facts: False
   tags: provisioning

     keypair: MyEC2Key
     instance_type: t2.small
     image: ami-07c1207a9d40bc3bd
     wait: yes
     group: webserver
     count: 1
     region: us-east-2
     security_group: my-jenkins-security-grp

     - name: Create my security group
         module: ec2_group
         name: "{{ security_group }}"
         description: Security Group for webserver Servers
         region: "{{ region }}"
            - proto: tcp
              from_port: 22
              to_port: 22
            - proto: tcp
              from_port: 8080
              to_port: 8080
            - proto: tcp
              from_port: 80
              to_port: 80
            - proto: all
       register: basic_firewall
     - name: Launch the new EC2 Instance
       local_action:  ec2 
                      group={{ security_group }} 
                      instance_type={{ instance_type}} 
                      image={{ image }} 
                      region={{ region }} 
                      keypair={{ keypair }}
       register: ec2
     - name: Add Tagging to EC2 instance
       local_action: ec2_tag resource={{ }} region={{ region }} state=present
       with_items: "{{ ec2.instances }}"
           Name: MyTargetEc2Instance

10. now execute the ansible playbook by
sudo ansible-playbook create_jenkins_ec2.yml

Fix the warnings by executing below command
pip install --upgrade requests==2.20.1

If everything is good, you should see the new instance created on AWS console. make sure you are able to connect to that instance.

That's it!! That is how you create a new EC2 instance using Ansible.

Wednesday, November 7, 2018

How to push a code change into Bitbucket remote repository? - Code push into Bitbucket using Git bash

Let us see how to push a code change using Git bash or iTerm on your local machine into bitbucket.

After configuring a freestyle job or pipeline using Jenkins for building and deployment, you would like to make a code change to make sure Jenkins have started automated builds/deployments.

SSH keys set up and uploaded into Bitbucket.

Implementation steps:
1. Go to bitbucket, select repository which you already have setup MyWebApp.
If you already cloned, move to step # 6.
2. Click on clone
3. copy SSH clone url
4. go to git bash window
5. paste the url and enter
git clone
6. cd repo_name

change repo_name per your name of the repo you created in Bitbucket
7. cd MyWebApp/src/main/webapp
8. sudo vi index.jsp

Change Hello world into below yellow highlighted:
<h2>Howdy Folks !!! Welcome to DevOps!</h2>

9. press escape, enter :wq!
10. git add index.jsp
11. git commit -m "made change to jsp"
12. git push

Now refresh the browser and click on Source to see code changes you made in your git bash window.

Sunday, October 21, 2018

Create SonarQube instance using Terraform - Setup SonarQube instance using Terraform

Execute the below command after login to EC2 where you installed Terraform:

navigate to project-terraform folder where you have created already tf files.

cd ~/project-terraform

if you are using Apple laptop or EC2 instance, execute below command:

sudo vi 

for Windows laptop use below command:


Copy the below content with green background:

Change the key name marked red below per your key name:

resource "aws_vpc" "sonar" {
  cidr_block = ""
  instance_tenancy = "default"
  tags = {
    Name = "sonar_vpc"

 resource "aws_security_group" "security_sonar_group_2022" {
      name        = "security_sonar_group_2022"
      description = "security group for Sonar"
      ingress {
        from_port   = 9000
        to_port     = 9000
        protocol    = "tcp"
        cidr_blocks = [""]

     ingress {
        from_port   = 22
        to_port     = 22
        protocol    = "tcp"
        cidr_blocks = [""]

     # outbound from Sonar server
      egress {
        from_port   = 0
        to_port     = 65535
        protocol    = "tcp"
        cidr_blocks = [""]

      tags= {
        Name = "security_sonar"

    resource "aws_instance" "mySonarInstance" {
      ami           = "
      key_name = "your_aws_ssh_key"
      instance_type = "t2.micro"
vpc_security_group_ids = []

      tags= {
        Name = "sonar_instance"

# Create Elastic IP address for Sonar instance
resource "aws_eip" "mySonarInstance" {
  vpc      = true
  instance =
tags= {
    Name = "sonar_elastic_ip"

Execute below command:
    terraform plan
and then
    terraform apply

Now you will see a new EC2 instance being created in AWS console.

Monday, September 24, 2018

How to enable code coverage report using JaCoCo plug-in - Code coverage Report using JaCoCo, Maven and Jenkins - Code Coverage in Pipeline

Code coverage is important aspect for maintaining quality in Agile development. There are different ways to manage code quality. one of the effective ways is to measure code coverage by using plug-ins such as JaCoCo, Cobertura.

We will see how to enable code coverage for your Java project and view coverage report in Jenkins UI.

step # 1: Add Maven JaCoCo plugin in POM.xml under MyWebApp in bitbucket Repo


Step 2 : Add JaCoCo plug-in in Jenkins:

Step 3:

For Freestyle Job:
Enable in Jenkins job to view code coverage report by going to post build action and add Record JaCoCo coverage report

For Pipelines:
Add below code in your existing pipeline:

stage ('Code coverage') {

Step 4 : Run the job by clicking Build now

Step 5:
 Click on the job to view code coverage report.

Friday, September 21, 2018

How to enable Multi Factor Authentication (MFA) for your AWS account? - Enable MFA to AWS account - Secure AWS Account

It is very important to secure your AWS account. Especially for those who is creating new AWS account, as hackers are potentially targeting new accounts.

Let us see the how to secure AWS accounts by enabling multi factor authentication?

1. Login to AWS.
2. Click on your user name. Click on My Security Credentials.

3. Continue to security credentials.

4. Click on Multi-factor authentication, click on Activate MFA

5. Now choose A Virtual MFA device

6.  Click on Next step

7. Now download google authenticator or Microsoft authenticator on your smart phone
8. After downloaded, click on + scan bar code. Scan the above bar code.
you need to enter first number and wait until it expires, enter second number in code 2 and then click on Activate Virtual MFA.

9. Once entered both numbers, click on Activate Virtual MFA.

This is how you secure AWS account by enabling MFA.

Wednesday, September 12, 2018

How to integrate SonarQube in Azure DevOps - Setup SonarQube code analysis in VSTS or Azure DevOps

Please find steps below for integrating SonarQube with Azure DevOps or VSTS

1. Make sure you install SonarQube plug-in/Add-on in VSTS (Azure DevOps) using below URL:

Once added plug-in, click on proceed to Organization..

1. Login to Azure DevOps. Go to Azure Pipelines. Edit your pipeline

2. Click on Add tasks
3. Enter Sonar

4. Add Prepare Analysis configuration
5. move up this task.
It should be like shown below:

6. Edit prepare sonar analysis configuration task

7. Click on New service connection

 8. Enter name as mySonarServer and put in SonarQube url including port number and use the token generated

9. Choose that name and select Integrate with Maven or Gradle

10. Edit maven task and add clean install sonar:sonar

11. Run the build, it should integrate with Sonar and should do code analysis.

Saturday, September 1, 2018

How to create Jenkinsfile and configure Pipeline as Code - Jenkins Pipeline As code

Please find steps below for configuring your existing pipeline as a code (Jenkinsfile).


1. Project setup in Bitbucket or GitHub
2. Jenkins and Tomcat (web container) set up.
3. Maven installed as well
4. Sonarqube setup and integrated with Jenkins

Add Jenkinsfile (pipeline code) to MyWebApp in BitBucket.

Step 1.

Go to Bitbucket and choose the Repo where you setup MyWebApp.

Step 2

Click on three dots ... and Add File

Step 3
Enter Jenkinsfile as a file name

Step 4

Copy and paste the below code

node {
def mvnHome = tool 'Maven3'

stage ('Checkout') {

checkout scm

stage ('Build') {
sh "${mvnHome}/bin/mvn clean install -f MyWebApp/pom.xml"

stage ('Code quality scan') {
withSonarQubeEnv('SonarQube') {
sh "${mvnHome}/bin/mvn sonar:sonar -f MyWebApp/pom.xml"

    stage ('Nexus upload')
        nexusVersion: 'nexus3',
        protocol: 'http',
        nexusUrl: '',
        groupId: 'myGroupId',
        version: '1.0-SNAPSHOT',
        repository: 'maven-snapshots',
        credentialsId: '2c293828-9509-49b4-a6e7-77f3ceae7b39',
        artifacts: [
            [artifactId: 'MyWebApp',
             classifier: '',
             file: 'MyWebApp/target/MyWebApp.war',
             type: 'war']

stage ('DEV Deploy') {
echo "deploying to DEV tomcat "
sh 'sudo cp /var/lib/jenkins/workspace/$JOB_NAME/MyWebApp/target/MyWebApp.war /var/lib/tomcat8/webapps'
stage ('DEV Approve') {
echo "Taking approval from DEV"
timeout(time: 7, unit: 'DAYS') {
input message: 'Do you want to deploy?', submitter: 'admin'


stage ('Slack notification') {
slackSend(channel:'channel-name', message: "Job is successful, here is the info - Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")

Step 5
Click on Commit and enter comments

Click on Commit

That's it. Pipeline as a code - Jenkinsfile is setup in BitBucket.

Create Pipeline and Run pipeline from Jenkinsfile

1. Login to Jenkins
2. Click on New item, give some name and choose Pipeline and say OK

3. Under build triggers, choose Poll SCM,
Enter H/02 * * * *

4. Under Pipeline section. click on choose pipeline script from SCM

5. Under SCM, choose Git

6. Enter SSH or HTTPS URL of repo and choose credentials - SSH private key if you are using SSH url. or user/password of GitHub if you are using HTTPS url.

Script path as Jenkinsfile

7. Click on Apply and Save
8. Click on Build now.
You should see pipeline running and application is deployed to Tomcat.

Monday, August 13, 2018

DevOps FAQs page - DevOps Wiki Page - DevOps Troubleshooting Page

Welcome to DevOps FAQs page. The objective of this page is to help you provides fixes for the issues you are facing during building pipelines.

Issue # 1 - Not able to connect to EC2 instance from my local machine and have No such file or directory error.
Root cause and fix:
1. Make sure you have downloaded the above keys under downloads directory.
2. Once you verified, you need to ssh from downloads directory on your local machine. make sure you type below command:

cd downloads (press enter)
and then copy ssh url copied from AWS console (and press enter)

Issue # 2 -  Unable to connect to Bitbucket in Jenkins

Root cause and fix:

There are two issues in the above picture.
1. you need to select add button and add your Bitbucket credentials and select it from drop down after adding it.
2. Do not add Jenkins credentials, it should be Bitbucket credentials.

Issues # 3 - There is no pom in this directory

Root cause and fix

Path of pom.xml was not specified in the build job. you need to click on advanced and add the path of pom.xml. in our case it will be MyWebApp/pom.xml

Issue - 4 Tomcat Deployment failed or not able to access WebApp after deployment

root cause and fix: 

Tomcat deployment steps are not configured correctly in Jenkins job. Click on post build action, add deploy to container step and enter tomcat url and credentials per below screenshot:

Also make sure, tomcat credentials are entered correctly per below screenshot in tomcat-users.xml
Execute the below command
sudo vi /var/lib/tomcat9/conf/tomcat-users.xml 

make sure your file looks like below file:

make sure you restart tomcat as well:
sudo systemctl restart tomcat9

Issue # 5 - SonarQube server can not be reached Error

Root cause and Fix:
When ever you stop EC2 instance and re-start, public DNS name always changes. So you will have to change it every time you restart.
You need to re-enter new sonarqube server URL under Jenkins --> Manage jenkins --> Configure system. scroll down and under sonarQube configuration 

enter SonarQube URL. no need to create token again. old token is enough.

Issue # 6  - Not able to publish into GitHub or Bitbucket using git push

root cause and fix:

This could be due to SSH keys are not set up correctly from the machine you are trying to push the code.

Issue # 7 - Unable to push into Bitbucket or GitHub, getting rejected error

root cause and fix:

When ever you do git push, if changes are not pushed and getting above messages such as rejected. 
You need to perform git pull first by syncing your local repository with remote repo changes.

Issue # 8 - Unable to create EC2 instance

root cause and fix:

Re-name the security group to something else, or use the same group instead of creating another one.

Issue # 9 - Not authorized. Please check the properties sonar.login and sonar.password

root cause and fix:

You need to login in SonarQube as an administrator and create token. Copy the token in Jenkins --> Manage Jenkins--> sonarqube section.

Issue # 10 - Puppet Login credentials error.

root cause and fix:
Make sure you have your access keys and secret keys in the below file and also no space before [default]

sudo vi ~/.aws/credentials

aws_access_key_id = ?

aws_secret_access_key = ?

Issue # 11 - Unable to upload WAR file into Nexus,  WAR file is not uploading into Nexus

Root cause and fix:
You need to choose as Nexus 3 from drop down instead of Nexus2

Issue # 12 - Unable to access Jenkins or Tomcat from the browser

Root cause and Fix:

You need to enter public dns name from step # 4 in below screen. 
Go to AWS console, select EC2 instance, click to connect and copy public dns name value from step #4.

Issue # 13 - Tomcat Deployment failed in Jenkins - Invalid username and password

Root cause and Fix:
It could be due to invalid tomcat user name and password. You need enter right username and password and also select it from drop down.

Also make sure, tomcat credentials are entered correctly per below screenshot in tomcat-users.xml
Execute the below command 

sudo vi /var/lib/tomcat9/conf/tomcat-users.xml 
Make sure you have the below entries properly per screenshot:
<role rolename="manager-script"/>

<user username="tomcat" password="password" roles="manager-script"/>

Make sure you restart tomcat  once you make the above changes:
sudo systemctl restart tomcat9

Issue # 14 - Unable to upload WAR file into Nexus,  Not Authorized error

Root cause and Fix:
Make sure you are using right credentials for Nexus which is admin/admin123, and also you need to select from drop down

Issue # 15 - Invalid Credentials ID when applying TerraForm

Root cause and Fix:
Make sure your AWS access keys and secret keys are correct in your file.

Issue # 16 - SonarQube does not match any configured installation

Root cause and fix:

Go to Jenkins ->Manage Jenkins- > Configure system, sonarqube server installation, make sure the variable name correct. It should match with below name:

stage ('Code quality scan') {

withSonarQubeEnv('SonarQube') {

sh "${mvnHome}/bin/mvn sonar:sonar -f MyWebApp/pom.xml"


Issue # 17 - SonarQube is stopped Error 

Root cause:

Your may not be setup correctly. It could be due to three different reasons:

1. verify below sonar.proeprties
sudo vi /opt/sonarqube/conf/
uncomment the below lines by removing # and add values highlighted yellow

Next, Add the below line

2. Switch to sql shell by entering

Execute the below lines (one by one)

ALTER USER sonar WITH ENCRYPTED password 'password';

CREATE DATABASE sonarqube OWNER sonar; 

type exit tom come out of postgresSQL.

3. Make sure you have setup sonarqube as a service properly.

Execute the below command:
sudo vi /etc/systemd/system/sonar.service

# copy the below green highlighted commands in the above file
Description=SonarQube service


ExecStart=/opt/sonarqube/bin/linux-x86-64/ start
nux-x86-64/ stop

Issue # 18 - Unable to do git clone - make sure you have correct access rights error

root cause and fix

When ever you have this error, it means you have not uploaded your SSH keys correctly into bitbucket or github. Make sure you generate ssh keys by executing the below command:
(enter four times)
Copy the ssh-keys like below and upload into Bitbucket or GitHub.
cat ~/.ssh/

Issue # 19 - Non-Readable POM - No such file or directory
When you try to build in Jenkins, you may get this issue.

Root cause and fix
Java project may not be setup in BitBucket properly. You will have to setup MyWebApp in Bitbucket on the repo you are using in Bitbucket.

Re-visit lab # 2 on how to set up java project or use the repo that has already MyWebApp setup correctly. 

Issue # 20 - sudo: no tty present and no askpass program specified Error

Root cause and fix:
You need to give permission for Jenkins to do deployment.
Login to instance where you installed Jenkins, type the below command

sudo visudo

look for root and add the changes highlighted in yellow at the below line of root:

# User privilege specification
After making the changes, Ctrl O, press enter to save. Ctrl X to exit the file.

Now with the above changes, you are able to execute the build jobs which require sudo permissions.

Issue # 21 -  Unable to connect to GitHub in Jenkins

Root cause and fix:

There are two issues in the above picture.
1. you need to select add button and add your GitHub credentials and select it from drop down after adding it.
2. Do not add Jenkins credentials, it should be GitHub credentials.

Issue # 22 -  Maven Path issue 

Root cause and fix:
1.Remove space before or after /usr/share/maven

Issue # 23 -  Puppet Error: Could not run: Could not find type ec2_instance

Root cause and fix:
You need to install puppet-labs-aws module
sudo /opt/puppetlabs/bin/puppet module install puppetlabs-aws
Issue # 24 -  SonarQube Quality gate issue Error

hudson.remoting.ProxyException: net.sf.json.JSONException: Invalid JSON Stringat org.sonarsource.scanner.jenkins.pipeline.WaitForQualityGateStep$Execution.checkTaskCompleted(

Root cause and fix:
Make sure you fix SonarQube url by removing / in the end under Manage Jenkins->configure system 
you need to remove / in the end of URL. there should not be any / after 9000, it should be something like below:

right url - http://sonarqube_url:9000
Wrong url - http://sonarqube_url:9000/

Issue # 25 -  Error can not perform an interactive login from a non TTY device

Root cause and fix:
remove existing access + secret keys if you have attached in EC2 instance by performing below command:
sudo rm ~/.aws/config
sudo rm ~/.aws/credentials

Then you need to create an IAM role with AmazonEC2ContainerRegistryFullAccess policy and attached the IAM role to Ec2 instance.

Issue # 26 -  No valid Credentials for Terraform AWS provided found

Root cause and fix:
make sure you have AWS credentials setup using aws configure or add Create IAM role with right policy and attach that IAM role to ec2 instance.

Issue # 27 - stderr: remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead 

Root cause and fix:
How to Fix for the above error by creating Personal Access Token:GitHub removed password authentication support from August 13, 2021 instead it recommends to use either OAuth or Personal Access Token.
Click here to learn how to create Personal Access Token.

Issue # 28 - Certificate verification failed: The certificate is NOT trusted | Jenkins installation Error Fix
If you try to install Jenkins on Ubuntu 18.0.4/20.0.4 instance, you may experience this problem.

Running sudo apt-get update on my AWS EC2 Ubuntu 18.04.01 LTS instance fails because Certificate verification failed: The certificate is NOT trusted.

Err:6 binary/ Release

Certificate verification failed: The certificate is NOT trusted. The certificate chain uses expired certificate.  Could not handshake: Error in the certificate verification. [IP: 443]

Fix for the above error

You need to install certificates to overcome this error:

sudo apt install ca-certificates

sudo apt-get update

Now try installing Jenkins

sudo apt install jenkins -y

Issue # 29 - Error from server (BadRequest): container "mypythondockerrepo" in pod "my-python-deployment-745b64d6c6-dgwn5" is waiting to start: image can't be pulled

Root cause and fix:

For Deploying Docker images from ACR into AKS Cluster

The following command allows you to authorize an existing ACR in your subscription and configures the appropriate ACRPull role for the managed identity.

az aks update -n myAKSCluster -g myResourceGroup --attach-acr myacrrepo31

Issue # 30 - Errors running EKS Cluster 

Root cause and fix:
remove existing access + secret keys if you have attached in EC2 instance by performing below command:
sudo rm ~/.aws/config
sudo rm ~/.aws/credentials

and then setup access keys

Issue # 31 - Errors acquiring the state lock 

Root cause and fix:

Make sure you add AmazonDynamoDBFullAccess policy to the role and attach EC2 instance.

Issue # 32 - Error configuring Terraform AWS Provider: no valid credential sources for Terraform AWS Provider found

Root cause and fix:
your EC2 instance does not have enough privilege to perform terraform apply. Make sure you add IAM role to EC2 instance or setup access keys + secret keys 

Issue # 33 -  no hosted parallelism has been purchased or granted in Azure Devops

Root cause and fix:
Microsoft has temporarily disabled the free grant of parallel jobs for public projects and for certain private projects in new organizations. However, you can request this grant by submitting a request. Submit a ticket using below url to request increased parallelism in Azure DevOps.