Skip to content

Commit 3e670c4

Browse files
authored
Merge pull request #34 from github/kpaulisse-bootstrap-script-starts-with-slash
Allow bootstrap script to start with slash
2 parents 670e1b3 + 4e2a328 commit 3e670c4

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

lib/octocatalog-diff/catalog-util/bootstrap.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,11 @@ def self.git_checkout(logger, dir_opts)
116116
# @param opts [Hash] Directory options
117117
def self.install_bootstrap_script(logger, opts)
118118
# Verify that bootstrap file exists
119-
src = File.join(opts[:basedir], opts[:bootstrap_script])
119+
src = if opts[:bootstrap_script].start_with? '/'
120+
opts[:bootstrap_script]
121+
else
122+
File.join(opts[:basedir], opts[:bootstrap_script])
123+
end
120124
raise BootstrapError, "Bootstrap script #{src} does not exist" unless File.file?(src)
121125

122126
logger.debug('Begin install bootstrap script in target directory')

spec/octocatalog-diff/tests/catalog-util/bootstrap_spec.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,22 @@
145145
expect(File.file?(File.join(@dir, 'bootstrap_result.yaml'))).to eq(true)
146146
expect(File.file?(File.join(@dir2, 'bootstrap_result.yaml'))).to eq(true)
147147
end
148+
149+
it 'should run a bootstrap script specified as an absolute path' do
150+
logger, _logger_str = OctocatalogDiff::Spec.setup_logger
151+
opts = {
152+
bootstrapped_to_dir: @dir,
153+
bootstrapped_from_dir: @dir2,
154+
to_env: 'test-branch',
155+
from_env: 'master',
156+
basedir: File.join(@repo_dir, 'git-repo'),
157+
parallel: false,
158+
bootstrap_script: File.join(@repo_dir, 'git-repo', 'script', 'bootstrap.sh')
159+
}
160+
OctocatalogDiff::CatalogUtil::Bootstrap.bootstrap_directory_parallelizer(opts, logger)
161+
expect(File.file?(File.join(@dir, 'bootstrap_result.yaml'))).to eq(true)
162+
expect(File.file?(File.join(@dir2, 'bootstrap_result.yaml'))).to eq(true)
163+
end
148164
end
149165
end
150166
end

0 commit comments

Comments
 (0)