USA / Canada 866-503-1471

International +972-722-405-222

« Blog Home

Free-of-Charge Serverless Computing Using GitLab CI/CD

In short: GitLab CI/CD lets you run your programs without the need to maintain your own computer, free of charge.

serverless

A few months ago, we started distributing, to some of our customers, Excel sheets listing GitLab features. How did we create those sheets? We wrote a script, which used GitLab API to extract information from GitLab release notes and with that information we built the Excel sheet. From time to time we ran that script on one of our private computers.

Lately we have decided to start running our script automatically, using serverless computing on one of public clouds.

What is Serverless Computing?

Serverless computing, sometimes called Function-as-a-Service (FaaS), is a cloud-computing execution model, which allows developers to run their programs without a need to take care of physical or virtual machines and other resources. Pricing is based on the actual amount of resources consumed by an application, rather than on pre-purchased units of capacity.

(Note that although this mode is called “serverless”, the server does exist somewhere, in a cloud provider’s data center, but users are freed from the need to manage it)

 After some testing we have found out that for our needs we can use the serverless approach totally free of charge by exploiting GitLab shared CI runners.

How does it work?

Let’s start with the fact that GitLab allows you to create a private repository on their cloud (gitlab dot com) free of charge.

Moreover, GitLab provides free shared servers (“runners”) to run your programs in continuous integration (CI). That means that you can configure your GitLab project so that on every change in your Git repository, your software will run on one of GitLab-provided free servers. You can also start a CI run manually (without making any changes in the repo), schedule it in advance (like in crontab)  or even trigger it by an external program using GitLab API.

GitLab CI Runners

As we said above, GitLab puts free shared CI runners at the disposal of the community. There is a limit of 2,000 minutes per month per single project, which is a significant quantity of CPU time and lets you run quite a lot of things.

All this means that you get serverless computing service, i.e.  a capability to run your programs in the cloud, without worrying about CPU, memory, etc., and all that free of charge!

How do you create environment for running your software on public runners?

GitLab public runners are actually Docker containers, running minimal Ubuntu Linux. There is a good chance that when you will want to compile a program or run a script, you will not find there the compiler or the interpreter you need. To overcome this problem you can request a specific Docker image to be installed in your container. In addition, in the runtime you can install all necessary libraries.

In our case, we needed a Python interpreter plus Python modules for accessing GitLab and for writing Excel files.  Therefore we requested that the runner be loaded with the Python image and that afterwards the above modules be installed. 

Below is an example of an Excel sheet created by our program:

gitlab-all-features

In a similar way, you can run a script or test almost in any language. For example, you can test the code you have written,  process data you have collected, deploy artifacts you have created to other servers (as an implementation of Continuous Deployment), etc.

Summing up: What did we gain?

We gained the ability to run a program in the cloud, without a need in having a server, whenever we want (24/7), privately (without exposing our code to anybody), and all that free of charge!

Is this solution suitable for everybody?

Not necessarily. It is important to remember that you cannot fully rely on public free runners’ response time and performance, especially at peak times when thousands of developers from all around the world run their programs on the same servers (imagine the traffic on the Coastal Road at 8am, and you will understand what we mean). Therefore we don’t think our solution is suitable for time-critical applications.

You can solve the performance problem by using private runners. Those can reside either on-premises or on a public cloud. You may also prefer private runners if you need more CPU time than what you get for free, more computing power, auto-scaling, tighter security, etc.

You may also prefer using GitLab Enterprise edition, which provides more CI/CD features than the free one. To learn about them, you are invited to download the above mentioned Excel file, which we built using GitLab CI…

Subscribe to our mailing list


Try GitLab risk-free for 30 days.

No credit card required. Have questions? Contact us.

x icon svg