Real-Time Corporate CI/CD DevOps Pipeline Project - Hands On

100% hands-on labs on deploying appl through DevOps CI/CD pipelines using Git, Jenkins, Trivy, Maven, Sonar, Docker, K8s
4.54 (41 reviews)
Udemy
platform
English
language
Other
category
Real-Time Corporate CI/CD DevOps Pipeline Project - Hands On
237
students
4 hours
content
Nov 2024
last update
$29.99
regular price

Why take this course?

Based on the outline provided, here's a step-by-step guide to creating a Jenkins pipeline job that encompasses all the tasks from configuring tools, running unit tests, performing vulnerability scans with Trivy, using SonarQube for code quality analysis, building and publishing artifacts to Nexus Repository, building and tagging Docker images, pushing them to DockerHub, deploying to a Kubernetes cluster, and setting up monitoring with Prometheus and Grafana.

Section 7: Create a Jenkins pipeline job to checkout the project

  1. Create a job on Jenkins:

    • Go to your Jenkins dashboard.
    • Click on 'New Item'.
    • Enter a name for your job, select 'Pipeline' as the job type, and click 'OK'.
  2. Configure credentials to access a private GitHub repository:

    • In Jenkins, go to 'Manage Jenkins' > 'System Configuration'.
    • Select 'Credentials'.
    • Click on 'Global Credentials', then choose the kind of credential you need (e.g., username with password), and add your GitHub access details.
  3. Pipeline to checkout the project:

    • In your new pipeline job, create a Jenkinsfile or use the pipeline configuration page.
    • Use the checkout scm step to get the source code from the repository using the credentials you created.

Section 8: Compile and run unit test cases on source code

  1. Compile the source code:

    • Add a sh step or use a step with the mvn compile command in your Jenkinsfile.
  2. Run unit test cases:

    • Use a sh step or step with mvn test to execute the unit tests.

Section 9: Trivy tool - Vulnerability Scan on Source Code

  1. Download and Install Trivy tool:

    • Add a step in your Jenkinsfile to download and install Trivy using the appropriate command, e.g., wget or curl.
  2. Vulnerability scan by Trivy using CICD pipeline:

    • Use Trivy to scan dependencies for vulnerabilities with a command like trivy image -f json --output results.json your-image-name.

Section 10: SonarQube - Code quality tool for better code

  1. Configure SonarQube server:

    • Install and configure SonarQube on a server.
    • Set up the SonarScanner tool in your project.
  2. Add a stage to the CI/CD pipeline for SonarQube analysis:

    • In your Jenkinsfile, add a sh step or step with the sonar-scanner command.
  3. Build the SonarQube job:

    • Run the job and wait for the analysis to complete.
  4. Wait for SonarQube analysis:

    • Once the scan is completed, you can view the results in the SonarQube dashboard.
  5. Add a stage WaitforQualityGate to the CI/CD pipeline:

    • In your Jenkinsfile, add a condition to wait for the quality gate to be triggered and passed by the SonarQube server.

Section 11: Build the package: Using maven tool

  1. Build the package:
    • Add a sh step or step with the mvn package command in your Jenkinsfile.

Section 12: Upload the artifact to the Nexus Repository

  1. Overview of Sonatype Nexus Repository:

    • Set up access to a Nexus Repository instance.
  2. Add a Global maven setting.xml from managed files:

    • In Jenkins, go to 'Manage Jenkins' > 'Infrastructure Management' and configure Nexus settings.
  3. Add a stage Publish the Artifact into Nexus Repository:

    • In your Jenkinsfile, add a sh step or step with mvn deploy to upload the artifact.
  4. Build the job-Publish the artifact:

    • Execute the job and confirm that the artifact is published to Nexus.

Section 13: Build and tag Docker images

  1. Building Docker images:

    • Add a sh step in your Jenkinsfile with the command to build the Docker image, e.g., docker build -t your-image-name ..
  2. Tagging Docker images:

    • Use another sh step to tag the image with the appropriate version, e.g., docker tag your-image-name your-dockerhub-username/your-image-name:version.

Section 14: Push Docker images to DockerHub

  1. Pushing Docker images to DockerHub:
    • Add a sh step in your Jenkinsfile with the command to push the image to DockerHub, e.g., docker push your-dockerhub-username/your-image-name:version.

Section 15: Deploy to Kubernetes cluster

  1. Deploying to a Kubernetes cluster:
    • Use kubectl commands in your Jenkinsfile to deploy the image to your Kubernetes cluster, e.g., kubectl set image deployment/your-deployment your-image-name=your-dockerhub-username/your-image-name:version.

Section 16: Setting up monitoring with Prometheus and Grafana

  1. Monitoring setup:

    • Ensure that Prometheus and Grafana are set up and accessible within your Kubernetes cluster.
  2. Configure jobs in Jenkins for monitoring:

    • Optionally, use Jenkins jobs to run Prometheus and Grafana, or integrate directly with the Kubernetes resources if possible.
  3. Last Lecture:

    • Review all steps and ensure that each part of your CI/CD pipeline is properly configured and tested. Make sure to document the setup and provide guidance for future maintenance and updates.

By following these steps, you'll have a comprehensive Jenkins pipeline that automates the entire process from code development to deployment and monitoring. Remember to test each stage individually to ensure everything works as expected before moving on to the next.

Loading charts...

6099043
udemy ID
29/07/2024
course created date
26/08/2024
course indexed date
Bot
course submited by