Add before field (Breaking)#1935
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1935 +/- ##
==========================================
+ Coverage 50.40% 50.56% +0.16%
==========================================
Files 384 384
Lines 41087 41169 +82
Branches 6749 7421 +672
==========================================
+ Hits 20709 20817 +108
+ Misses 19637 19605 -32
- Partials 741 747 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
7b30c90 to
43c63e6
Compare
pieqq
left a comment
There was a problem hiding this comment.
I tested it locally by butchering jobs in the client-cert-desktop-24-04-automated test plan and seeing what was happening, and it works as expected in my quick test.
If possible, add more warnings in the documentation about this field.
Hook25
left a comment
There was a problem hiding this comment.
See below, please consider not failing on missing job
Co-authored-by: Pierre Equoy <pierre.equoy@canonical.com>
b813416 to
b48f475
Compare
9afbad4 to
0b46b99
Compare
Co-authored-by: Pierre Equoy <pierre.equoy@canonical.com>
…nto add-before-field
pieqq
left a comment
There was a problem hiding this comment.
I left some inline comments regarding the documentation. It would be good if you took a look at it, but otherwise I think the feature works as expected.
I've done the following test, since we have an issue with debsum being run after a wireless test that modifies netplan config:
- Moved the
misc-client-cert-automatednested part in theclient-cert-desktop-24-04-automatedtest plan to the very end. This nested part includesmiscellanea/debsums. - Ran
checkbox-cli list-bootstrapped "com.canonical.certification::client-cert-desktop-24-04-automated" > /var/tmp/misc_np_at_the_end - Looked at the result, and indeed the jobs from that nested part are all towards the end, including the debsum job.
- Edited the
miscellanea/debsumsjob to addbefore: wireless/detect - Ran
checkbox-cli list-bootstrapped "com.canonical.certification::client-cert-desktop-24-04-automated" > /var/tmp/misc_np_at_the_end_before_field_added
Compared the two, and sure enough, all the jobs from the misc-client-cert-automated nested part are still at the end of the list, except miscellanea/debsums which sits just before wireless/detect. (this should fix our problem, so it means the feature works great! :)
Because of a bug in netplan[1], the miscellanea/debsums will fail if it's run after any of the wireless tests. Checkbox now supports the before field for job units[2]. Since wireless/detect is a dependency for all of the wireless tests, using it ensures the miscellanea/debsums job will be called before any wireless tests happen. [1]: https://bugs.launchpad.net/ubuntu/+source/netplan.io/+bug/2078759 [2]: #1935 Fix https://warthogs.atlassian.net/browse/CHECKBOX-1916
* First implementation of the before flag * Added DependencyMissingError * Added unit tests and made docstrings more clear * renamed before_references * Added test for multiple dependencies * Updated documentation * Fixed wrong arrow replacement * Added unittests for coverage * Fixed test typo * Added ordering metabox tests * Added after-suspend ordering test * updated documentation * Updated docstring * Some changes * Ignoring before and after refs for pulling * Moved dep types out of the error * Draft solution for Dep solver * Renamed color graph * Modified implementation * Refactored the dep manager * Apply suggestions from code review Co-authored-by: Pierre Equoy <pierre.equoy@canonical.com> * Fixed PR issues * Fixed error type for deps * Clarifying "before" behavior with after suspend flag * Added documentation changes * Update checkbox-ng/plainbox/impl/depmgr.py Co-authored-by: Pierre Equoy <pierre.equoy@canonical.com> * Added better debug for the ordering phase * Updated the documentation --------- Co-authored-by: Pierre Equoy <pierre.equoy@canonical.com>
* First implementation of the before flag * Added DependencyMissingError * Added unit tests and made docstrings more clear * renamed before_references * Added test for multiple dependencies * Updated documentation * Fixed wrong arrow replacement * Added unittests for coverage * Fixed test typo * Added ordering metabox tests * Added after-suspend ordering test * updated documentation * Updated docstring * Some changes * Ignoring before and after refs for pulling * Moved dep types out of the error * Draft solution for Dep solver * Renamed color graph * Modified implementation * Refactored the dep manager * Apply suggestions from code review Co-authored-by: Pierre Equoy <pierre.equoy@canonical.com> * Fixed PR issues * Fixed error type for deps * Clarifying "before" behavior with after suspend flag * Added documentation changes * Update checkbox-ng/plainbox/impl/depmgr.py Co-authored-by: Pierre Equoy <pierre.equoy@canonical.com> * Added better debug for the ordering phase * Updated the documentation --------- Co-authored-by: Pierre Equoy <pierre.equoy@canonical.com>
Description
This PR adds a new field called "before" to the jobs. This field allows a new type of dependency for the jobs.
The way the dependency manager sorts the jobs has not changed. Instead, the way the before flag works is by adding the current job as an after dependency of the jobs listed in the before field.
These references are added to the job object as a new attribute and included to the
after_depsset when retrieving the dependency set.Resolved issues
https://warthogs.atlassian.net/browse/CHECKBOX-1919
Documentation
The "before" flag has also been added to the corresponding section in the checkbox documentation.
Tests
Unit tests for this feature have been added In the PR