Skip to content

Commit

Permalink
as suggested in the code review
Browse files Browse the repository at this point in the history
Mage will be the way to go in the future, for such let's search for x-pack in the directory parameter or target (target is a bit more complex as it support more values than the folder only)
  • Loading branch information
v1v committed May 29, 2020
1 parent c64efcc commit a449455
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ def makeTarget(Map args = [:]) {
def clean = args.get('clean', true)
def withModule = args.get('withModule', false)
withGithubNotify(context: "${context}") {
withBeatsEnv(archive: true, withModule: withModule, modulePattern: env.OSS_MODULE_PATTERN) {
withBeatsEnv(archive: true, withModule: withModule, modulePattern: getModulePattern(target)) {
whenTrue(params.debug) {
dumpFilteredEnvironment()
dumpMage()
Expand All @@ -795,7 +795,7 @@ def mageTarget(Map args = [:]) {
def target = args.target
def withModule = args.get('withModule', false)
withGithubNotify(context: "${context}") {
withBeatsEnv(archive: true, withModule: withModule, modulePattern: env.XPACK_MODULE_PATTERN) {
withBeatsEnv(archive: true, withModule: withModule, modulePattern: getModulePattern(directory)) {
whenTrue(params.debug) {
dumpFilteredEnvironment()
dumpMage()
Expand All @@ -815,7 +815,7 @@ def mageTargetWin(Map args = [:]) {
def target = args.target
def withModule = args.get('withModule', false)
withGithubNotify(context: "${context}") {
withBeatsEnvWin(withModule: withModule, modulePattern: env.XPACK_MODULE_PATTERN) {
withBeatsEnvWin(withModule: withModule, modulePattern: getModulePattern(directory)) {
whenTrue(params.debug) {
dumpFilteredEnvironment()
dumpMageWin()
Expand All @@ -829,6 +829,11 @@ def mageTargetWin(Map args = [:]) {
}
}

def getModulePattern(String toCompare) {
// Use contains to support the makeTarget(target: '-C <folder>') while mageTarget(directory: '<folder>')
return (toCompare.contains('x-pack') ? env.XPACK_MODULE_PATTERN : env.OSS_MODULE_PATTERN)
}

def withBeatsEnv(Map args = [:], Closure body) {
def archive = args.get('archive', true)
def withModule = args.get('withModule', false)
Expand Down

0 comments on commit a449455

Please sign in to comment.