Tab 1
answer to write in anna university semester
CCS342 DevOps
**CCS342 DevOps - Anna University Semester Exam Notes**
*(Long Answer Format - 16 Marks Each, ~4 Pages Handwritten)*
**UNIT I: INTRODUCTION & CLOUD PLATFORMS**
## 1. Explain DevOps - Principles, Practices & Lifecycle (16 Marks)
**Definition**: DevOps is a software development methodology that integrates Development
(Dev) and IT Operations (Ops) teams through automation and collaboration to deliver
high-quality software continuously and reliably.
**Need for DevOps**:
- Traditional Waterfall: Sequential, slow (months), high failure rates
- Agile limitation: Dev-focused, Ops ignored
- DevOps solution: End-to-end responsibility, automation-first
**CALMS Framework (Core Principles)**:
```
C - Culture: Cross-functional teams, shared goals, blameless culture
A - Automation: CI/CD pipelines, IaC, testing automation
L - Lean: Value stream mapping, waste elimination
M - Measurement: DORA metrics (Deployment frequency, Lead time, MTTR, Change failure
rate)
S - Sharing: Knowledge sharing, documentation, post-mortems
```
**DevOps Lifecycle (8 Stages - Infinity Loop)**:
```
1. Plan → 2. Code → 3. Build → 4. Test → 5. Release → 6. Deploy → 7. Operate → 8. Monitor
→ (Repeat)
```
**Detailed Stages**:
- **Plan**: Agile backlog (Jira), sprint planning
- **Code**: Git branching (GitFlow: feature/main/release)
- **Build**: Maven/Gradle automation
- **Test**: Unit (JUnit), Integration, Security (SAST/DAST)
- **Release**: Artifact repository (Nexus/Sonatype)
- **Deploy**: Blue-green/Canary (Docker/Kubernetes)
- **Operate**: Auto-scaling, load balancing
- **Monitor**: Prometheus/Grafana, ELK stack
**Tools Stack**: Git, Jenkins, Maven/Gradle, Docker, Kubernetes, Ansible, Prometheus
**Benefits**:
```
• 208x faster deployments (DORA State of DevOps)
• 3x lower failure rate
• 24x faster recovery (MTTR)
```
**Diagram**: *(Draw infinity loop with 8 stages & tools)*
***
## 2. Compare AWS, GCP, Azure DevOps Services (16 Marks)
**Cloud Native DevOps Comparison**:
| **Feature** | **AWS** | **GCP** | **Azure** |
|-------------|---------|---------|-----------|
| **CI/CD Pipeline** | CodePipeline + CodeBuild | Cloud Build | Azure Pipelines |
| **Source Control** | CodeCommit | Cloud Source Repos | Azure Repos |
| **Artifact Storage** | CodeArtifact | Artifact Registry | Azure Artifacts |
| **IaC** | CloudFormation | Deployment Manager | ARM Templates |
| **Container Service** | ECS/EKS | GKE | AKS |
| **Monitoring** | CloudWatch + X-Ray | Operations Suite | Application Insights |
| **Pricing Model** | Pay-per-minute | Serverless-first | Freemium (5 users free) |
**AWS DevOps (Market Leader 32%)**:
```
CI/CD: CodePipeline orchestrates → CodeBuild (parallel builds) → CodeDeploy
(EC2/Lambda/EKS)
IaC: CloudFormation (JSON/YAML templates)
Example: Git push → CodePipeline → Maven build → Blue-green ECS deploy
Strength: Hybrid cloud (Outposts), mature ecosystem
```
**GCP DevOps (Kubernetes Leader)**:
```
CI/CD: Cloud Build (YAML triggers, 2s cache), Cloud Deploy (progressive rollouts)
IaC: Terraform + Deployment Manager
Example: Cloud Build → GKE deployment with traffic splitting
Strength: Serverless builds, native K8s integration
```
**Azure DevOps (Enterprise Choice)**:
```
All-in-one: Azure DevOps Server (Pipelines + Boards + Repos + Artifacts)
CI/CD: YAML Multi-stage pipelines
Example: Azure Pipeline → .NET build → AKS deployment
Strength: Visual Studio integration, compliance certifications
```
**Selection Criteria**:
```
AWS → Enterprises, Hybrid needs
GCP → Kubernetes, Data analytics
Azure → Microsoft stack, Agile teams
```
**Diagram**: *(Draw 3-column service comparison with pipeline flow)*
***
**UNIT II: BUILD TOOLS**
## 3. Explain Maven Architecture with POM Structure (16 Marks)
**Maven Overview**: Apache Maven is a declarative build automation tool for Java projects
using **[Link]** (Project Object Model).
**Core Concepts**:
```
1. Convention over Configuration: src/main/java, src/test/java
2. [Link]: Single source of truth
3. Lifecycle: validate → compile → test → package → install → deploy
4. Repositories: Local (~/.m2), Central (Maven Central), Remote (Nexus)
```
**[Link] Structure**:
```xml
<project xmlns="[Link]
<modelVersion>4.0.0</modelVersion>
<groupId>[Link]</groupId>
<artifactId>devops-app</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<[Link]>11</[Link]>
<[Link]>11</[Link]>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>[Link]</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</build>
</project>
```
**Maven Lifecycle Phases & Goals**:
```
mvn clean → Deletes target/
mvn compile → src/main/java → target/classes
mvn test → JUnit execution
mvn package → JAR/WAR creation
mvn install → Local repo installation
mvn deploy → Remote repository
```
**Multi-Module Project**:
```
[Link]
├── module1/[Link]
├── module2/[Link]
└── [Link]
```
**Advantages**: Standardized, vast plugin ecosystem, enterprise adoption
**Disadvantages**: XML verbosity, full rebuilds (no incremental)
**Commands**: `mvn clean compile package -DskipTests`
***
## 4. Explain Gradle Build Tool with DSL & Performance (16 Marks)
**Gradle Overview**: Next-generation build tool using **Groovy/Kotlin DSL**, daemon-based for
100x Maven performance.
**[Link] Example**:
```gradle
plugins {
id 'java-library'
id 'maven-publish'
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
repositories {
mavenCentral()
}
dependencies {
api '[Link]:spring-core:5.3.20'
implementation 'org.slf4j:slf4j-api:1.7.36'
testImplementation '[Link]:junit-jupiter:5.8.2'
}
[Link]('test') {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
}
```
**Gradle Key Features**:
```
1. Gradle Wrapper (gradlew): Version locking
2. Build Daemon: Parallel execution, caching
3. Task DAG: [Link](processResources)
4. Configurations: api/implementation/runtimeOnly
5. Build Cache: Cross-machine reuse
6. Composite Builds: Multi-repo coordination
```
**Performance Advantages**:
```
• Daemon: 90% faster startup
• Incremental compilation: Only changed files
• Build cache: Reuse across CI agents
• Parallel execution: Multiple projects simultaneously
```
**Commands**:
```
./gradlew tasks --all // List tasks
./gradlew build --info // Build with logging
./gradlew test --tests=*UserTest // Specific test
./gradlew publish --no-daemon // One-time build
```
**Multi-Project Structure**:
```
[Link]: include 'app', 'lib', 'common'
root/
├── app/[Link]
├── lib/[Link]
└── common/[Link]
```
**Gradle vs Maven**:
```
Maven: Convention, XML, Enterprise standard
Gradle: Performance, Flexibility, Android default
```
***
**UNIT III: CI/CD**
## 5. Explain Jenkins Architecture & Declarative Pipeline (16 Marks)
**Jenkins Overview**: Open-source CI/CD automation server (Java-based) with 1800+ plugins.
**Architecture**:
```
Controller (Master) ↔ Agents (Slaves)
↓
Pipeline Execution ↔ Plugin Ecosystem
```
**Jenkinsfile (Declarative Pipeline)**:
```groovy
pipeline {
agent any
environment {
APP_NAME = 'devops-app'
VERSION = '1.0.0'
}
stages {
stage('Checkout') {
steps {
git branch: 'main', url: '[Link]
}
}
stage('Build') {
steps {
sh 'mvn clean package -DskipTests'
}
}
stage('Test') {
steps {
sh 'mvn test'
publishTestResults testResultsPattern: 'target/surefire-reports/*.xml'
}
}
stage('SonarQube') {
steps {
sh 'mvn sonar:sonar'
}
}
stage('Deploy') {
when { branch 'main' }
steps {
sh './gradlew deploy -Penv=prod'
sh 'docker build -t app:${VERSION} .'
sh 'docker push registry/app:${VERSION}'
}
}
}
post {
always {
cleanWs()
}
success {
emailext to: 'team@[Link]', subject: "Build SUCCESS"
}
failure {
emailext to: 'team@[Link]', subject: "Build FAILED"
}
}
}
```
**Key Components**:
```
• Agents: Docker/Kubernetes dynamic agents
• Plugins: Git, Pipeline, Blue Ocean, Maven Integration
• Triggers: Git webhook, PollSCM (*/5 * * * *)
• Security: RBAC (Role Strategy), Credentials store
```
**Multibranch Pipeline**: Auto-discovers branches/PRs via Jenkinsfile.
**Best Practices**:
```
1. Pipeline as Code (Jenkinsfile in Git)
2. Idempotent stages (repeatable)
3. Secrets management (Credentials)
4. Parallel stages for speed
5. Input gates for approvals
``