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

buildsys: generate kit metadata and create oci image #271

Merged

Conversation

jmt-lab
Copy link
Contributor

@jmt-lab jmt-lab commented Jun 5, 2024

Issue number: 255

Closes #255

Description of changes:

  • Reintroduces rpm2kit this time with a working version
  • Expands buildsys build kit to pass through the needed information to build the kit metadata and oci archive

Testing done:

  • Was able to build local-kits test project and verified
    • oci archive loads using docker load -i
    • metadata is generated and injected correctly
    • contents of oci archive are correct

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.

@jmt-lab jmt-lab requested review from bcressey, cbgbt and webern June 5, 2024 20:39
@jmt-lab jmt-lab self-assigned this Jun 5, 2024
@jmt-lab jmt-lab force-pushed the ootb/external-kits/metadata-file branch from 44f89ac to 81786a9 Compare June 5, 2024 21:09
@jmt-lab
Copy link
Contributor Author

jmt-lab commented Jun 5, 2024

Cleaned up commits

@jmt-lab jmt-lab force-pushed the ootb/external-kits/metadata-file branch 2 times, most recently from 19ed67e to c6c7496 Compare June 5, 2024 21:31
@jmt-lab
Copy link
Contributor Author

jmt-lab commented Jun 5, 2024

Adjust based off changes in external-kit-metadata.json

Copy link
Contributor

@webern webern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the local kit building test failed.

tests/projects/local-kit/kits/extra-2-kit/Cargo.toml Outdated Show resolved Hide resolved
tools/buildsys/src/args.rs Outdated Show resolved Hide resolved
tools/buildsys/src/builder.rs Outdated Show resolved Hide resolved
tools/buildsys/src/builder.rs Outdated Show resolved Hide resolved
Comment on lines 385 to 386
.context(error::CargoPackageMissingVendorSnafu {
name: self.package.name.clone(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should create an issue, if we don't have one already, for deserializing these manifest metadata sections with Serde in a validating manner. We should catch these errors earlier.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should create an issue, if we don't have one already, for deserializing these manifest metadata sections with Serde in a validating manner. We should catch these errors earlier.

#273

twoliter/embedded/rpm2kit Outdated Show resolved Hide resolved
Comment on lines +67 to +69
sdk: .[0].sdk,
kit: (
[ .[1] | values[] | {name: ., version: "$VERSION_ID", vendor: "$VENDOR"}]
+ [ .[0].kit[] | {name: .name, version: .version, vendor: .vendor } ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should kits also include the digest of their dependencies?

I suppose if they do, it would be difficult to "override" transitive dependencies during development, but it also seems like it would be surprising if the world shifted underneath you in a production setting.

This also wouldn't work for local kits.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should kits also include the digest of their dependencies?

🤔 I'm not sure, but I worry about making development too painful. Ideally all the digests would be captured in Cargo.lock and we'd prefer to fetch by digest, so that tags could shift around until the moment they were published, and then after that any change would be detected and cause people to notice.

twoliter/embedded/rpm2kit Outdated Show resolved Hide resolved
Copy link
Contributor

@webern webern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test failure

Unable to instantiate the builder: Failed to create build arguments due to an error reading external kit metadata: No such file or directory (os error 2)

@jmt-lab
Copy link
Contributor Author

jmt-lab commented Jun 6, 2024

Test failure should go away once fetch PR is merged and this is rebased

tools/buildsys/src/manifest/error.rs Outdated Show resolved Hide resolved
tools/buildsys/src/builder.rs Outdated Show resolved Hide resolved
twoliter/embedded/build.Dockerfile Outdated Show resolved Hide resolved
tools/buildsys/src/manifest.rs Outdated Show resolved Hide resolved
tools/buildsys/src/manifest/error.rs Outdated Show resolved Hide resolved
tools/buildsys/src/args.rs Outdated Show resolved Hide resolved
twoliter/embedded/rpm2kit Outdated Show resolved Hide resolved
twoliter/embedded/rpm2kit Outdated Show resolved Hide resolved
twoliter/embedded/rpm2kit Outdated Show resolved Hide resolved
twoliter/embedded/rpm2kit Outdated Show resolved Hide resolved
@jmt-lab jmt-lab force-pushed the ootb/external-kits/metadata-file branch 2 times, most recently from 679eb73 to 1304dd4 Compare June 10, 2024 23:33
tools/buildsys/src/manifest/error.rs Outdated Show resolved Hide resolved
Comment on lines 385 to 386
.context(error::CargoPackageMissingVendorSnafu {
name: self.package.name.clone(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should create an issue, if we don't have one already, for deserializing these manifest metadata sections with Serde in a validating manner. We should catch these errors earlier.

#273

tools/buildsys/src/args.rs Outdated Show resolved Hide resolved
twoliter/embedded/rpm2kit Outdated Show resolved Hide resolved
twoliter/embedded/rpm2kit Outdated Show resolved Hide resolved
twoliter/embedded/rpm2kit Outdated Show resolved Hide resolved
twoliter/embedded/rpm2kit Outdated Show resolved Hide resolved
twoliter/embedded/rpm2kit Outdated Show resolved Hide resolved
Copy link
Contributor

@bcressey bcressey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

integ test change LGTM, it is basically going from this:

let project_path = project_dir.join("Twoliter.toml");

to this:

let project_path = project_dir.join("Twoliter.toml");
twoliter_update(&project_path).await;
twoliter_fetch(&project_path, arch).await;

@jmt-lab jmt-lab force-pushed the ootb/external-kits/metadata-file branch from 1304dd4 to 4c8a738 Compare June 11, 2024 18:41
@jmt-lab jmt-lab requested a review from bcressey June 11, 2024 18:43
@jmt-lab jmt-lab force-pushed the ootb/external-kits/metadata-file branch from 4c8a738 to 0362885 Compare June 11, 2024 21:32
tools/buildsys/src/args.rs Outdated Show resolved Hide resolved
@jmt-lab jmt-lab force-pushed the ootb/external-kits/metadata-file branch 2 times, most recently from c0d21d3 to e248556 Compare June 11, 2024 21:42
@jmt-lab jmt-lab force-pushed the ootb/external-kits/metadata-file branch from e248556 to 1948133 Compare June 11, 2024 21:45
Comment on lines +73 to +77
))]
ExternalMetadataRead { source: std::io::Error },

#[snafu(display("Failed to serialize kit metadata: {source}"))]
MetadataSerialize { source: serde_json::Error },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: seems like these errors are no longer used.

@jmt-lab jmt-lab merged commit a450415 into bottlerocket-os:develop Jun 11, 2024
1 check passed
@jmt-lab jmt-lab deleted the ootb/external-kits/metadata-file branch June 11, 2024 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

twoliter: generate kit metadata file off Cargo.toml build-kit definitions
4 participants