Skip to content

Commit

Permalink
chore: use a more structured YAML format (elastic#654) (elastic#665)
Browse files Browse the repository at this point in the history
* chore: use a more structurated YAML format

* feat: support setting target platform for the CI nodes

* fix: wrong item reference

* chore: move variable outside the loop

* fix: remove variable

* fix: use the proper entity to read the platforms
  • Loading branch information
mdelapenya authored Jan 26, 2021
1 parent 5a41538 commit 4d3c25b
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 48 deletions.
88 changes: 50 additions & 38 deletions .ci/.e2e-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,54 @@
---
SUITES:
- suite: "helm"
tags: "apm-server"
- suite: "helm"
tags: "filebeat"
- suite: "helm"
tags: "metricbeat"
- suite: "fleet"
tags: "agent_endpoint_integration"
platforms:
- "ubuntu-18.04"
scenarios:
- name: "APM Server"
tags: "apm-server"
- "Filebeat":
tags: "filebeat"
- "Metricbeat":
tags: "metricbeat"
- suite: "fleet"
tags: "stand_alone_agent"
- suite: "fleet"
tags: "fleet_mode_agent"
- suite: "metricbeat"
tags: "integrations && activemq"
- suite: "metricbeat"
tags: "integrations && apache"
- suite: "metricbeat"
tags: "integrations && ceph"
- suite: "metricbeat"
tags: "integrations && dropwizard"
- suite: "metricbeat"
tags: "integrations && envoyproxy"
- suite: "metricbeat"
tags: "integrations && etcd"
- suite: "metricbeat"
tags: "integrations && haproxy"
- suite: "metricbeat"
tags: "integrations && kafka"
- suite: "metricbeat"
tags: "metricbeat"
- suite: "metricbeat"
tags: "integrations && mysql"
- suite: "metricbeat"
tags: "integrations && oracle"
- suite: "metricbeat"
tags: "integrations && redis"
- suite: "metricbeat"
tags: "integrations && redisenterprise"
- suite: "metricbeat"
tags: "integrations && vsphere"
platforms:
- "ubuntu-18.04"
scenarios:
- name: "Fleet"
tags: "fleet_mode_agent"
- name: "Endpoint Integration"
tags: "agent_endpoint_integration"
- name: "Stand-alone"
tags: "stand_alone_agent"
- suite: "metricbeat"
platforms:
- "ubuntu-18.04"
scenarios:
- name: "ActiveMQ"
tags: "integrations && activeMQ"
- name: "Apache"
tags: "integrations && apache"
- name: "Ceph"
tags: "integrations && ceph"
- name: "Dropwizard"
tags: "integrations && dropwizard"
- name: "Envoy Proxy"
tags: "integrations && envoyproxy"
- name: "etcd"
tags: "integrations && etcd"
- name: "HAProxy"
tags: "integrations && haproxy"
- name: "Kafka"
tags: "integrations && kafka"
- name: "Metricbeat"
tags: "metricbeat"
- name: "MySQL"
tags: "integrations && mysql"
- name: "Oracle"
tags: "integrations && oracle"
- name: "Redis"
tags: "integrations && redis"
- name: "Redis Enterprise"
tags: "integrations && redisenterprise"
- name: "vSphere"
tags: "integrations && vsphere"
28 changes: 18 additions & 10 deletions .ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,13 @@ pipeline {
if (suitesParam == "") {
log(level: 'DEBUG', text: "Iterate through existing test suites")
existingSuites['SUITES'].each { item ->
checkTestSuite(parallelTasks, item.suite, item.tags)
checkTestSuite(parallelTasks, item)
}
} else {
log(level: 'DEBUG', text: "Iterate through the comma-separated test suites (${suitesParam}), comparing with the existing test suites")
suitesParam.split(',').each { suiteParam ->
existingSuites['SUITES'].findAll { suiteParam.trim() == it.suite }.each { item ->
checkTestSuite(parallelTasks, item.suite, item.tags)
checkTestSuite(parallelTasks, item)
}
}
}
Expand Down Expand Up @@ -251,13 +251,20 @@ pipeline {
}
}

def checkTestSuite(Map parallelTasks = [:], String suite, String tags) {
def regexps = [ "^e2e/_suites/${suite}/.*", "^.ci/.*", "^cli/.*", "^e2e/.*\\.go" ]
if ("${FORCE_SKIP_GIT_CHECKS}" == "true" || isGitRegionMatch(patterns: regexps, shouldMatchAll: false)) {
log(level: 'INFO', text: "Adding ${suite}:${tags} test suite to the build execution")
parallelTasks["${suite}_${tags}"] = generateFunctionalTestStep(suite: "${suite}", tags: "${tags}")
} else {
log(level: 'WARN', text: "The ${suite}:${tags} test suite won't be executed because there are no modified files")
def checkTestSuite(Map parallelTasks = [:], Map item = [:]) {
def suite = item.suite
def platforms = item.platforms
item.scenarios.each { scenario ->
def tags = scenario.tags
def regexps = [ "^e2e/_suites/${suite}/.*", "^.ci/.*", "^cli/.*", "^e2e/.*\\.go" ]
if ("${FORCE_SKIP_GIT_CHECKS}" == "true" || isGitRegionMatch(patterns: regexps, shouldMatchAll: false)) {
platforms.each { platform ->
log(level: 'INFO', text: "Adding ${platform}:${suite}:${tags} test suite to the build execution")
parallelTasks["${platform}_${suite}_${tags}"] = generateFunctionalTestStep(platform: "${platform}", suite: "${suite}", tags: "${tags}")
}
} else {
log(level: 'WARN', text: "The ${suite}:${tags} test suite won't be executed because there are no modified files")
}
}
}

Expand Down Expand Up @@ -300,12 +307,13 @@ def generateStep(Map args = [:]){
}

def generateFunctionalTestStep(Map args = [:]){
def platform = args.get('platform')
def suite = args.get('suite')
def sneakCaseSuite = suite.toUpperCase().replaceAll("-", "_")
def stackVersion = env."${sneakCaseSuite}_STACK_VERSION"
def tags = args.get('tags')
return {
node('ubuntu-18.04 && immutable && docker') {
node("${platform} && immutable && docker") {
try {
deleteDir()
unstash 'source'
Expand Down

0 comments on commit 4d3c25b

Please sign in to comment.