Commit 6787dfd7 authored by Jacob Vosmaer's avatar Jacob Vosmaer
Browse files

Add patch to allow custom working directories

parent 775551bd
diff --git a/lib/config.rb b/lib/config.rb
index eff6334..ab8ca35 100644
--- a/lib/config.rb
+++ b/lib/config.rb
@@ -1,6 +1,9 @@
require 'yaml'
+require 'optparse'
-ROOT_PATH = File.expand_path(File.join(File.dirname(__FILE__), ".."))
+# The default root path is the path where the gitlab-ci-runner source got
+# installed. This may be overridden by the OptionParser below.
+$root_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
module GitlabCi
class Config
@@ -23,7 +26,7 @@ module GitlabCi
end
def builds_dir
- @builds_path ||= File.join(ROOT_PATH, 'tmp', 'builds')
+ @builds_path ||= File.join($root_path, 'tmp', 'builds')
end
def write(key, value)
@@ -37,7 +40,13 @@ module GitlabCi
private
def config_path
- File.join(ROOT_PATH, 'config.yml')
+ File.join($root_path, 'config.yml')
end
end
end
+
+OptionParser.new do |opts|
+ opts.on('-CWORKING_DIRECTORY', 'Specify the working directory for gitlab-ci-runner') do |v|
+ $root_path = File.expand_path(v)
+ end
+end.parse!
......@@ -28,6 +28,10 @@ dependency "git"
source :git => "https://gitlab.com/gitlab-org/gitlab-ci-runner.git"
 
build do
# Patch the source code to allow for working directories other than
# /opt/gitlab-runner/embedded/service/gitlab-runner
patch source: 'working-directory-switch.diff'
env = with_standard_compiler_flags(with_embedded_path)
bundle "install --jobs #{workers} --path=#{install_dir}/embedded/service/gem", env: env
 
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment