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

feat: add a new step to run the e2e tests for certain parts of Beats #21100

Merged
merged 21 commits into from
Oct 6, 2020
Merged
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .ci/packaging.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ pipeline {
deleteDir()
release()
pushCIDockerImages()
runE2ETestForPackages()
}
}
}
Expand Down Expand Up @@ -209,6 +210,22 @@ def tagAndPush(name){
}
}

def runE2ETestForPackages(){
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are running the tests too early. Let me explain: as we are building different projects in parallel (i.e. metricbeat and filebeat) it could be possible that if the filebeat build is faster, then it reaches the e2e tests stage when the filebeat one has not created its artifacts. Therefore the e2e tests could potentially fail.

I could see it valid to run the e2e tests right after the release stage, so we ensure all artifacts are there. On the other hand, the tests won't be run until the slowest build hadn't finished.

As we discussed, it could be great to decide what to build in an earlier stage, something like prepareBuildContext or similar, where we calculate what to build to be tested.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the step pushCIDockerImages() is finish the packages are generated and deployed, I not get your concern.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the pushCIDockerImages method is executed per BEATS_FOLDER, so in the context of BEATS_FOLDER=filebeat it will push the images for filebeat, only. And maybe we want to test the metricbeat ones too (i.e. elastic-agent starting both processes)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is part of the dependencies of the elastic agent, What are the conditions that define if we have to test Filebeat, Metricbeat, or both?

  • If there are changes in Metricbeat Should we test the Elastic Agent? Should we test Elastic Agent+Filebeat?
  • If there are changes in Filebeat Should we test the Elastic Agent? Should we test Elastic Agent+Metricbeat?
  • If there are changes in Elastic Agent Should we test the Elastic Agent+Filebeat+Metricbeat?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If those are direct dependencies then

beats/Jenkinsfile

Lines 1364 to 1381 in d2a8922

def getProjectDependencies(beatName){
def os = goos()
def goRoot = "${env.WORKSPACE}/.gvm/versions/go${GO_VERSION}.${os}.amd64"
def output = ""
withEnv([
"HOME=${env.WORKSPACE}/${env.BASE_DIR}",
"PATH=${env.WORKSPACE}/bin:${goRoot}/bin:${env.PATH}",
]) {
output = sh(label: 'Get vendor dependency patterns', returnStdout: true, script: """
go list -deps ./${beatName} \
| grep 'elastic/beats' \
| sed -e "s#github.com/elastic/beats/v7/##g" \
| awk '{print "^" \$1 "/.*"}'
""")
}
return output?.split('\n').collect{ item -> item as String }
}
could be the one to define that particular workflow for the packaging.

Otherwise, where those dependencies are defined?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think they are defined yet. I did a best effort here: elastic/e2e-testing#309 (comment)

catchError(buildResult: 'UNSTABLE', message: 'Unable to run e2e tests', stageResult: 'FAILURE') {
if ("${env.BEATS_FOLDER}" == "filebeat") {
echo('Triggering E2E tests for filebeat-oss. Test suite: helm:filebeat & ingest-manager')
} else if ("${env.BEATS_FOLDER}" == "metricbeat"){
echo('Triggering E2E tests for metricbeat-oss. Test suite: helm:metricbeat && ingest-manager && metricbeat')
} else if ("${env.BEATS_FOLDER}" == "x-pack/elastic-agent") {
echo('Triggering E2E tests for elastic-agent. Test suite: ingest-manager')
} else if ("${env.BEATS_FOLDER}" == "x-pack/filebeat"){
echo('Triggering E2E tests for filebeat. Test suite: helm:filebeat & ingest-manager')
} else if ("${env.BEATS_FOLDER}" == "x-pack/metricbeat"){
echo('Triggering E2E tests for metricbeat. Test suite: helm:metricbeat && ingest-manager && metricbeat')
}
}
}

def release(){
withBeatsEnv(){
dir("${env.BEATS_FOLDER}") {
Expand Down