-
Notifications
You must be signed in to change notification settings - Fork 520
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
updata: Update metadata generation tool #265
Conversation
ecff12c
to
6c7fe75
Compare
Chasing up some loose ends but this is largely sane enough now to use for metadata creation. |
Added |
f6efbe9
to
bbcc4f3
Compare
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.
The only remaining comment from before is using log
constructs like info!
instead of prints :)
Signed-off-by: Samuel Mendoza-Jonas <[email protected]>
From: iliana destroyer of worlds <[email protected]> Signed-off-by: Samuel Mendoza-Jonas <[email protected]>
Updated, had to rebase again unfortunately to catch the logging updates. |
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, thanks! A couple suggestions left but nothing major.
Dropped the |
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.
updata looks fine to me, just some nits.
impl<'de> Deserialize<'de> for Version { | ||
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error> | ||
where | ||
D: Deserializer<'de>, | ||
{ | ||
let input = String::deserialize(deserializer)?; | ||
let version = Version::from_str(&input) | ||
.map_err(|e| D::Error::custom(format!("Invalid datastore version: {}", e)))?; | ||
Ok(version) | ||
} | ||
} | ||
|
||
impl Serialize for Version { | ||
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> | ||
where | ||
S: Serializer, | ||
{ | ||
serializer.serialize_str(&format!("{}.{}", self.major, self.minor)) | ||
} | ||
} |
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.
serde_plain has macros to do effectively this.
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.
I've discovered derive_deserialize_from_str!()
and my life is transformed, but deriving the serialization side doesn't look as easy because data_store_version's implementation of Display uses the "vX.Y" format, not "X.Y", and I think we have uses for the former format elsewhere.
workspaces/updater/updog/Cargo.toml
Outdated
[[bin]] | ||
name = "updog" | ||
path = "src/main.rs" | ||
|
||
[[bin]] | ||
name = "updata" | ||
path = "src/create.rs" |
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.
I'd prefer we drop these sections from Cargo.toml and instead have src/main.rs for updog (this is automatic) and src/bin/updata.rs for updata.
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.
Why that layout? If you want updog to be the default just because it's the updog package and don't want to separate them, Cargo supports setting a default binary now.
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.
I don't care if there's a default binary, I just don't expect a binary named "updata" to be created from "create.rs".
Signed-off-by: Samuel Mendoza-Jonas <[email protected]>
Add the set-max-version command to update the maximum version field across all updates in the manifest, optionally filtering by arch and flavor. Signed-off-by: Samuel Mendoza-Jonas <[email protected]>
If a removed update was the final reference to a datastore version and --cleanup is set, remove that version:datastore mapping from the manifest. Signed-off-by: Samuel Mendoza-Jonas <[email protected]>
Include `add-mapping` to manually insert a image-version:datastore-version mapping. This is helpful in particular for adding a mapping for images that may be running but not in the update manifest. Signed-off-by: Samuel Mendoza-Jonas <[email protected]>
Use checked_sub() instead of casting the difference between the end and start of the wave. This avoids a potential underflow that could cause Updog to jitter itself to a point very far in the future. Fixes #447 Signed-off-by: Samuel Mendoza-Jonas <[email protected]>
Before committing changes to wave metadata check that each successive wave occurs after the previous one. Fixes #447 Signed-off-by: Samuel Mendoza-Jonas <[email protected]>
Update all users of the semver and data_store_version crates to consitently refer to them as "SemVer" and "DataVersion" respectively. Also includes some small fixups to Updata, including: - Allow --max-version to be optional and implicitly set - Display changes to max version - Error if migration marked for removal doesn't exist Signed-off-by: Samuel Mendoza-Jonas <[email protected]>
Add the appropriate impls for data_store_version, removing the need for doing it "manually" in update_metadata. Signed-off-by: Samuel Mendoza-Jonas <[email protected]>
Updated to call updata updata, and simplified the deserialize side of data_store_version. |
Signed-off-by: iliana destroyer of worlds <[email protected]>
updog: Fix Cargo.toml rebase (#265)
Issue #, if available:
#447
Description of changes:
Add a binary to Updog, "updata", which can generate and validate update manifest files. Along with
tuftool
this can be used to deploy an update.For example, add an update:
Add a wave:
Add a migration:
This also addresses #447 by validating the ordering of wave timestamps at the time they are added.
Tested by creating metadata files, validating them via Updata and against working examples, and using Updata to deploy the last few updates.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.