-
Notifications
You must be signed in to change notification settings - Fork 438
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
Run tests for integrations in parallel #421
Conversation
@kuisathaverat I'm trying to build and test integrations in parallel, but unfortunately the pipeline fails with the following error:
For reference: I'm not quite sure if it started failing after the weekend outage. I would appreciate if you can provide me some guidance here. |
I think I went further, just need to select the correct host labels. |
.ci/Jenkinsfile
Outdated
''') | ||
integrations["${it}"] = { | ||
env.NODE_LABELS = "master linux x86_64" | ||
node { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
node { | |
node('ubuntu-18 && immutable') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me try this one...
.ci/Jenkinsfile
Outdated
../../build/elastic-package test -v --report-format xUnit --report-output file | ||
''') | ||
integrations["${it}"] = { | ||
env.NODE_LABELS = "master linux x86_64" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure what this for
env.NODE_LABELS = "master linux x86_64" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Firstly it complained about arch, then os and then missing Go runtime. I will try your suggestion with node('ubuntu-18 && immutable')
Ok, it looks like I hit this bug (or feature request): https://issues.jenkins.io/browse/JENKINS-55438 |
Sample pipeline with a failed test (on purpose): https://beats-ci.elastic.co/blue/organizations/jenkins/Ingest-manager%2Fintegrations/detail/PR-421/26/pipeline/184/ |
jenkins run the tests please |
7857fbe
to
440e096
Compare
UpdatePackageStorage tested (works): https://beats-ci.elastic.co/blue/organizations/jenkins/Ingest-manager%2Fintegrations/detail/PR-421/31/pipeline/3148 |
@ycombinator This PR is finally ready for review. Please take a look at it if you're free. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is amazing - comparing the latest CI run for this PR with a master
branch CI run, looks like we save almost 3 minutes overall! And that's despite the fact that we now have to start the Elastic Stack on each parallel node (if necessary), which takes about 2m.
It would be nice if someday in the future we could share the Elastic Stack amongst the parallel steps but I don't know enough about Jenkins networking to know if this would be possible or how complex it might be. Anyway, this is something for later. Already with this PR, as we add more integrations packages, we're going to start seeing benefits!
dir("${BASE_DIR}/packages/${it}") { | ||
sh(label: "Check integration: ${it}", script: '../../build/elastic-package check -v') | ||
def r = sh(label: "Find test folders", script: 'find . -d -name test | grep .', returnStatus: true) | ||
if (r == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: IDK enough Groovy but if you could invert this condition and return early that would be nice for extra readability but also not absolutely required at this time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a short code block, let's leave it as is, but thanks for the suggestion!
try { | ||
dir("${BASE_DIR}/packages/${it}") { | ||
sh(label: "Check integration: ${it}", script: '../../build/elastic-package check -v') | ||
def r = sh(label: "Find test folders", script: 'find . -d -name test | grep .', returnStatus: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a comment here explaining why you're doing this? I know you explained this in the PR description but a comment would help anyone in the future looking at this code without having to look up the PR for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
What does this PR do?
This PR modifies the Jenkins pipeline configuration to dynamically create stages and run integration tests in parallel. I'll leverage from this one while working on the #370 , so I won't break the pipeline for other packages (at some point in time Metricbeat will start publishing metrics under a new key).
Still TODOs:
How to test this PR locally
The CI builder will verify it.
Related issues