How do I start using Gitlab-CI in Gitlab Omnibus edition? - gitlab

I have installed Gitlab Omnibus gitlab-7.4.3_omnibus.5.1.0.ci-1.el6.x86_64.rpm on CentOS 6.6. I have a few projects created and working fine but I would like to try using the continuous integration features. I don't know where to start and documentation/tutorials are thin on the ground.
I have found the following files that do not appear in an older Gitlab omnibus install I have:
/usr/bin/gitlab-ci-rake
/usr/bin/gitlab-ci-rails
I presume I need to do something with these? But do I need a configuration file first?
In my projects (Settings > Services > Gitlab CI) I can see there are options for Active, Token and Project Url but I do not know what to put in these fields.
Any help to get me started on CI would be appreciated. Cheers,jonny

We recently installed the omnibus GitLab 7.6.2 release which has GitLab CI 5.3 built in. I had the same question. Here's how we got it working.
We're using a single secured server over https; single ip for both gitlab and gitalb-ci hosts.
We have dns entries for both host names to a single ip. (Done with an alias for the ci server I think). We have two ssl certificates one for each hostname.
We have the following lines at the top of the /etc/gitlab/gitlab.rb script (found by searching the gitlab site for rb file setup details):
external_url 'https://gitlab.example.edu'
nginx['redirect_http_to_https'] = true
ci_external_url 'https://gitlab-ci.example.edu'
ci_nginx['redirect_http_to_https'] = true
For http, leave out the nginx statements.
If gitlab-ci url displays the gitlab site contents then the ci_nginx statement needs to be corrected.

Related

gitlab: Specify the project with PROJECT_ID={number} or PROJECT_PATH

My research group uses gitlab to manage projects for which each researcher is working on. The projects server is accessible on https://gitlab.com/our-lab-name. My specific project as accessible on: https://gitlab.com/our-lab-name/my-project-name
I would like to remove unreferenced LFS files, so I proceeded as far GitLab documentation.
sudo gitlab-rake gitlab:cleanup:orphan_lfs_file_references PROJECT_PATH="https://gitlab.com/our-lab-name/my-project-name"
I, [2022-05-09T12:33:40.101636 #30556] INFO -- : Specify the project with PROJECT_ID={number} or PROJECT_PATH={namespace/project-name}
Then supplied my project ID (Project ID: 14xxxx41):
sudo gitlab-rake gitlab:cleanup:orphan_lfs_file_references PROJECT_ID=14xxxx41
I, [2022-05-09T12:45:23.865401 #32224] INFO -- : Specify the project with PROJECT_ID={number} or PROJECT_PATH={namespace/project-name}
None seems to work.
What is your suggestion?
gitlab-rake commands are intended for use by self-hosted GitLab administrators only. Since you are using gitlab.com, you cannot use gitlab-rake commands to administrate your GitLab projects.
These commands are intended to be run directly on the GitLab server, which you would only have access to as an administrator of the server. In the case of GitLab.com, only certain GitLab.com employees can perform console escalations.
You'll notice the documentation states this feature is for self-managed customers only (that is, you run your own gitlab instance on your own servers) and is not available in GitLab SaaS (gitlab.com).

How do I force gitlab runner to use the host's domain name instead of ip address?

My company has a bitnami gitlab installation that we self-host. While I manage the gitlab installation, I am not an expert on it by any stretch. A few months back, I configured a project to use a gitlab runner in order to perform unit tests when the project is committed.
Today, when I pushed a commit, the gitlab runner tried to pull from the ip address using ssl. How do I tell it to pull the commit using the domain name?
I want it to use https://gitlab.ourcompany.com but it is using https://10.1.3.3
NOTE: not our real ip address or host name:
Getting source from Git repository
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /builds/full-stack/apigw/.git/
fatal: unable to access 'https://10.1.2.3/full-stack/apigw.git/': SSL: no alternative certificate subject name matches target host name '10.1.2.3'
I found the answer after posting the question. Leaving both here for others.
It turns out that our gitlab.rb config file had the external_url set incorrectly. Here are the steps to change that:
/etc/gitlab/gitlab.rb
# other entries omitted for brevity
# was external_url 'https://10.1.2.3'
external_url 'https://gitlab.ourcompany.com'
Then reload your settings:
sudo gitlab-ctl reconfigure

How to import publicly available jelastic manifests from gitlab repositories in the jelastic dashboard?

I am currently transitioning from github to gitlab. Today, my code is present at both those locations. I have a jps manifest on github:
https://github.com/shopozor/services/blob/master/manifest.jps
and the very same manifest on gitlab:
https://gitlab.hidora.com/softozor/services/blob/master/manifest.jps
In the Jelastic dashboard, I am able to load my github manifest. However, I am not able to load my manifest versioned on gitlab:
What is the problem? Do I have to configure something special somewhere? Both manifests are publicly available. Why can't I import the gitlab manifest?
I also tried to use the raw manifest:
https://gitlab.hidora.com/softozor/services/raw/master/manifest.jps
and I've also tried to get the manifest file by means of the gitlab API, without success.
EDIT
I've tried to load this manifest. There we see that I am running a command
wget "${baseUrl}/jelastic/postgres/execCmdScript.sh" -O /var/lib/pgsql/script.sh 2>&1
In the jelastic console, that command raises the error
[07:56:54 Shopozor.cluster:2]: ERROR: cmd [sqldb: 62900].response: {" result": 4109," source": “JEL”," error": “The operation could not be performed. ”," errOut": ""," nodeid": 62900," exitStatus": 4," out": “--2020-03-27 07:56:53-- https://gitlab.hidora.com/softozor/services/raw/install-postgres-in-dedicated-env/jelastic/postgres/execCmdScript.sh\nResolving gitlab.hidora.com (gitlab.hidora.com)... 10.102.1.82\nConnecting to gitlab.hidora.com (gitlab.hidora.com)|10.102.1.82|:443... failed: Connection refused.”}
If I now take a computer which I never authenticated with on gitlab through ssh, and run that very same command, then it works. This is a bit strange, isn't it? What authentication does Jelastic need??? it's all public and available to anyone, except Jelastic?
After some more research, I was finally able to load my manifests from gitlab into jelastic. The problem is probably due to the gitlab configuration. Loading the jps from the gitlab repo doesn't work over https in the settings I have (which I haven't made myself, it's a CI / CD as a service). It works, however, over http.

Gitlab External IP on a local network

I have recently installed Gitlab on an internal server (192.168.0.XX). After installation I edit the Gitlab.rb file external_ip: 192.168.0.XX and I run the reconfigure file. However when I go to the address on the server I am not served with the Gitlab page. Am I doing something silly?
Don't be an idiot and have Apache running at the same time...

GitLab & GitLab CI WebHook Error

I'm running GitLab 7.11.4 and GitLab CI 7.11.4, both installed via the Omnibus package. I've been running GitLab for awhile now, but have only just recently enabled the CI service. I have successfully setup GitLab and CI so that they're accessible at [code.subdomain.com] and [ci.subdomain.com] respectively. I've followed the instructions to enable CI access for one specific project, I've setup a runner, and I've made one test shell script for building (Basically: cmake .. && make).
This is where I hit problems. I'm supposed to visit my GitLab project settings page and hit "Test settings". When I do this, I receive the error We tried to send a request to the provided URL but an error occured. gitlab-rails/production.log shows this:
==> /var/log/gitlab/gitlab-rails/production.log <==
Started GET "/[namespace]/[project]/services/gitlab_ci/test" for 127.0.0.1 at 2015-06-17 13:33:54 -0400
Processing by Projects::ServicesController#test as HTML
Parameters: {"namespace_id"=>"[namespace]", "project_id"=>"[project]", "id"=>"gitlab_ci"}
WebHook Error => getaddrinfo: Name or service not known
I've replaced [namespace] and [project] in that log, but they do show the correct entries.
GitLab CI never seems to receive the request and trying to do a test commit on my project also doesn't trigger GitLab CI.
I'm at a loss for what to do and can't seem to find any documentation on what might be causing this issue. Any help or direction is much appreciated.
Problem sort of solved. I had to add a loopback reference into /etc/hosts for ci.subdomain.com.
127.0.2.1 ci.subdomain.com ci
This seems like maybe something I shouldn't have to do if my DNS has properly published my domain? Maybe someone can clarify why this was required.

Resources