Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only run xpack siem cypress in PRs when there are siem changes #60661

Merged
merged 10 commits into from
Mar 23, 2020
9 changes: 8 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ kibanaLibrary.load()
kibanaPipeline(timeoutMinutes: 135, checkPrChanges: true) {
githubPr.withDefaultPrComments {
catchError {
whenChanged(/^vars\//) {
print "Testing"
}

retryable.enable()
parallel([
'kibana-intake-agent': workers.intake('kibana-intake', './test/scripts/jenkins_unit.sh'),
Expand Down Expand Up @@ -40,7 +44,10 @@ kibanaPipeline(timeoutMinutes: 135, checkPrChanges: true) {
'xpack-ciGroup9': kibanaPipeline.xpackCiGroupProcess(9),
'xpack-ciGroup10': kibanaPipeline.xpackCiGroupProcess(10),
'xpack-accessibility': kibanaPipeline.functionalTestProcess('xpack-accessibility', './test/scripts/jenkins_xpack_accessibility.sh'),
'xpack-siemCypress': kibanaPipeline.functionalTestProcess('xpack-siemCypress', './test/scripts/jenkins_siem_cypress.sh'),
'xpack-siemCypress': {
whenChanged(/^x-pack\/legacy\/plugins\/siem\//, kibanaPipeline.functionalTestProcess('xpack-siemCypress', './test/scripts/jenkins_siem_cypress.sh'))
},

// 'xpack-visualRegression': kibanaPipeline.functionalTestProcess('xpack-visualRegression', './test/scripts/jenkins_xpack_visual_regression.sh'),
]),
])
Expand Down
9 changes: 7 additions & 2 deletions vars/prChanges.groovy
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
public static @Field PR_CHANGES_CACHE = null
spalger marked this conversation as resolved.
Show resolved Hide resolved

def getSkippablePaths() {
return [
Expand Down Expand Up @@ -36,9 +37,13 @@ def areChangesSkippable() {
}

def getChanges() {
withGithubCredentials {
return githubPrs.getChanges(env.ghprbPullId)
if (!PR_CHANGES_CACHE && env.ghprbPullId) {
withGithubCredentials {
PR_CHANGES_CACHE = githubPrs.getChanges(env.ghprbPullId)
}
}

return PR_CHANGES_CACHE
}

def getChangedFiles() {
Expand Down
19 changes: 19 additions & 0 deletions vars/whenChanged.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
def call(String regex, Closure closure) {
spalger marked this conversation as resolved.
Show resolved Hide resolved
if (!githubPr.isPr()) {
return closure()
}

print "Checking PR for changes that match: ${regex}"

def files = prChanges.getChangedFiles()
def hasMatch = !!files.find { file -> file =~ regex }

if (hasMatch) {
print "Changes found, executing pipeline."
closure()
} else {
print "No changes found, skipping."
}
}

return this
1 change: 1 addition & 0 deletions x-pack/legacy/plugins/siem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

// TODO remove me
import { i18n } from '@kbn/i18n';
import { resolve } from 'path';
import { Server } from 'hapi';
Expand Down