https://github.com/nmfzone/improve-gitlab-ci-cd
Tips to improve Gitlab CI/CD speed
https://github.com/nmfzone/improve-gitlab-ci-cd
continuous-deployment continuous-integration docker gitlab-ci
Last synced: 3 months ago
JSON representation
Tips to improve Gitlab CI/CD speed
- Host: GitHub
- URL: https://github.com/nmfzone/improve-gitlab-ci-cd
- Owner: nmfzone
- License: mit
- Created: 2019-01-05T20:40:46.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-06T15:45:10.000Z (over 6 years ago)
- Last Synced: 2024-12-30T04:32:40.754Z (4 months ago)
- Topics: continuous-deployment, continuous-integration, docker, gitlab-ci
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Improve Gitlab CI/CD
To improve the Gitlab CI/CD speed, there is a lot of technique. I'll show you some example.
In this example, I use Gitlab CI/CD for my NuxtJs application.## Using Cache
Gitlab gives us ability to cache the files on each stage. So, in this example, I need to cache the:
1. node_modules
2. .nuxt
3. build (because I used Backpack, with my own server implementation)
4. OthersTo achieve this, you just need to add the cache config in your `.gitlab-ci.yml`.
```
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- .nuxt/
- build/
- .env
- .test.env
- node_modules/
```By using this method, I just need to `build` the project one time (on the `ci_prepare` stage), then for subsequent stage I just need to re-use it.
In my example, I've 2 tests stage that need Nuxt to be build first, to perform the test. So, instead I build the Nuxt in every stage (that each build needs ~6 minutes), I just need to create one stage named `ci_perepare`, then build once in that stage.
## Using slim docker image
To improve the speed of Gitlab CI/CD, you should use slim docker image as much as possible.
For example, to run deploy stage, that only require `ssh`, I use `nmfzone/ssh-client-light` image, that use alpine linux, so it's just need to pull 5 MB image.