-
Notifications
You must be signed in to change notification settings - Fork 26
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
twoliter: Remove Release.toml from variant build #112
twoliter: Remove Release.toml from variant build #112
Conversation
e1686f2
to
3ce1844
Compare
Rebase me! |
3ce1844
to
d2dbe85
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.
Can't comment on twoliter/src/cmd/new.rs
which appears to be extraneous in this PR.
twoliter/src/variant.rs
Outdated
serde_json::from_str::<Value>( | ||
&exec( | ||
Command::new("cargo").args([ | ||
"metadata", |
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.
@bcressey we discussed a few ideas about where we should put image (i.e. variant) versions. There could be a single one for all variants in Twoliter.toml, variants could be enumerated and versioned in Twoliter.toml, we could put it in the variant's custom Cargo.toml metadata...
Here we are using the actual cargo package version as the variant's version. What do you think?
Note, we are doing this now to remove the Release.toml requirement.
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.
Here we are using the actual cargo package version as the variant's version. What do you think?
My biggest gripe is that it's inconsistent with the cargo manifests for packages, where the crate version is ignored and only the version in the package's spec file has any external effect. As a minor nit, I also don't love parsing the crate manifest in different ways with different tools; we already have a parser in buildsys and could factor that out into a standalone crate if we needed to.
A single version in Twoliter.toml
is the most consistent with existing logic and would make what I consider to be the common case easier - a project where multiple variants are built and released together, all tied to a specific Git commit tagged with a version. Updating a dozen versions across all variant manifests would be a lot of boilerplate for a routine chore, vs. just editing the top-level file.
I am still somewhat interested in the direction where variants (and kits) all have associated RPM spec files, to include package dependencies via Requires and stray files that don't make sense elsewhere. If we did that we could get the variant's version from the spec file, which would be consistent with package versioning.
But I'm not convinced that would be better. Before we added application-inventory.json
, none of these internal versions had any external significance. The spec file versions were mostly there as an implementation detail and a nod to spec file conventions. They're also a bit annoying to maintain since every package update requires at least two files to edit.
My preference would be to start with a top-level release-version
field in Twoliter.toml
, and if we need variant-specific versions for some reason, we could add a release-version-override
field to package.metadata.build-variant
.
twoliter/embedded/Makefile.toml
Outdated
@@ -137,6 +137,8 @@ TESTSYS_LOG_LEVEL = "info" | |||
# Certain variables are defined here to allow us to override a component value | |||
# on the command line. | |||
|
|||
BUILDSYS_VERSION_IMAGE = { script = ["awk -F '[ =\"]+' '$1 == \"version\" {print $2}' ${BUILDSYS_RELEASE_CONFIG_PATH}"], condition = { env_not_set = ["BUILDSYS_VERSION_IMAGE"]}} |
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 think we could require this to be set instead of discovering it from Release.toml here. This code is duplicated in Bottlerocket's Makefile.toml which means that Bottlerocket's build is always going to be setting 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 think we could require this to be set instead of discovering it from Release.toml here. This code is duplicated in Bottlerocket's Makefile.toml which means that Bottlerocket's build is always going to be setting this.
Note, we discussed, in twoliter make
we can look for BUILDSYS_VERSION_IMAGE
, if it's not there or empty, we can get it from Twoliter.toml and set it before calling cargo make
.
d2dbe85
to
7b0123f
Compare
twoliter/src/common.rs
Outdated
/// `quiet=true`, no output will be shown. | ||
pub(crate) async fn exec(cmd: &mut Command, quiet: bool) -> Result<()> { | ||
/// `quiet=true`, no output will be shown and will be returned instead. | ||
pub(crate) async fn exec(cmd: &mut Command, quiet: bool) -> Result<String> { |
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.
Rather than sometimes returning an empty string, I'd prefer to return a Result<Option<String>>
.
7b0123f
to
65b153a
Compare
2495717
to
ff6125c
Compare
TODO: Probably should add tests of the |
ff6125c
to
fd9907d
Compare
local/README.md
Outdated
@@ -1,3 +1,55 @@ | |||
# Building The Alpha SDK |
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 file can be removed. It wasn't supposed to be a part of this branch.
warn!( | ||
"A Release.toml file was found. Release.toml is deprecated. Please remove it from \ | ||
your project." | ||
); |
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: this could encourage people building from the main repo to send a PR to remove Release.toml
- might want to drop it.
When loading a project, issue a deprecation warning if Release.toml is found. If it is found, ensure that its version field is aligned with Twoliter.toml
It is no longer required to have a Release.toml file in the project. Co-authored-by: Ethan Pullen <[email protected]> Co-authored-by: Matthew James Briggs <[email protected]>
fd9907d
to
ba4185a
Compare
twoliter/embedded/Makefile.toml
Outdated
@@ -15,9 +15,13 @@ BUILDSYS_IMAGES_DIR = "${BUILDSYS_BUILD_DIR}/images" | |||
BUILDSYS_TOOLS_DIR = "${BUILDSYS_ROOT_DIR}/tools" | |||
BUILDSYS_SOURCES_DIR = "${BUILDSYS_ROOT_DIR}/sources" | |||
BUILDSYS_SBKEYS_DIR = "${BUILDSYS_ROOT_DIR}/sbkeys" | |||
BUILDSYS_SBKEYS_PROFILE = { script = ['echo "${BUILDSYS_SBKEYS_PROFILE:-local}"'] } | |||
BUILDSYS_SBKEYS_PROFILE = { script = [ |
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.
Please undo your IDE's auto-reformatting of this file.
328c851
to
13493e8
Compare
We had a mistake in bottlerocket-os#112 commit 67ef875. The check to make sure the version Release.toml matched the release version in Twoliter.toml could never succeed due to quotation marks around the version string. This fixes it and adds a test to prove that it works.
Issue number:
Closes #109
Description of changes:
Instead of using
Release.toml
to determine the version, use the version listed in the variantsCargo.toml
instead.Testing done:
Unit test added to
tests/variant_version
Integ test with
project1
Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.