4. What is Software Craftsmanship?
Software Craftsmanship is all about putting
responsibility, professionalism, pragmatism and
pride back into software development
7. Current role of an DevOps engineer
- Building CI/CD pipelines for multiple technology stack
- Containerising applications/services with Docker
- Automation of provisioning environments in cloud/on-prem with code
- Automation of Configuration management of environments and application
with code
- Writing deployment scripts for container orchestration with Kubernetes
- Enable monitoring and alerting
13. Pipeline code become Dirty
- Unreadable
- Hard to test
- Difficult to maintain
- Takes lot of time to add new functionality
14. Any fool can write code that a computer can
understand. Good programmers write code
that humans can understand.
- Martin Fowler
15.
16. Good Code
- Clean Code principles
- Refactoring legacy code
- Code Review and pull request
- Unit Testing of Pipeline
- Integration testing of Pipeline
- Automated testing of Infrastructure as code scripts
- Continuous Integration of DevOps pipeline scripts
- Continuous Delivery of DevOps pipeline scripts
17.
18.
19.
20. Refactoring legacy code
When we refactor, we should have tests. To put tests in place, we often have to
refactor
- Identify Change Points
- Identify Test Points
- Break Dependencies
- Write Tests
- Refactor or Change
21.
22. Code Review and pull request
- Why don't we put gates for DevOps engineers code
- Code review practices
- Sonarqube Code Analysis
- Git Hooks
- pre-commit: Check the commit message for spelling errors.
- pre-receive: Enforce project coding standards.
- post-commit: Email/SMS team members of a new commit.
- post-receive: Push the code to production.
23. Unit Testing of Pipeline Code
- Unit test for Jenkinsfile
- Unit test for shared library
- Unit testing increase confidence of code changing/ managing pipeline code.
- Non-Regression test
- Call Stack print for pipeline code.
Github: https://github.com/mrumeshkumar/pipelinecode-unittest-shared-
library.git
24. Pipeline Code Unit Testing Framework
1. Com.homeaway.devtools.jenkins with Spock
2. Jenkins-pipeline-unit with junit and Spock
25.
26.
27.
28.
29.
30.
31.
32.
33.
34. Take away -
Go Fast by adopting Software Craftsmanship
● DevOps engineers mindset should change to Developer mindset
● Follow Boy scout rule
● Software Craftsmanship is a long journey to mastery
● Follow Clean Code principles
● Continuous Refactoring of legacy code
● Code Review and pull request
● Unit Testing of Pipeline
● Integration testing of Pipeline
● Automated testing of Infrastructure as code scripts
● CI/CD of DevOps pipeline scripts
Functions
Smal!
Do One Thing
One Level of Abstraction per Function
Dont use Switch Statement
Use Descriptive Names
Reduce Function Arguments
Use verbs
Don’t Repeat Yourself (DRY)
The Boy Scout Rule
gdfgijdfg
gdfgijdfg
What are Git hooks?
Git hooks are scripts that Git executes before or after events such as: commit, push, and receive. Git hooks are a built-in feature - no need to download anything. Git hooks are run locally.
These hook scripts are only limited by a developer's imagination. Some example hook scripts include: