-
Notifications
You must be signed in to change notification settings - Fork 13
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!: protect against stale queue items #292
Conversation
This should allow the worker to invalidate stale queued builds. A stale build is a build that was queued before a Vela upgrade or downgrade if the two Vela versions do not share the same queue ItemVersion.
Make it clear that this is not the Vela version or the pipeline yaml version.
Codecov Report
@@ Coverage Diff @@
## main #292 +/- ##
=======================================
Coverage 97.00% 97.00%
=======================================
Files 59 59
Lines 6545 6546 +1
=======================================
+ Hits 6349 6350 +1
Misses 145 145
Partials 51 51
|
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, that will make future updates a lot smoother.
should we mark this as breaking?
It's difficult to say if it is breaking or not. I added the |
// The 0-value is the implicit ItemVersion for queued Items that pre-date adding the field. | ||
ItemVersion uint64 `json:"item_version"` |
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.
NB: This is downgrade safe because if a json object has an unknown field, it is ignored.
Part of go-vela/community#811
Blocks: go-vela/worker#478
This adds an
ItemVersion
field toItem
with anItemVersion
constant that should be bumped whenever we make significant changes toItem
or thepipeline.Build
. This way, the worker can detect any stale builds that were queued before a Vela server upgrade or downgrade, and fail the build.In the future, we could do something even nicer and ask the server to recompile and requeue the build.