From dc08a540dfd6ba534d6da64724b6f10aa4f4b310 Mon Sep 17 00:00:00 2001 From: Grigouze Date: Sun, 3 Dec 2017 16:32:10 +0100 Subject: [PATCH] Works if a repo is checked out in subdirectory You have to specify an env variable GIT_LOCAL_SUBDIRECTORY in jenkins for your job. It also can br used in Git section to not repeat yourself --- lib/build_participant.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/build_participant.rb b/lib/build_participant.rb index ed388f2..d1fd615 100644 --- a/lib/build_participant.rb +++ b/lib/build_participant.rb @@ -32,8 +32,16 @@ def warn(line) def run(command, opts = {}) info "running command #{command.inspect} with opts #{opts.inspect}" + default_dir = build.workspace.realpath + + native = build.send(:native) + env = native.getEnvironment + if env.has_key?('GIT_LOCAL_SUBDIRECTORY') + default_dir += '/' + env['GIT_LOCAL_SUBDIRECTORY'] + end + # Set the repo directory and process streams - opts[:chdir] ||= build.workspace.realpath + opts[:chdir] ||= default_dir opts[:out] ||= StringIO.new opts[:err] ||= StringIO.new if stdin_str = opts.delete(:stdin_str)