Lab Steps

lock
Logging in to the Amazon Web Services Console
lock
Connecting to the Virtual Machine using SSH
lock
Launch Jenkins and SonarQube Docker Containers
lock
Login to SonarQube and Generate Security Token
lock
Log in to Jenkins and Complete the Default Installation
lock
Install and Configure SonarQube and Gradle Plugins
lock
Create and Execute Jenkins Pipeline Gradle Job
lock
Review SonarQube Static Analysis Report
lock
Validate AWS Lab
live-help Need help? Contact our support team

Here you can find the instructions for this specific Lab Step.

If you are ready for a real environment experience please start the Lab. Keep in mind that you'll need to start from the first step.

Introduction

In this lab step, you will complete the provisioning of your Jenkins and SonarQube CICD environment. To do so, you will need to SSH into the cicd.platform.instance, and perform a git clone of the repository located on GitHub, at the following location https://github.com/cloudacademy/devops-jenkins-sonarqube

Next, you will use the docker-compose command to launch the Jenkins and SonarQube CICD docker containers. Two additional docker containers are launched to support the environment, Postgres and Socat. Postgres is the backend SQL database for SonarQube, and Socat provides a bi-directional TCP comms link for running "docker inside docker" - this is only required, for example, if the Jenkins docker container is configured to build docker containers itself, etc. With this completed, you will then use the docker client to query and inspect several environment values that are required for the remainder of this Lab. In particular, you will use it to query for the:

  • Jenkins Initial Admin Password

alt

Instructions

1. Use the git command to download the GitHub hosted DevOps Jenkins+SonarQube Integration repository:

content-copyCopy code
sudo yum install curl-devel
git clone https://github.com/cloudacademy/devops-jenkins-sonarqube.git
cd ./devops-jenkins-sonarqube

alt

2. Query the initial local docker environment:

content-copyCopy code
docker info

alt

3. Confirm that no docker containers currently exist:

content-copyCopy code
docker ps -a 

alt

4. Ensure that you are currently in the devops-jenkins-sonarqube directory, and list the contents:

content-copyCopy code
cd ~/devops-jenkins-sonarqube/
ls -l 

alt

5. Examine the docker compose configuration within the docker-compose.yml file:

content-copyCopy code
cat docker-compose.yml

alt

6. Launch the Jenkins and SonarQube docker environment. Running these commands will grab the latest Jenkins docker image, and then launch the docker environment with logging enabled. The docker compose container provisioning process typically takes 1-2 minutes to complete. Upon conclusion four (4) docker containers will be launched Jenkins, SonarQube, Postgres, and Socat:

content-copyCopy code
docker pull jenkins/jenkins:lts
docker-compose up -d && docker-compose logs -f

alt 

During the launching process, the Jenkins container will print out the initial admin password. This is required to complete the Jenkins installation process later on. You do not need to capture this as you will query for it in the following step after the full docker environment has been successfully provisioned:

alt

 

The full docker-compose container launching process completes with a message stating that SonarQube is up:

alt

7. Once the container provisioning process has completed successfully, exit the docker-compose log tailing process by using the Ctrl+C key sequence. Ignore the Error: Aborting message. This is just the result of exiting the docker-compose log tailing process: 

content-copyCopy code
alt

8. Confirm that all docker containers are up and running. There should be four (4) docker containers in total: Jenkins, SonarQube, Postgres, and Socat:

content-copyCopy code
docker ps -a

alt

9. Query for the Jenkins initial admin password. This will be required later to complete the Jenkins installation in the following Lab step. Make sure you copy-and-paste it somewhere, so you can later reference it:

content-copyCopy code
docker exec -it jenkins cat /var/jenkins_home/secrets/initialAdminPassword

alt  

Summary

In this Lab Step, you git cloned the devops-jenkins-sonarqube public GitHub repository. You then launched the Jenkins and SonarQube CICD docker environment. Finally, you queried for the Jenkins initial admin password, which you will use in a following Lab step to complete the Jenkins installation setup.