GitLab's runner without GitLab local installation - gitlab

Is it possible to use runner with project stored on GitLab.com?
Documentation says I need an 'admin' account in order to register a runner. On GitLab.com I can only set a 'Maintainer'. Beside that, it also says not to install runners on the same machine where GitLab is installed...

Related

Gitlab No repository

Gitlab all of sudden showing no repository message on different repo. I am using docker-compose to run docker ce. I can see on file system on host machine as well as on docker container repository contain data in #hashed folder. I am able to see my ci/cd pipeline and images in container registry. but I am not able to see all my source code in repository. I have try clearing cache and run the gitlab reconfigure command. but not solve the issue.
can anyone know what could be the reason of this kind of behavior.

Replicate GitLab CI & Runner Functionality Locally?

In absence of network, on-site we can commit to local git repo but can't have gitlab-ci to compile project and early trobuleshoot.
How to have a localized gitlab-ci and gitlab-runner which can compile commits offline (*or alternate means) ?
The gitlab runner has an exec command which allows you to run the gitlab runner on your local machine with your local .gitlab-ci.yml configuration file.
This command allows you to run builds locally, trying to replicate the CI
environment as much as possible. It doesn't need to connect to GitLab, instead
it reads the local .gitlab-ci.yml and creates a new build environment in
which all the build steps are executed.
Though if local network troubles are often you may consider installing the gitlab on premises and connect your own local gitlab runner to it so the work is automated.

GitLab CI builds remains pending

We recently started to use GitLab-CI on the gitlab.com free service.
At first everything went fine, but now, seems like we can't build our project anymore. The builds are shown as pending and doesn't do anything.
Here's what we have in our builds list:
And if we check the details of a build:
As you might notice, in the list, each build is assigned to a runner id, but in the details page, the runner section is blank.
At first, we thought it was just latency caused by gitlab.com ingrastructure, but it's really just stuck there...
EDIT
It's more than 1 year ago but I keep having notifications about this question. If I recall properly, the problem was due to GitLab itself. Follow the GitLab docs and make sure your setup is valid, and hope for the best !
If you are working with local gitlab-runner, like macOS or custom runner that you have been made, you should start running jobs manually.
Based on this topic on gitlab documentation you should start manually in user-mode or system-mode based on where you executing this command
Run in terminal
If you did not started gitlab-runner yet
gitlab-runner start
system-mode execution
sudo gitlab-runner run
user-mode execution
gitlab-runner run
I was stuck into same issue on my windows machine. I went to event viewer to get some logs of the service and found the error "listen_address not defined".
I followed below steps to fix it.
Go to gitlab repository and edit the runner settings.
You will find checkbox named "Indicates whether this runner can pick jobs without tags"
Make sure the option is checked.
It works for me now.
My problem was solved after doing the following steps:
Go to your project repository, click on CI/CD and then select pipelines. Try removing the runner cache by clicking on clear runner caches.
Verify, start and run your local runners by the doing the following steps on the server you have registered your runners:
sudo gitlab-runner verify
sudo gitlab-runner start
sudo gitlab-runner run
GitLab maxed out their shared runners but they have just finished adding more of them. Now GitLab has 12 shared runners. Take a look at this issue: https://gitlab.com/gitlab-org/gitlab-foss/issues/5543#note_3130561
Update
GitLab has moved to auto scaling Runners. If you're still hitting any issues it might be due to a different cause.
Try to clear the Runner cache if you have set it up.
Goto CI/CD>>Pipelines>>on top side >> clear Runner Caches
For me, this workaround worked: Pausing and unpausing the runner triggers the pending job to run.
Reference: https://gitlab.com/gitlab-org/gitlab/-/issues/23401
I had the same issue because there were no active runners.
Go to settings > CI CD > Enable shared runners for this project

Migrate repos between instances of Gitlab

Due to my old installation of Gitlab being too difficult to upgrade (Thread on TKL support forums: http://www.turnkeylinux.org/forum/support/20120913/upgrading-gitlab ), I have downloaded the current TKL Gitlab distro, and followed Gitlabs standard upgrade path so that I now have a fully upgraded Gitlab 6.1 installation running with TKLBAM and all that good stuff. So far so good.
But, it turns out that our old version of gitlab does not give HTTP urls to repos, so that means that I can't use the "Import existing repository" function in Gitlab 6.1
I know that i can simply copy the old Git repositories from the old VM to the new one, but how can I make these repositories visible in Gitlab on the new VM?
I recently migrated from gitolite to gitlab and the official rake task gitlab:import:repos worked for me. I am using gitlab 6.1.0 (82f3446). Here is what I did:
rsync bare repos from gitolite to repositories/{group}/. Make sure to replace {repository} with the name of the gitolite repo, and change the hostname of your gitlab server.
rsync -rth --progress repositories/{repository}.git \
git#gitlab-server:/home/git/repositories/{group}/
Here, {group} is the name of the user group you want the repository to be added to. If you don't have any specific group, choose root as the group name.
Fix permissions – only necessary when the rsync user is not git:
sudo chown -R git:git repositories/{group}/
cd ~/gitlab
Run the rake task to import all new repositories:
bundle exec rake gitlab:import:repos RAILS_ENV=production
Now if you login as Administrator you will find the new project added.
For more information, refer to the "Import bare repositories into GitLab project instance" under http://{your-gitlab-server}/help/raketasks.
In your case, you can login to your old TKL system and rsync all bare repos to the new instance, followed by an import.
One option would be to:
Clone the old repo from gitlab onto a dev machine.
Create a blank repo on the new gitlab.
Add the new repo as a remote on the dev machine.
Push everything back to the new repo.
Remove the old repo from remote repos list.
To create a remote called newRepo, do: git remote add newRepo gitlab.localhost.com:User/newRepo.git (replace the url on the end with the one for your repo)
I did it practically the following way after reading ChrisA answer, which gave me a little headache about how to do it practically. The example copies a repo from github to gitlab, to make source and destination a little bit clearer.
Clone the old repo from github onto a dev machine (which creates a bare repo):
$ git clone --mirror git#github.com:me/myrepo.git
Create a blank repo on the new gitlab.
Add the new repo as a remote on the dev machine.
$ cd myrepo.git
$ git remote add newRepo git#gitlab.com:me/myrepo.git
Push everything back to the new repo.
$ git push --mirror newRepo
That's it.
This way it copied all branches and tags to the new destination.
You can now remove the cloned bare repo from your dev machine.
If your Gitlab is >= 8.9, then you can use export/import to migrate repos.
Since GitLab 13.8 (January 2021), you now have:
Migrate Groups directly between instances
A faster and easier way to migrate your GitLab Groups is on the way.
Group Migration is a new feature that lets you copy a GitLab Group from one instance to another directly, without having to export and import any files.
In this release, we migrate only the Group object with basic fields.
We plan to follow up with more and more fields and related objects until all relevant data in a Group is migrated in this easy-to-use fashion.
See Documentation and Epic.

how to create a virtual copy of git repo on a test server

I am fairly new to Git. I have worked locally, but today i need to setup a remote machine with the git. I have no idea how.
Basically my setup is like this.
I have a windows machine which has a vmware player installed, which is used to connect to the dev ubuntu linux machine where out Git repo is situated. I putty to the dev machine and do all the operation related to git with username common to all the developers username : dev
Now there is a new rollup that is created in the dev git repo which is required to be deployed on our ubuntu linux test server. I have my account in test server. username:ash.
What are the steps that should be followed to setup this. I have some time back had a discussion with one of my colleague who had shared about using SSH key. As he is the only contact person who is not available, I have no info how to proceed. I have created the SSH key.
login to the machine as "ash".
ash#gitserver:~$
create a new directory that will contain the git-repository
ash#gitserver:~$ mkdir rollout.git
change into the directory
ash#gitserver:~$ cd rollout.git
initialize the git repository
ash#gitserver:~/rollout.git$ git init --bare
go back to your dev machine and clone the newly created repository or add it to the "remote"s of an existing git repo. use "ssh://ash#gitserver/~/rollout.git" as the remote-url.
[update for cloning]: make sure that there is not already a "rollout" directory in the directory where you want to clone to. for simplicity, create an empty directory "foo/" and try to clone into that directory. you can then move the cloned repository to wherever you want to.
push changes to the new repository.......done!
the use of ssh-keys will make authentication simpler and/or more secure but is in no ways necessary (or related) to setting up the git repository.

Resources