Is it possible to deploy GItLab Pages without CI/CD? - gitlab

We have a locally deployed instance of Gitlab, where at the time we cannot afford to have a GitLab Runner to run CI/CD pipelines.
Is it possible to use GitLab Pages without CI/CD? E.g. is it possible to manually prepare the HTML-content, put it in the public folder in the root and make it accessible?

I assume you don't want to use GitLab shared runner which costs you and CI minutes limits.
Public folder
Refer to this gitlab-ci.yaml for making HTML content available https://gitlab.com/pages/plain-html/-/blob/master/.gitlab-ci.yml
Running locally without registration
Here is the known limitations: https://docs.gitlab.com/runner/commands/#limitations-of-gitlab-runner-exec
Pages are directly managed by Gitlab so running locally won't affect the page's state.
Use your own runner and register with gitlab (Possible)
Install GitLab runner on your machine and register as a runner, instructions can be found at Settings->CI/CD->Runners->Specific runner Enable it for your project or group.
I use my personal machine gitlab-runner to execute CI jobs that aren't counted towards CI minutes.

Related

Cannot find how my jobs are bound to runners

I have a pipeline set up on Gitlab, within which my project is built and unit tests are run every time I commit a change to "developer" git branch.
Recently I've updated versions of some libraries in the project and after that builds on CICD started to fail and says that node.js version should be updated.
As I undestand I need to somehow edit settings of a container in which builds are run.
We have our own gitlab instance. As I see from the settings there are group of shared runners, used from many projects.
How can I find out which of those runners are used for my project? in the Gitlab GUI I can see tags assigned to the shared runners, but I don't see any tags in my .gitlab-ci.yml
Gitlab version is 15.4.2-ee
self-managed
If its not tagged it will run on any runner which is configured to run untagged jobs. Not just on any runner. By default runners don't run untagged jobs.

Deploy a web application onto a Windows server using GitLab

We are running a GitLab with CI and want to deploy our application onto a Windows server. This will be just a demo system so we are quite open how we run the app later.
Currently we build and test the application. Now we need to stop the old app at the server, bring the new build onto server and start the new app.
I want to use at best the tools from GitLab but this isn't a must and as you can assume I am not so used to GitLab Deploy stuff.
Docker would be also an option.
Do you have some ideas?
Thank you
Nico
If you aren’t precious about the actual deployment of your web app then the easiest thing to do would just be install a gitlab runner on your test windows host. You should use a shell runner, so it can operate as a “fake user”. You’ll also need to ensure the user the runner is installed as has the right creds to install your app.
Tag this runner so it will run for a particular job, then within your gitlab ci you can take a copy of your build as an artifact (see gitlab ci artifacts).
Artifacts are automatically copied between runners so long as they are within the same pipeline run so you will have accsess to your built web app and can then install it how you like.

configure gitlab to build the source code on another machine

We have two servers in our organisation.
1) server with gitlab
2) Build server
I would like to create an automate build happen in the second machine(Build server ) for the source code in the gitlab server.
How can I achieve this using gitlab ?
Thanks,
siva
If you are moving from an "pull" continuous integration system (e.g. using a kind of crontab that regularly checks if the source code on the versioning system has changed and start the configure/build/test/deploy stages if it has), then know that gitlab has a much better way of doing this.
gitlab approach is to configure a "pull" system: every time the code is updated (in any branch) on the git repository then the script defined in your .gitlab-ci.yml is read to see if continuous integration jobs have to be launched. jobs are send to your configured gitlab runners. gitlab runners are defined on your build server(s) and takes the job when they are coming.
Definition of what to do is also describes in the .gitlab-ci.yml.
Here is a list of documentation to start learning about gitlab CI:
the official documentation can be helpful
A general introduction to gitlab ci using docker can be found in this blog article (the first slides are great). If your build server or your intended build is on Linux, I would recommend using the "docker executor" (e.g. gitlab runners are executed inside a docker machine inside your build server). It is easy and quick to setup.
Hope this helps you starting...

What is gitlab runner

I think I'm fundamentally missing something. I'm new to CI/CD and trying to set up my first pipeline ever with gitlab.
The project is a pre-existing PHP project.
I don't want to clean it up just yet, at the moment I've pushed the whole thing into a docker container and it's running fine talking to google cloud's mysql databases etc as it should locally and also on a remote google cloud testing VM.
The dream is to be able to push to the development branch, and then merge the dev banch into the test branch which then TRIGGERS automated tests (easy part), and also causes the remote test VM (hosted on google cloud), to PULL the newest changes, rebuild the image from the latest docker file (or pull the latest image from gitlab image register)... and then rebuild the container with the newest image.
I'm playing around with gitlab's runner but I'm not understanding what it's actually for, despite looking through almost all the online content for it.
Do I just install it in the google cloud VM, and then when I push to gitlab from my development machine.. the repo will 'signal' the runner (which is running on the VM, to execute a bunch of scripts (which might include git pull on the newest changes?).
Because I already pre-package my app into a container locally (and push the image to the image registry) do I need to use docker as my executor on the runner? or can i just use shell and shell the commands in?
What am I missing?
TLDR and extra:
Questions:
What is runner actually for,
where is it meant to be installed?
Does it care which directory it is run in?
If it doesn't care which directory it's run,
where does it execute it's script commands? At root?
If I am locally building my own images and uploading them to gitlab's registry,
Do I need to set my executor to docker? Shouldn't I just set it to shell, pull the image, and build it? (Assuming the runner is runing on the remote VM).
What is runner actually for?
You have your project along with a .gitlab-ci.yml file. .gitlab-ci.yml defines what stages your CI/CD pipeline has and what to do in each stage. This typically consists of a build,test,deploy stages. Within each stage you can define multiple job. For example in build stage you may have 3 jobs to build on debian, centos and windows (in GitLab glossary build:debian, build:centos, build:windows). A GitLab runner clones the project read the gitlab-ci.yaml file and do what he is instructed to do. So basically GitLab runner is a Golang process that executes some instructed tasks.
where is it meant to be installed?
You can install a runner in your desired environment listed here. https://docs.gitlab.com/runner/install/
or
you can use a shared runner that is already installed on GitLab's infrastructure.
Does it care which directory it is run in?
Yes. Every task executed by runner is relativly to CI_PROJECT_DIR defined in https://gitlab.com/help/ci/variables/README. But you can alter this behaviour.
where does it execute it's script commands? At root?
Do I need to set my executor to docker? Shouldn't I just set it to shell, pull the image, and build it?
A runner can have mutiple executors such as docker, shell, virtualbox etc but docker being the most common one. If you use docker as the executor you can pull any image from docker hub or your configured registry and you can do loads of stff with docker images. In a docker environment normally you run them as the root user.
https://docs.gitlab.com/runner/executors/README.html
See gitlab access logs , runner is constantly polling the server

Gitlab and CI server

I recently moved a repo from bitbucket to gitlab. I now want to have a CI (travis or drone) working with my repo.
After some reading, i found out that gitlab builded their own CI (gitlab CI) but needed to be self hosted and it dont seem to be possible to set on heroku.
I dont want to manage an AWS instance only to get a CI server, as travis, drone (and probably some other that i dont know of) already exist and do the job.
Is there something i missed? Is there a way to have (quick and easy) gitlab CI (i repeat that i wont take a self-managed server for this) or i will have to move to github or get back to bitbucket?
Gitlab is really a nice product, but the lack of support for CI server is a road block!
Thank you
It seems that Drone already does GitLab: http://feedback.gitlab.com/forums/176466-general/suggestions/5675077-integrate-docker-drone-with-gitlab-ci-runner but I haven't tried it.
You might also have a look at: https://githost.io/, it manages GitLab and / or CI for you, and you can connect the CI to any GitLab instance: https://githost.io/docs#ci_master Since you already have the CI there, keeping it in-house is not a concern, so you might as well also have the GitLab instance there or at gitlab.com It was acquired by GitLab in 2015 Q2 https://twitter.com/gitlab/status/592438051533524993
Travis on the other hand seems to be bound to GitHub and thus not an option: Integrate Gitlab and TravisCi
As mentioned by Dorum, Magnum CI also handles GitLab: https://magnum-ci.com/docs
MagnumCI now support Gitlab and other popular platforms. Also Gitlab launched the own CI service with shared servers.

Resources