Skip to content

Commit

Permalink
Move BUILDKITE_BUILDER_PIPELINE_PATH override as part of command abst…
Browse files Browse the repository at this point in the history
…ract (#110)

* Move BUILDKITE_BUILDER_PIPELINE_PATH override as part of command abstract

* Bump version
  • Loading branch information
tubaxenor authored Jan 30, 2024
1 parent b875cf5 commit deedcfb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### 4.8.0
* Move `BUILDKITE_BUILDER_PIPELINE_PATH` override as part of command abstract.

### 4.7.0
* Remove warning of method redefined.

### 4.6.0
* Remove `capture` concept on `Buildkite::Pipelines::Command#run` and replaced with `Buildkite::Pipelines::Command::Result` object to represent `Open3.capture3` result.

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.7.0
4.8.0
8 changes: 8 additions & 0 deletions lib/buildkite/builder/commands/abstract.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def log

def pipeline_path
@pipeline_path ||=
find_root_by_env_path ||
find_root_by_main_pipeline ||
find_root_by_multi_pipeline
end
Expand All @@ -103,6 +104,13 @@ def find_root_by_multi_pipeline
end
end
end

def find_root_by_env_path
if ENV['BUILDKITE_BUILDER_PIPELINE_PATH']
path = Pathname.new(ENV['BUILDKITE_BUILDER_PIPELINE_PATH'])
path.absolute? ? path : Builder.root.join(path)
end
end
end
end
end
Expand Down
13 changes: 0 additions & 13 deletions lib/buildkite/builder/commands/run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,6 @@ def run
Pipeline.new(pipeline_path, logger: log).upload
end
end

private

def pipeline_path
pipeline_path_override || super
end

def pipeline_path_override
if ENV['BUILDKITE_BUILDER_PIPELINE_PATH']
path = Pathname.new(ENV['BUILDKITE_BUILDER_PIPELINE_PATH'])
path.absolute? ? path : Builder.root.join(path)
end
end
end
end
end
Expand Down

0 comments on commit deedcfb

Please sign in to comment.