DEV Community

Beginner-Friendly Introduction to GitLab CI/CD

Zuri Hunter on January 19, 2019

The goal of this tutorial is to give a high-level introduction of GitLab CI/CD that helps people get started in 30 minutes without having to read a...
Collapse
 
renatosuero profile image
Renato Suero • Edited

Great post Zuri, congrats =)
I'd like to suggest 2 things:
First, you could remove npm install in the action build-min-code:, because you added a before_script to run that. It is useful if you don't want to do the second suggestion. As you can see in the screenshot

Second, you could use cache+git strategy to save time and process, You could use cache in the first step to get the code and run npm install, the next can use that files.
Short explanation, you could use cache to store the code and files generated by npm install(so only need to run one time) and git strategy because in other actions you could see to ignore git clone and use the cache folder.

please let me know if you have questions about that, I can explain or send you a Merge Request to see my suggestion.

Collapse
 
webmutation profile image
DDd • Edited

It really depends on your gitlab setup. If you are using dynamic runners. The cost of compressing and decompressing a distributed shared cache is about the same. We have large projects with 600 to 1 GB dependencies and distributed cache shaves about 50 to 60 seconds from a yarn install. Cache is not a small topic. Would love to see more advanced articles on this topic.

Collapse
 
renatosuero profile image
Renato Suero

Yes, you are right. The most important is you know when use cache or not. in your case cache isn't good.

Collapse
 
tamouse profile image
Tamara Temple

Really well done! The info is clear and helpful. What I appreciated most was the structured approach you took to explaining a rather complex operation.

Congrats on your first tech post, too. Looking forward to seeing more. ☺💪👏💯

Collapse
 
sytses profile image
Sid Sijbrandij

Thanks for writing about GitLab!

Collapse
 
bennypowers profile image
Benny Powers 🇮🇱🇨🇦

I learned ci/CD with gitlab. What a pleasure! Recently I tried Travis and of ok could aim up the experience in one Shreveport, it would be "why did this have to be so hard?"

I thoroughly recommend gitlab.

Well done on the article, @zurihunter

Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
webmutation profile image
DDd

Hum depends on the version of npm. I would use yarn it still is faster. And like the first comment. With cache. Npm ci is very much abandoned, the idea was good but the speed is not there.

Collapse
 
pismy profile image
Pierre Smeyers

Thanks for the post !
Another great feature with GitLab CI is the ability to use templates.
B.t.w. a good option if you want to build state-of-the art DevOps pipeline with GitLab CI is to use advanced templates such as to be continuous (to-be-continuous.gitlab.io/doc/)
It provides many ready-to-use and composable templates (Node, Python, Maven, Docker, AWS, Kubernetes, S3 and many more).
It's open-source ;)

Collapse
 
davew723 profile image
davew723

Nice Article. I would love to see some best practices around the actual deployment. Most examples just have fluff in those sections, similar to your gitlab (below).

"deploy-stage": "echo 'Deploying to STAGING'",
"deploy-prod": "echo 'Deploying to PRODUCTION'"

It feels like people are in two camps around deployment. Many just use Heroku or other services for the actual deployment and the rest are just scp'ing files around. I would love to better understand best practices in the non-heroku-ish case.

Collapse
 
vardhireddy profile image
Krishna Reddy

Looks perfect for beginners

Collapse
 
thangaraj000 profile image
Thangaraj000

Thank you

Collapse
 
azhtom profile image
Daniel Soria

Cool post, thanks for sharing :)

Collapse
 
shreeharivaasishta profile image
ShreehariVaasishta

What's the specifications of a gitlab CI/CD ?

Collapse
 
hadjigagny93 profile image
elhadji gagny

Great Post Zuri ! Very nice