screwdriver-executor-router
Advanced tools
Comparing version 1.1.1 to 1.2.0
26
index.js
@@ -59,3 +59,7 @@ 'use strict'; | ||
name: 'weighted', | ||
check: () => this.getWeightedExecutor(this._executors) | ||
check: buildConfig => { | ||
const allowedExecutors = this.checkExclusions(this._executors, buildConfig.container); | ||
return this.getWeightedExecutor(allowedExecutors); | ||
} | ||
}, | ||
@@ -98,2 +102,22 @@ { | ||
/** | ||
* Checks if executor is excluded for a container. | ||
* @method checkExclusions | ||
* @param {Array} executors | ||
* @param {String} container | ||
*/ | ||
checkExclusions(executors, container) { | ||
return executors.filter(executor => { | ||
const { exclusions } = executor; | ||
if (!exclusions) return true; | ||
return !exclusions.some(item => { | ||
const regEx = new RegExp(item, 'gi'); | ||
return container.match(regEx); | ||
}); | ||
}); | ||
} | ||
/** | ||
* Evaluates the executor rules by priority and returns the first matching executor | ||
@@ -100,0 +124,0 @@ * @method getExecutor |
{ | ||
"name": "screwdriver-executor-router", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "A generic plugin for routing builds to specified executors", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11584
148