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

twoliter: allow partial lockfile validation in some scenarios #361

Merged
merged 4 commits into from
Sep 6, 2024

Conversation

cbgbt
Copy link
Contributor

@cbgbt cbgbt commented Sep 6, 2024

Description of changes:

    twoliter: allow partial lockfile validation in some scenarios
    
    In some CI scenarios, it's useful to drop previously-built variant
    images into a Twoliter project's build directory and use Twoliter to
    publish those variant images.
    
    In these cases, Kit dependencies are not necessary, and it can be useful
    to avoid resolving them and comparing them against Twoliter.lock.
    
    This change allows skipping Kit lockfile verification only when
    executing certain `twoliter make` targets.

Testing done:

  • All provided tests pass

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.

@cbgbt cbgbt force-pushed the partial-verifications branch 2 times, most recently from 5eefd51 to 8c37c49 Compare September 6, 2024 18:12
@cbgbt
Copy link
Contributor Author

cbgbt commented Sep 6, 2024

Sorry for the churn. I have another TL interface change I'd like to make. I can save it for a subsequent PR, though.

@cbgbt
Copy link
Contributor Author

cbgbt commented Sep 6, 2024

I disabled some additional, unnecessary artifact fetching. Some make targets needlessly requested workspace sources as an artifact of previously being part of the monorepo.

I need to test that specific change a bit more before merging, though.

@@ -1398,7 +1410,6 @@ pubsys \
# Rather than depend on "build", which currently rebuilds images each run, we
# depend on publish-tools and check for the input file below to save time.
# This does mean that `cargo make ami` must be run before `cargo make validate-ami`.
dependencies = ["fetch-sources"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like we can get rid of most of these 'Rather than depend on "build"' comments now, since these tasks don't depend on "publish-tools" or anything else.

//
// `twoliter make` targets in the following list will skip kit validation IFF they also explicitly
// list their SDK dependency in Twoliter.toml.
const SKIP_KIT_VALIDATION_TARGETS: &[&str] = &["repack-variant", "repo", "fetch-sdk"];
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like we would want to list all of the repo, AMI, ssm, and OVA operations in this list:

  • repo
  • validate-repo
  • check-repo-expirations
  • refresh-repo
  • ami
  • ami-public
  • ami-private
  • grant-ami
  • revoke-ami
  • validate-ami
  • ssm
  • promote-ssm
  • validate-ssm

Optionally:

  • upload-ova
  • vmware-template

Unsure:

  • all the test related tasks
  • all the clean related tasks

I know allowlists are preferred over denylists, but we only really need kit validation to occur in the places where we're building something - build-package, build-variant, and build-all. So it might be better to just enforce it there?

@cbgbt cbgbt force-pushed the partial-verifications branch 3 times, most recently from 90fce5b to 1921801 Compare September 6, 2024 18:53
@cbgbt
Copy link
Contributor Author

cbgbt commented Sep 6, 2024

Commenting so that GitHub will provide a useful comparison view.

@cbgbt
Copy link
Contributor Author

cbgbt commented Sep 6, 2024

^ addresses feedback from @bcressey

@sumukhballal
Copy link
Contributor

LGTM! 👍

@cbgbt
Copy link
Contributor Author

cbgbt commented Sep 6, 2024

Force push to remove erroneous println!

@cbgbt
Copy link
Contributor Author

cbgbt commented Sep 6, 2024

build and default are effectively aliases to build-variant and are used in the bottlerocket repo. These targets now require kit verification.

@cbgbt
Copy link
Contributor Author

cbgbt commented Sep 6, 2024

^ rebase (without changes) on to develop

The build-kit tests significantly balloon twoliter's test time. This
marks them with `#[ignore]`, which will have them run  on `make integ`
or `make build`, but not on `cargo test`.
@cbgbt
Copy link
Contributor Author

cbgbt commented Sep 6, 2024

^ make changes to work with #357

@cbgbt
Copy link
Contributor Author

cbgbt commented Sep 6, 2024

^ force push because I missed build-all 😅

In some CI scenarios, it's useful to drop previously-built variant
images into a Twoliter project's build directory and use Twoliter to
publish those variant images.

In these cases, Kit dependencies are not necessary, and it can be useful
to avoid resolving them and comparing them against Twoliter.lock.

This change allows skipping Kit lockfile verification only when
executing certain `twoliter make` targets.
Switches to a builder-style mechanism for disabling metadata fetching.
Since Rust doesn't have named args, it can be hard to know what boolean
function flags do at a callsite without going to the function signature.
Many cargo-make targets were fetching sources as an artifact from when
publication tools were built as part of the bottlerocket monorepo.
Now that Twoliter builds bundles these publication tools, we have need
to fetch project sources.
@cbgbt cbgbt merged commit 4bb087a into bottlerocket-os:develop Sep 6, 2024
1 check passed
@cbgbt cbgbt deleted the partial-verifications branch September 6, 2024 22:23
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.

4 participants