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

Fix jenkins agent check when build does not yet have results #1060

Merged
merged 3 commits into from
Aug 29, 2014
Merged

Fix jenkins agent check when build does not yet have results #1060

merged 3 commits into from
Aug 29, 2014

Conversation

jzoldak
Copy link
Contributor

@jzoldak jzoldak commented Jul 30, 2014

This includes a test (currently marked as expected to fail) which exposes the KeyError: 'result' error that has been reported in #567.

The logic of how highwater marks are done in the jenkins agent check is flawed:

  1. Jenkins will create build.xml files before the build is finished, which does not yet include the result in the XML. I have seen this on long-running matrix jobs. This will cause the agent to throw the KeyError, as shown in the testCheckWithRunningBuild added in this PR. Also the agent will already have set the highwater mark to that build, so its results will never be processed even after jenkins finishes and updates the build.xml file.
  2. Note also that for concurrent builds, if a build that started later finishes first then the agent will set the highwater mark at the timestamp of the later build and the earlier one will never be processed. I didn't write a test for that, but you can see it by reading through the jenkins.py code.

@jzoldak
Copy link
Contributor Author

jzoldak commented Jul 30, 2014

@remh you might be interested in this.

Also, looks like the Travis build failed due to unrelated causes - it seems like it couldn't start up couchdb as the service was already up.

@remh
Copy link
Contributor

remh commented Jul 30, 2014

Thanks a lot @jzoldak .
I'll review that really soon.

@jzoldak jzoldak changed the title Add tests for jenkins agent check Fix jenkins agent check when build does not yet have results Jul 30, 2014
@jzoldak
Copy link
Contributor Author

jzoldak commented Jul 30, 2014

@remh, cool thx.

I submitted a fix for the incomplete build.xml files and pushed. FWIW I've installed the new code on our prod jenkins server and it is working as expected and reporting in metrics correctly.

With regard to the 2nd problem noted above - I'm guessing that this agent was written before jenkins could do concurrent builds, so it assumes that builds will finish consecutively. Should I put in another issue for that, so we can get this one through first? I'm not sure I will have time to work on that thornier issue right now.

@remh
Copy link
Contributor

remh commented Aug 7, 2014

Thanks a lot @jzoldak !

The master branch is now frozen until release of Agent 5.0.0. We'll review and merge for the next release.

@remh remh added this to the 5.1.0 milestone Aug 7, 2014
@remh remh added the 1 - Ready label Aug 18, 2014
@remh remh merged commit bb6d840 into DataDog:master Aug 29, 2014
@remh
Copy link
Contributor

remh commented Aug 29, 2014

Closing in favor of #1068

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants