Skip to content
This repository has been archived by the owner on May 12, 2018. It is now read-only.

Support for multiple runners #97

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

n-e-g
Copy link

@n-e-g n-e-g commented Aug 2, 2014

This patch allows multiple runners to build the same project in parallel,
as each runner has its own, dedicated directory for checking out and building the projects.

@jvanbaarsen
Copy link

@n-e-g Does that mean that people have to change their buildscripts?

@n-e-g
Copy link
Author

n-e-g commented Aug 3, 2014

No, that is not the point.
Currently runner did repo checkout in tmp/builds/project-X
When you run multiple runners, e.g. by changing RUNNERS_NUM=10 in gitlab-ci-runner,
each of these will checkout to the same directory.
All works fine when each runner is building different project. But when 2 runners build the same projects, they checkout project to the same directory, which causes problems (at least on my system).
I build the patch for myself that adds another level of directory structure.
The runner got irs number (0 by default), and each runner has its own build directory: tmp/builds/runner-R/project-X.
This prevents 2 runners to checkout different commits into the same directory.

All except directory structure works as previously, thus until some build script rely on the directory structure where true build is performed, no changes in build scripts are needed.

Btw, writing this comment reminds me that I have not introduced change to init scropt, which I will do in a minute.

@Wachiwi
Copy link
Contributor

Wachiwi commented Aug 5, 2014

👍 Can confirm this

@robodude666
Copy link

Ran across this exact issue the other day. Would be good to see this added in soon and released.

Combined with #98, we'd be able to configure the number of runners per machine without having to overwrite the default init.d script.

@n-e-g with your changes, how do the different runners show up in the runners web view? When I previously changed RUNNERS_NUM myself, it only showed one runner.

@n-e-g
Copy link
Author

n-e-g commented Aug 10, 2014

@robodude666 the runners share the same token so, from gitlab-ci they are seen as a single runner.

I also made some experiments with single token per-runner, but this change introduces many incompatibilities with existing scripts. (e.g. from bin dir.). Setup is more complex as well.
I have already tried multiple config.yml files (config-[runner-id].yml). I am also experimenting with multiple tokens in single config.yml file.

If there are any ideas how to deal with this, please make some suggestions.

@robodude666
Copy link

I was thinking about multiple workers again, and came across the following scenario:

What if the project's build script invokes Vagrant or Docker? You might end up running into issues if two of the same container are used at once, or if the same IP address is used at once in Vagrant, etc.

Easiest workaround is to always do vagrant up at the beginning of your script, and then vagrant destroy at the end; but then you're wasting a whole lot of time creating VMs are downloading packages, etc.

Alternatively, it can be put up to the user to ensure that a single worker is setup on a runner that's dedicated to the project.

@ayufan
Copy link
Member

ayufan commented Aug 12, 2014

Hey Guys, you maybe interested in: #99 and gitlabhq/gitlab-ci#462. It's still WIP, but very promising.

@agjmills
Copy link

👍 for this

@agjmills
Copy link

I have been using this as a patch for the last few days and it seems to work really well. Currently running 20 runners with one project, and a load of developers - seems to work well and I haven't had a problem with it

@ayufan
Copy link
Member

ayufan commented Oct 2, 2014

@randx Do you plan to merge it?

@Burstaholic
Copy link

👍 for this, multiple runners trying to build the same project is causing us many problems. It seems silly that you can only run one runner per machine or they step on each other.

More specifically, that this system cannot handle any project where new commits ever come in faster than the test suite can run.

@saily
Copy link

saily commented Nov 22, 2014

+1 for merge.
we're building Python buildouts with gitlab_ci_runner. we also ran into this.

@dosire
Copy link
Member

dosire commented Dec 5, 2014

@randx Can you have a look at this?

@dzaporozhets
Copy link
Member

@dosire yes but later

@dzaporozhets dzaporozhets self-assigned this Dec 5, 2014
@dosire
Copy link
Member

dosire commented Dec 5, 2014

@randx OK, thx

…into multiple-runners

Conflicts:
	lib/config.rb
@@ -26,7 +27,7 @@ def url
end

def builds_dir
@builds_path ||= File.join($root_path, 'tmp', 'builds')
@builds_path ||= File.join($root_path, 'tmp', 'builds', 'runner-' + @runner.to_s)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [87/80]
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just followed convention in the same file ...
See line below:
opts.on('-CWORKING_DIRECTORY', 'Specify the working directory for gitlab-ci-runner') do |v|

Anyway, I will fix single quotes

@vsizov
Copy link
Contributor

vsizov commented Apr 24, 2015

already implemented

@vsizov vsizov closed this Apr 24, 2015
@vsizov vsizov reopened this Apr 24, 2015
@vsizov
Copy link
Contributor

vsizov commented Apr 24, 2015

Oh, sorry. I misunderstood.

@vsizov
Copy link
Contributor

vsizov commented Apr 24, 2015

Currently we are considering to make GO runner official https://github.com/ayufan/gitlab-ci-multi-runner
It allows to run builds in parallel on the same machine.

@robodude666
Copy link

@vsizov 👍

The GO runner was much easier to install & setup. Would be cool to see if become the official runner, as it supports multiple operating systems, and even support configuring a multi-runner from GitLab CI.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.