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

refine dependency resolution design #4

Closed
1 task done
Tracked by #16 ...
webern opened this issue May 25, 2023 · 3 comments
Closed
1 task done
Tracked by #16 ...

refine dependency resolution design #4

webern opened this issue May 25, 2023 · 3 comments
Assignees
Labels
documentation Improvements or additions to documentation kits Work relating to kits.

Comments

@webern
Copy link
Contributor

webern commented May 25, 2023

In the design document, #3, the section entitled Twoliter Update needs refinement.

This may require prototyping and implementation to figure out.
Let's not forget to update the design doc when we have a better handle on this.

The section in its original for read as follows:

Twoliter Update

TODO - This section is a bit hand-wavy and will have its design further refined.

twoliter update is another inspiration from cargo, this time inspired by cargo update.
This command makes it easy for maintainers to update the packages (kits actually) they are using to the latest versions.

In the original Bottlerocket build system, we used Cargo crates to model RPM dependencies.
In Twoliter, we will again lean on Cargo to manage dependencies for us.
We will create a local Cargo registry to represent kit and SDK versions, then use cargo update to resolve the latest dependencies.

Before describing this procedure, we should consider that no two versions of the same kit can be in the dependency tree.
Since they are Yum repositories, this would mess things up.
Cargo allows multiple major versions of a package to exist in a build, but this is behavior we do not want.
We will manipulate version numbers to so that Cargo gives us the desired behavior.

First Twoliter will read the kit dependencies from each variant and add any external kits to its graph.
Next Twoliter will read the kit definitions in the kits directory, and add all of their external dependencies to its graph.

Once it has this list, Twoliter will begin a traversal.
For each kit it will pull all the -metadata images for each external kit JSON files locally.
Each time it finds a new external kit (i.e. an external kit that is depended on by an external kit), it will add this new dependency to the graph.

Once it has all the dependency and version information, Twoliter will build a local cargo registry.
Each kit will be represented by an empty Cargo lib.rs project with the same name as the kit.
The Cargo package version will be given by deterministically adding the kit's version to 1.x (TODO - hand-waved).

The SDK will be a special Cargo package.
Two SDKs may have the same version, but come from different container registries.
To ensure a single SDK is used, it will be given a version in Cargo like this (TODO - or some hash of the necessary unique information):

[dependencies]
sdk = "=0.50.0-public.ecr.aws_bottlerocket_bottlerocket-sdk-x86_64"

At this point Twoliter will build a package that represents the maintainers top level dependencies.

[dependencies]
bottlerocket-core-kit = "1.1.15" # TODO - best way to normalize this into 1.x
bottlerocket-aws-kit = "1.1.15"  # in this example the patch version from 1.15.1 has been lost

Twoliter will run cargo check --locked to make sure the current state of the project is good.
If that succeeds then cargo update will change the Cargo.toml file to the highest versions of all kits possible.
The results of this will be parsed and propagated back to the project.
(TODO - how)

Definition of Done

A PR updating the design doc should answer the following questions and eliminate TODOs in the doc that relate to kit and SDK dependency resolution and updates:

  • Where will the maintainer specify external kit dependencies?
  • How will twoliter discover the complete list of external depenencies?
  • How will local kit dependencies be defined?
  • How will a maintainer lock a certain kit dependency to a certain version?
  • How will Twoliter record the results of its dependency resolution?
  • Does Twoliter need to communicate the resolved depenencies to buildsys?

Depends on

@webern webern mentioned this issue May 25, 2023
11 tasks
@webern
Copy link
Contributor Author

webern commented May 25, 2023

This gave me some confidence that it will work:

cargo.tar.gz

@webern webern added the documentation Improvements or additions to documentation label Jun 5, 2023
@webern webern changed the title refine cargo update design refine dependency resolution design Jun 20, 2023
@webern webern self-assigned this Sep 18, 2023
@webern webern added the kits Work relating to kits. label Sep 19, 2023
@webern webern assigned jmt-lab and unassigned webern May 7, 2024
@webern
Copy link
Contributor Author

webern commented May 30, 2024

It would be good to update the design doc in GitHub with the new design.

@webern
Copy link
Contributor Author

webern commented Jun 13, 2024

Done other than updating the design doc if desired.

@webern webern closed this as completed Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation kits Work relating to kits.
Projects
None yet
Development

No branches or pull requests

2 participants