0% found this document useful (0 votes)
23 views16 pages

Devops External

Uploaded by

sanjayyalla4661
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views16 pages

Devops External

Uploaded by

sanjayyalla4661
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

1.

Explain the stages in software development lifecycle, the process models, values
and principles of agility and the need for agile software development.

A software development lifecycle (SDLC) consists of distinct stages, from planning and
requirements gathering to design, development, testing, deployment, and maintenance, with
various process models like Waterfall, Agile, Spiral, and Incremental that define how these
stages are executed. Agile software development emphasizes iterative development, frequent
feedback loops, and adaptability to changing requirements, making it ideal for projects where
flexibility is crucial, with core values like "individuals and interactions over processes and
tools" and "responding to change over following a plan.".
Key Stages in Software Development Lifecycle:
 Planning and Requirements Gathering: Defining project scope, goals, and detailed
user requirements.
 Design: Creating a system architecture and detailed design specifications
 Development: Implementing the software based on the design
 Testing: Verifying software functionality against requirements and identifying bugs
 Deployment: Releasing the software to production environment
 Maintenance: Addressing issues and updates post-release
Process Models in Software Development:
1. Waterfall Model:
 Linear approach where each phase is completed before moving to the next, with
strict documentation and less flexibility
2. Agile Model:
 Iterative approach with short development cycles (sprints), continuous feedback,
and adaptability to changing requirements
3. Spiral Model:
 Risk-focused approach with iterative prototyping and regular evaluation cycles
4. Incremental Model:
 Delivering functional software incrementally, with each increment building upon
the previous one
5. Rapid Application Development (RAD):
 Emphasizing rapid prototyping and user feedback to quickly develop a working
system.

Core Agile Values and Principles:


1. Our highest priority is to satisfy the client through early and continuous delivery of
valuable computer software.
2. Welcome dynamic necessities, even late in development. Agile Process harness
modification for the customer’s competitive advantage.
3. Deliver operating computer software often, from a pair of weeks to a couple of
months, with a preference to the shorter timescale.
4. Business individuals and developers should work along daily throughout the project.
5. The build comes around actuated people. offer them the setting and support they have,
and trust them to urge the task done.
6. the foremost economical and effective methodology of conveyancing info to and
among a development team is face-to-face speech.
7. Working with computer software is the primary life of progress.
8. Agile processes promote property development. The sponsors, developers, and users
will be able to maintain a relentless pace indefinitely.
9. Continuous attention to technical excellence and smart style enhances nimbleness.
10. Simplicity the art of maximizing the number of work not done is essential.
11. the most effective architectures, necessities, and styles emerge from self–organizing
groups.
12. At regular intervals, the team reflects on a way to become simpler, then tunes and
adjusts its behavior consequently.
Why Agile is Important:
 Flexibility:
 Agile allows for adjustments to requirements throughout the development process,
making it suitable for projects with uncertain needs
 Faster Time to Market:
 Delivering working software in short iterations enables quicker release cycles
 Improved Quality:
 Frequent testing and feedback loops lead to better quality software
 Customer Satisfaction:
 Close collaboration with customers ensures the final product meets their needs

Applying Agile in Projects:


 Use Agile methodologies like Scrum or Kanban: These frameworks provide
structured approaches for planning, execution, and review within an Agile mindset
 Create a product backlog: Prioritized list of features and requirements to be
developed
 Conduct regular sprint planning meetings: Define work for each sprint and assign
tasks
 Hold daily stand-ups: Brief team updates on progress and roadblocks
 Perform frequent retrospectives: Reflect on process improvements and adjustments
to optimize future sprints

2. Explain the practices of test first development, refactoring and automating test case
writing

1. Test-First Development
Test-First Development is a practice where tests are written before the actual code is
implemented. It is commonly associated with Test-Driven Development (TDD).
Key Practices:
 Write a Failing Test: Define the expected behavior of the code by writing a test case.
Since the implementation doesn't exist yet, the test will fail initially.
 Write Minimum Code to Pass the Test: Implement just enough code to make the
test pass.
 Refactor the Code: Once the test passes, improve the code quality while ensuring
that the test still passes.
Benefits:
 Helps clarify requirements early.
 Reduces bugs by catching errors during development.
 Ensures a robust test suite is available for future changes.

2. Refactoring
Refactoring is the process of restructuring existing code without changing its external
behavior. The goal is to improve the code's readability, maintainability, and
performance.
Key Practices:
 Identify Code Smells: Look for duplications, long methods, or overly complex logic.
 Apply Refactoring Techniques: Techniques include renaming variables for clarity,
extracting methods, or simplifying conditional logic.
 Run Tests Frequently: Ensure that all functionality remains intact after refactoring
by running automated tests.
Benefits:
 Improves code quality without introducing new bugs.
 Makes the code easier to understand and maintain.
 Reduces technical debt over time.

3. Automating Test Case Writing


Automating test case writing involves using tools or frameworks to automatically
generate, execute, and manage test cases.
Key Practices:
 Leverage Testing Frameworks: Use tools like JUnit, Selenium, or Pytest to write
and execute tests.
 Write Comprehensive Test Cases: Include unit, integration, and end-to-end tests to
cover various scenarios.
 Use Mocking: Simulate external dependencies to isolate and test specific parts of the
system.
 Continuous Integration: Automate test execution as part of the build pipeline to
ensure early bug detection.
Benefits:
 Saves time compared to manual testing.
 Provides consistent and repeatable testing processes.
 Ensures better test coverage, reducing the risk of bugs in production.

Summary
 Test-First Development: Drives development with tests written upfront, ensuring
clarity and reduced bugs.
 Refactoring: Improves existing code without altering functionality, enhancing
readability and maintainability.
 Automating Test Case Writing: Streamlines the testing process, increasing
efficiency and ensuring comprehensive coverage.
By combining these practices, developers can create robust, maintainable, and high-
quality software.

3. Configure the web application and Version control using Git using Git commands and
version control operations.
1. Set Up a Web Application
 Initialize the Project: Create a new directory for the web application and set up the
project with necessary files.
bash
Copy code
mkdir my-web-app
cd my-web-app
# For Node.js project
npm init -y
 Add Necessary Files: Add your project files, such as index.html, style.css, app.js, or
a framework-specific structure.
2. Initialize Git for Version Control
 Initialize a Git Repository:
bash
Copy code
git init
This command initializes an empty Git repository in the project directory.
 Check the Status:
bash
Copy code
git status
This shows untracked files and changes in the working directory.

3. Add Files to Git Repository


 Stage Files for Commit:
bash
Copy code
git add .
This stages all changes (new files, modifications, deletions) in the directory.
 Commit the Staged Changes:
bash
Copy code
git commit -m "Initial commit"
This records the changes with a descriptive message.

4. Set Up a Remote Repository


 Create a Repository on GitHub: Go to GitHub, create a new repository, and copy
the repository URL.
 Link Local Repository to Remote Repository:
bash
Copy code
git remote add origin <repository-url>
Example:
bash
Copy code
git remote add origin https://github.com/username/my-web-app.git
 Push Changes to Remote Repository:
bash
Copy code
git push -u origin main
This uploads the local repository to GitHub and sets the default branch to main.

5. Version Control Operations


a. View Commit History
bash
Copy code
git log
This shows a detailed history of commits. For a brief view:
bash
Copy code
git log --oneline
b. Create a New Branch
bash
Copy code
git branch <branch-name>
Example:
bash
Copy code
git branch feature-login
c. Switch to a Branch
bash
Copy code
git checkout <branch-name>
Example:
bash
Copy code
git checkout feature-login
d. Merge Changes from Another Branch
 Switch to the branch you want to merge into (e.g., main).
bash
Copy code
git checkout main
 Merge the changes from the feature branch:
bash
Copy code
git merge feature-login
e. Pull Updates from Remote Repository
bash
Copy code
git pull origin main
f. Revert a Commit
bash
Copy code
git revert <commit-hash>
g. Resolve Merge Conflicts
 Open conflicting files and manually resolve issues.
 After resolving, stage the files:
bash
Copy code
git add <file-name>
 Commit the resolution:
bash
Copy code
git commit -m "Resolve merge conflicts"

6. Automate and Track Development


 Set Up a .gitignore File: Ignore unnecessary files (e.g., node_modules).
bash
Copy code
echo "node_modules/" >> .gitignore
git add .gitignore
git commit -m "Add .gitignore"
 Collaborate with Team:
o Fork, clone, and contribute using pull requests on GitHub.

7. Example Workflow
1. Make changes to the codebase.
2. Stage and commit the changes:
bash
Copy code
git add .
git commit -m "Implement new feature"
3. Push the changes to the remote repository:
bash
Copy code
git push origin <branch-name>
4. Merge feature branches into main for release.

Best Practices
 Commit frequently with meaningful messages.
 Use branches for features or bug fixes.
 Regularly pull updates from the remote repository to stay in sync.
4.Create a pipeline view of the Jenkins pipeline and Configure it with user defined messages.

1. What is Jenkins?
Jenkins is an open-source automation server that helps automate the parts of software
development related to building, testing, and deploying applications. It supports Continuous
Integration (CI) and Continuous Deployment (CD) processes.
 Purpose of Jenkins:
o Automates repetitive tasks such as building code and running tests.
o Ensures that software can be delivered quickly and efficiently.
o Provides real-time feedback on code health and quality.

2. What is a Jenkins Pipeline?


A Jenkins Pipeline is a series of automated steps or stages written in a Jenkinsfile. It
represents the lifecycle of building, testing, and deploying your application. Pipelines allow
version control of CI/CD workflows and make them repeatable.
 Stages in a Pipeline:
o Build: Compile the code.
o Test: Run tests to verify code quality.
o Deploy: Deploy the application to a server or cloud.

3. How to Install Jenkins on Windows 11


Step 1: Prerequisites
1. Java Installation:
o Jenkins requires Java. Install Java Development Kit (JDK) 8 or later.
o Download JDK from Oracle.
o Set the JAVA_HOME environment variable:
 Open Environment Variables in Windows settings.
 Add a new variable: JAVA_HOME with the JDK installation path.
 Add %JAVA_HOME%\bin to the Path variable.
2. Download Jenkins:
o Visit Jenkins Downloads and download the Windows installer.
Step 2: Install Jenkins
1. Run the downloaded Jenkins installer.
2. Follow the wizard:
o Choose the installation directory.
o Select the default options for plugins.
o Complete the installation.
3. Note the Administrator Password:
o Jenkins will generate an initial admin password. Find it in:
plaintext
Copy code
C:\Program Files (x86)\Jenkins\secrets\initialAdminPassword
Step 3: Configure Jenkins
1. Open Jenkins in your browser:
o Default URL: http://localhost:8080
2. Enter the initial admin password.
3. Install recommended plugins.
4. Create an admin user.

4. Setting Up a Jenkins Pipeline


Step 1: Create a New Pipeline
1. Go to the Jenkins dashboard.
2. Click New Item.
3. Enter a name for the project and select Pipeline.
4. Click OK.
Step 2: Define the Pipeline in a Jenkinsfile
1. In the Pipeline configuration, select Pipeline script.
2. Write a simple pipeline script with user-defined messages:
groovy
Copy code
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building the application...'
}
}
stage('Test') {
steps {
echo 'Running tests...'
}
}
stage('Deploy') {
steps {
echo 'Deploying the application...'
}
}
}
}

5. Detailed Explanation of Each Pipeline Component


 pipeline {}: The top-level block that defines the pipeline.
 agent any: Specifies that the pipeline can run on any available Jenkins agent.
 stages {}: Contains multiple stage blocks, each representing a step in the pipeline.
 echo: Prints user-defined messages during execution.
6. Execute the Pipeline
1. Save the pipeline configuration.
2. Click Build Now on the pipeline’s dashboard.
3. Monitor the pipeline execution:
o Go to Build History and click on the build number.
o View the console output to see messages like:
plaintext
Copy code
Building the application...
Running tests...
Deploying the application...

7. Additional Steps for Advanced Pipelines


 Use Git to fetch code:
groovy
Copy code
steps {
git 'https://github.com/username/repository.git'
}
 Run shell commands:
groovy
Copy code
steps {
sh 'npm install && npm run build'
}

7.Configure the Jenkins tool with the required paths, path variables, users and pipeline
views.
Configuring Jenkins with the required paths, path variables, users, and pipeline views
involves a step-by-step process to ensure Jenkins is ready for efficient CI/CD workflows.
Below is a clear explanation of each stage, starting from the initial setup.

Step 1: Verify Java Installation


Jenkins requires Java to run.
1. Check if Java is Installed:
o Open Command Prompt and run:
cmd
Copy code
java -version
o If Java is installed, it will display the version. Ensure it is Java 8 or later.
o If not installed, download and install the latest Java JDK from Oracle.
2. Set the JAVA_HOME Path:
o Open Environment Variables:
 Press Win + S, search for "Environment Variables," and select "Edit
the system environment variables."
o Under System Variables, click New:
 Variable Name: JAVA_HOME
 Variable Value: Path to the Java installation directory (e.g., C:\Program
Files\Java\jdk-XX).
o Add %JAVA_HOME%\bin to the Path variable.

Step 2: Install Jenkins on Windows


1. Download Jenkins:
o Visit the Jenkins Downloads page and download the Windows installer.
2. Install Jenkins:
o Run the installer and follow the setup wizard.
o During installation, Jenkins will ask for a path to the Java executable. Ensure
the JAVA_HOME variable is set.
o Note the default Jenkins home directory (e.g., C:\Program Files (x86)\
Jenkins).

Step 3: Configure Jenkins Paths


Once Jenkins is installed:
1. Set the Jenkins Home Path (Optional):
o If you want to change the Jenkins Home directory:
 Stop Jenkins: Run in Command Prompt:
cmd
Copy code
net stop jenkins
 Edit the Jenkins configuration file (jenkins.xml):
 Located in C:\Program Files (x86)\Jenkins.
 Modify the <arguments> tag to include:
xml
Copy code
--httpPort=8080 --prefix=/jenkins --JENKINS_HOME=C:\YourDesiredPath
 Restart Jenkins:
cmd
Copy code
net start jenkins

Step 4: Add Users in Jenkins


Jenkins allows you to create and manage users for security.
1. Log in to Jenkins:
o URL: http://localhost:8080
o Use the initial admin password from C:\Program Files (x86)\Jenkins\secrets\
initialAdminPassword.
2. Enable Security Settings:
o Go to Manage Jenkins → Configure Global Security.
o Select Enable security.
o Choose Jenkins’ own user database under Security Realm.
o Check Allow users to sign up.
o Save the changes.
3. Create Users:
o Go to Manage Jenkins → Manage Users → Create User.
o Add username, password, and other details.

Step 5: Configure Environment Variables in Jenkins


1. Set Global Environment Variables:
o Go to Manage Jenkins → Configure System.
o Scroll to Global Properties.
o Check Environment Variables.
o Add variables, e.g.:
 Name: BUILD_HOME
 Value: C:\Builds
2. Save the Changes.

Step 6: Create and Configure a Jenkins Pipeline


1. Create a Pipeline:
o Go to the Jenkins Dashboard → Click New Item.
o Enter a name for the project.
o Select Pipeline and click OK.
2. Define the Pipeline Script:
o Scroll down to the Pipeline section.
o Select Pipeline script.
o Enter the pipeline code:
groovy
Copy code
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building the application...'
}
}
stage('Test') {
steps {
echo 'Running tests...'
}
}
stage('Deploy') {
steps {
echo 'Deploying the application...'
}
}
}
}
o Save and click Build Now to run the pipeline.

Step 7: Configure a Pipeline View


Pipeline views provide a graphical representation of the pipeline.
1. Install the "Pipeline" Plugin:
o Go to Manage Jenkins → Manage Plugins → Available.
o Search for Pipeline.
o Select and install the plugin.
2. Create a Pipeline View:
o Go to the Jenkins Dashboard.
o Click + (Add a new view).
o Enter a name for the view.
o Select Pipeline Aggregator View.
o Configure the pipeline view:
 Select jobs to display.
 Configure the columns and layout.
3. Save and Monitor:
o The new view will show the progress and logs of your pipeline.

Step 8: Test Your Jenkins Configuration


1. Run your pipeline by clicking Build Now.
2. Monitor logs and outputs.
3. Fix errors if necessary by editing the Jenkinsfile.

Summary
You’ve configured Jenkins with:
 Path variables and system settings.
 User management for security.
 A pipeline to automate tasks.
 A pipeline view for monitoring.

You might also like