Im working on adding code quality to gitlab.
one of the step requires making changes to config.toml.
I have .gitlab-ci.yml at root level of project repository.and pipeline picks up this file.
where do i define config.toml ? at root level or i need to create a new folder like
/etc/gitlab-runner/config.toml
The config.toml file is what configures a runner. You wouldn't have one unless you're running your own gitlab-runners, in which case it would be in /etc/gitlab/config.toml on the host running the runner. More information on Gitlab Runner and running it yourself is available here.
Related
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).
I want to create a very simple pipeline that will clone a repo from Github and then copy a JSON file to a directory. But there is a catch here and requires your guide if that is possible or not. It is on a Linux machine and the folder structure is like this:-
/var/www/myjenkins.com/
/var/www/myapi.com/html/json/
On my Linux machine, this Jenkin is running which is deployed on the location as /var/www/myjenkins.com/ and the new pipeline which I need to create in Jenkin has to perform the job of copying a JSON file (after git clone) to another location as /var/www/myapi.com/html/json/ which is out of root level of Jenkins. Is that really possible to traverse out of the root level of Jenkins then copy the file into another location?
Would be glad if you can advise on this. Thanks
I have Spring Boot 2 executable jar (runs by command java -jar myapp.jar) which I need to deploy to remote linux server as systemd service. Jenkins CI will manage building this jar from source and copy to proper location and restart java service associated with myapp.jar. Linux server has just one user 'jonas' with sudo privilege, in addition to jenkins user. Where do I need to put myapp.jar on linux server from security best practice point of view in production environment ? Possible location:
/var/myapplications/myapp.jar
/home/jona/myapplications/myapp.jar
/opt//myapplications/myapp.jar
Also where the log files generated by myapp.jar are going to be located?
Based on my experience, I would recommend to keep all third parties and applications under /opt/{{ app_name }}
You can follow if you like following structure which makes deployment of new artefacts much easier with option to quickly rollback if needed.
/opt/{{ app_name }}/releases/{{ app_version }}
/opt/{{ app_name }}/current <- Symlink to above
/opt/{{ app_name }}/current/logs <- directory for logs which would be part of the releases/{{ app_version }}
Your deployment script can create respective folders, manage permissions and symlinks for this purpose.
What i personally like is to make sure it runs under a non-privileged user with proper permissions to ensure only that particular user can read/execute/write on the directory recursively which would include logs which might have some sensitive information that might be included as part of the exception, however this purely depends on how you log.
We have Gitlab installed on the same server as a dev/staging copy of our test project. Two of us have local working copies with Gitlab as a remote, and are able to push/pull to Gitlab successfully. We also have Gitlab set as a remote in the staging copy of the project, and pulling from Gitlab works there manually as well.
However, when creating a custom hook for Gitlab (as described here), the hook simply fails to run with no errors. The content of the hook is:
#!/bin/bash
echo "Inside post_receive hook"
cd /path/to/staging/copy
git pull gitlab master
...where /path/to/staging/copy is the staging location of the project. Here's the ownership & permissions of the hook:
-rwxr-xr-x. 1 git git 114 Mar 30 10:28 post_receive
When pushing from my working copy to Gitlab, this hook should run, but it doesn't -- the staging copy is not updated, the echo message isn't shown, and the push results message doesn't show any errors.
I have tried a few tips from SO answers regarding setting/unsetting environment variables, and they didn't help. I'm out of ideas. Does anyone know why the custom hook isn't running?
Of course, this was my fault. I mis-named the hook with an underscore instead of a dash. Hook now fires appropriately.
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.