|
|
## DevOps Practical
|
|
|
|
|
|
### Introduction to DevOps
|
|
|
|
|
|
DevOps is a set of practices that companies/startups follow for writing software.
|
|
|
- The practice is to build, test and deploy each change in the software as soon as the changes are submitted.
|
|
|
- It increases speed of software development and make sure that the software quality is high.
|
|
|
|
|
|
### DevOps stages
|
|
|
|
|
|
Devops has these stages
|
|
|
|
|
|
1. Plan
|
|
|
2. Code
|
|
|
3. Build
|
|
|
4. Test
|
|
|
5. Release
|
|
|
6. Deploy
|
|
|
|
|
|
|
|
|
### Steps to run DevOps using gitlab
|
|
|
|
|
|
Gitlab provides ready-to-use templates to run DevOps on sample programs.
|
|
|
|
|
|
For Example:
|
|
|
|
|
|
We will use a simple CPP program which `adds` and `substracts` 2 numbers.
|
|
|
|
|
|
1. Fork the repository.
|
|
|

|
|
|
- Select your username in the next window.
|
|
|
|
|
|
2. Clone the repository.
|
|
|
- Copy Repository URL from the
|
|
|
|
|
|

|
|
|
|
|
|
- Open VSCode, Go to File --> Open Folder (open any empty folder)
|
|
|
- Press `Ctrl` + `J`
|
|
|
- Type `git clone {your-repository URL here}`
|
|
|
|
|
|

|
|
|
|
|
|
3. Make changes to the code.
|
|
|
- Add another line printing addition of 100 + 80.
|
|
|

|
|
|
|
|
|
|
|
|
4. Submit the changes.
|
|
|
- Press `Ctrl` + `J`
|
|
|
- Run commands
|
|
|
|
|
|
```sh
|
|
|
cd devops-trial
|
|
|
git config --global user.name "{Your-name}"
|
|
|
git config --global user.email "{your-email-id}"
|
|
|
git add .
|
|
|
git commit -m "Added add 10 + 80"
|
|
|
git push
|
|
|
```
|
|
|

|
|
|
|
|
|
5. See your code Build, Test and Deploy.
|
|
|
- Go to your repository, CI/CD --> Pipelines.
|
|
|

|
|
|
- You can see Build, Test and Deploy devOps stages passing.
|
|
|

|
|
|
- Click on the `passed` to see all the individual stage summary.
|
|
|

|
|
|
|
|
|
6. Thats is it done, you have successfully seen your code Build, Test and Deployed.
|
|
|
|