
Define artifact full version#
And not just the release branch ( node:14), but the full version tag ( node:14.2.5). Therefore, I suggest specifying the version of the image. So, even if a node is upgraded from version XX to YY, our Pipeline will know nothing about it. If the GitLab runner caches docker images, the first run will download the image, and all subsequent runs will use the locally available image. It always points to the latest release of Node.js.

This tag ruins the reproducibility of the builds. Line #1 specifies the docker image, which will be used in all jobs. The cache is created within each job.Ĭonsider the CI template example for Node.js recommended by GitLab:Įnter fullscreen mode Exit fullscreen mode To compare the artifact is created in the first job and is used in the following ones.

The third job, Lint, similarly downloads the artifact from the server. The second job, Test, downloads the artifact from the server before running the commands. Subsequent jobs will download the artifact before script execution.īuild job creates a DEF artifact and saves it on the server. After execution, it will upload the cache back (push).Īrtifacts are files stored on the GitLab server after a job is executed. Lint, the third job, will find the cache on runner01 and use it (pull). The second job will execute on runner02, it won't find the cache on it either and will work without it. The job will not find the cache but will upload one after the execution to runner01. Let's suppose you run a Pipeline for the first time with a local cache. If the distributed cache is configured, S3 works as storage. By default, the cache is stored in the same place where GitLab Runner is installed. It's a set of files that a job can download before running and upload after execution. If you don't use cache and artifacts, the runner will have to go to the internet or local registry and download the necessary packages when installing project dependencies. For simplicity, let's consider Docker as an executor for all runners.Įach job starts with a clean slate and doesn't know the results of the previous one. The GitLab-runner is the agent that can run jobs. When we start a Pipeline, a random runner with free resources executes the needed job. Jobs work on a distributed farm of runners. The Pipeline is a set of stages and each stage can have one or more jobs. Let's see what the Pipeline in GitLab terms means. GitLab has bright documentation, but the Node.js app with cache example and the Pipeline template for Node.js contradict each other. People are confused when they have to choose between cache and artifacts. Cache and artifacts to the rescue! They help reduce the time it takes to run a Pipeline drastically. Nobody wants to wait for the CI completion too much, it's better to set up all the tweaks to avoid long waiting between the commit the build status. There are three things you can watch forever: fire burning, water falling, and the build is passing after your next commit.
Define artifact how to#
I'll show how to configure the Pipeline for the Node.js app in a pragmatic way to achieve good performance and resource utilization. Let's discuss the difference between GitLab cache and artifacts.

Apart from web services testing, I maintain CI/CD Pipelines in our team's GitLab.
Define artifact software#
Hi, DEV Community! I've been working in the software testing field for more than eight years.
