Creating Pipeline is like baking a cake 🍰 🎂, But being a QA make sure it tastes great..! I mean Test!😊
I just started learning GitLab ci-cd recently and found we should have a clear understanding of what is pipeline and how we can relate in real life. I always understand things better when it relates to our real life. This article is not technical at all. but you can relate to it and based on the foundation of fundamentals we can easily build up our knowledge. Or you might create your own pipeline too :)
To set up the expectations after reading through this article you will relate the Pipeline concept with your real-life and maybe you will found a base of CI-CD concepts and we will take a small technical but real-world example of Pipeline
Before jumping to what is Pipeline forget for a minute that you are reading something technical here and we can start now.
Let’s relate it to a real-world example, Assume you are sitting at your home 🙇🏻 , and bored of eating regular food 🍲 🍛 and your sweet tooth feel to eat a Chocolate cake 🍰 🎂 , and instead of buying a cake from a bakery shop, you wanted to make it in your home and reward yourself a delicious cake and satisfaction of “Yes, I can bake a cake” , of course, you wanted to become a chef for a day. :) 👨🍳
So, let’s start…! Our goal is to bake a cake at home and nothing fancier, So what is the first thing you will do? you will list out all the ingredients for baking a cake, then you will list down the preparation steps to bake a cake. so let’s begin our journey…! 🏄
Step:1 Ingredients for cake: You will list down what ingredients you will need for baking cake, lets think, and list down all
Flour , And How can you forget the most important thing 😀
-Chocolate 🍫 :)
now, we have all ingredients with us, let’s go ahead…!
Step:2 Procedure for baking a cake: Of course you have to bake a cake you can not just eat all the ingredients and feel like eating a cake, I mean you can eat them but our goal is to bake a cake so we have to understand what should be the procedure to bake a cake: :), So One by one list down them below:
- First, Mix warm milk with sugar, flour, eggs
- Then mix chocolate and butter at last
- Put it in the oven at 180 degree Celsius for 20 min and after done keep it another 20 min to come to room temperature
- Your delicious cake is Ready Now, serve it with cold chocolate on top :)
But, ah, wait… You can’t say the cake is delicious without eating it…! :) So, let’s taste it and let me know how your cake taste like :)
Step:3 Serve a cake and eat:
- Eat and Ask yourself How it taste
- is your favorite chocolate is there 😃
- is it sweet like we want
- Most importantly Are you happy…? After eating a cake 😃 🍰 🎂
If yes, Great. You are a perfect version of yourself of becoming Chef, tap your back now, and be proud of yourself of trying! Now, lets go technical a bit.
The technical way of Pipeline:
Well, What we have done is we just break it down our step of baking cake in steps, we followed a procedure to bake a cake, we step by step arranged our work in a better way and organized way, without having ingredients we can not start baking cake. so we defined step by step procedure to carry out our goal. This is what a Pipeline actually do.
“A pipeline is a sequence of steps that we want to do to achieve our goals”
To say a bit in a technical way:
“A pipeline is a group of jobs that get executed in stages.”
- Well, How does baking a cake relate in real-world, it can we can do these steps using a pipeline as well, lets say you using one of the CI-CD tools and you want to bake a cake with that. You can actually create a single project and add below steps, something like below: belive me your cake will bake and taste great!
Try Yourself too. :) This is how our Pipeline will look in a technical way, have a look below:
What I have done here:
You can see I just created a basic cake baking pipeline using some technical things, I mean Unix commands, etc.
- Just go to gitlab.com and create a free account, create a blank project.
- Add a file named “.gitlab-ci.yml” only and copy-paste below contents one by one if you feel to do it by your own, I have shared code at the end of this article too :)
- I wrote high-level steps = stages:
Then, I just have given some names to identify these stages. and one by one I just added them like below which What I have done in real life:
just save it and voila, your first pipeline is ready :) and it will look something like below when completes.
Remember we are newbie in baking cake, sometime our cake will not bake correctly, or will not taste great. it means Our Pipeline will fail sometime.
Don’t lose hearts, check what is wrong and try to google, one day our cake will bake and taste great. I mean our pipeline will run successfully. Just practise daily
Of course, I am QA, and I want to taste it I mean Test it, I just added very basic level checks. :) like a real-world taste of cake taste like :)
You can fine the above code im my gitlab public repo too: https://gitlab.com/anandbhagwatdevops/chocolatecake
We have learned what is the meaning of pipeline in the real world and how we can create a pipeline out of this understanding. of course, the way of writing pipeline in code varies based on which CI-CD tools you use. this is just an example of how easily a pipeline can be made. The goal is to understand the concept and based on this you can achieve your goal of learning and implementing CI-CD. find out how you can use CI-CD concepts to automate the routine task and how you can structure it in a better manner.
And remember in this world of DevOps we are shifting left towards Development lifecycle, you will be asked to carry out CI-CD tasks, QA’s expertise lies Software Testing and we should be strong enough in that, but when Time arises you have to be a chef I mean a DevOps enabler for your team. grab the skill and build on top of that. I am in the phase of learning this too 😊
Feel free to share your feedback and questions on this article. let me know how can I improve too.
You can find the above code im my gitlab public repo too: https://gitlab.com/anandbhagwatdevops/chocolatecake
Happy Learning..! 😊