Wednesday, July 22, 2020

Install AWS CLI 2 on Red Hat Linux | Install AWS CLI 2 on Ubuntu 18.0.4

Follow these steps from the command line to install the AWS CLI on Linux.

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

aws --version
The above command should display the version like below:
aws-cli/2.0.33 Python/3.7.3 Linux/5.3.0-1030-aws botocore/2.0.0dev37

Wednesday, July 8, 2020

How to clean workspace after Jenkins Build - Clean up workspace after every build

You can clean workspace using Workspace cleanup plugin in Jenkins after builds executions.

Install workspace clean up Plug-in

Free Style Job Workspace - cleanup

Go to your existing freestyle job, click on Post-Build actions --> Select Delete workspace when build is done option.

Now run the job. You should be able to see workspace is cleaned up after build is done inside Jenkins node. You will not see any folder with job name, in Ubuntu usually under /var/lib/jenkins/workspace/

Pipeline Job Workspace - cleanup code

Go to your existing pipeline job, you can code something like this below:
pipeline {
    agent any
     tools {
        maven 'Maven3'
    }
    stages {
        stage ("checkout")  {
            steps {
            checkout logic here
            }
        }
    stage ('build')  {
        steps {
            sh "mvn clean install -f MyWebApp/pom.xml"
        }
     }
    }

/*** workspace clean up*/
    post {
        always {
            cleanWs()
        }
    }   

 }

Watch this on YouTube video:

DevOps Interview Preparation Useful real time tips | Crack DevOps Interviews | How to clear DevOps Interviews

Are you failing in DevOps Interviews? Are you not be able to next round in the Interview process?  Let's find out how to fix this:   Fir...