-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix wonky variable resolution in standalone pipeline scripts
- Loading branch information
Showing
5 changed files
with
56 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
buildSrc/src/main/groovy/com/widen/plugins/buildkite/PipelineScript.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.widen.plugins.buildkite | ||
|
||
import org.gradle.api.Project | ||
|
||
/** | ||
* Base class for scripts | ||
*/ | ||
abstract class PipelineScript extends Script { | ||
BuildkitePipeline pipeline | ||
BuildkitePlugin.Extension buildkite | ||
Project project | ||
|
||
Object getProperty(String property) { | ||
if ('buildkite' == property) { | ||
return buildkite | ||
} | ||
if ('project' == property) { | ||
return project | ||
} | ||
return pipeline.getProperty(property) | ||
} | ||
|
||
void setProperty(String property, Object newValue) { | ||
pipeline.setProperty(property, newValue) | ||
} | ||
|
||
Object invokeMethod(String name, Object args) { | ||
return pipeline.invokeMethod(name, args) | ||
} | ||
} |