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

Don't automatically renew wildcard audits for inactive crates #649

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,11 @@ pub struct RenewArgs {
#[clap(long, action, conflicts_with("crate-name"))]
pub expiring: bool,

/// Renew wildcard audits for inactive crates which have not been updated
/// in 4 months.
#[clap(long, action, requires("expiring"))]
pub include_inactive: bool,
afranchuk marked this conversation as resolved.
Show resolved Hide resolved

/// The name of a crate to renew.
#[clap(value_name("CRATE"), action, required_unless_present("expiring"))]
pub crate_name: Option<String>,
Expand Down
5 changes: 3 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1848,7 +1848,8 @@ fn cmd_regenerate_unpublished(

fn cmd_renew(out: &Arc<dyn Out>, cfg: &Config, sub_args: &RenewArgs) -> Result<(), miette::Report> {
trace!("renewing wildcard audits");
let mut store = Store::acquire_offline(cfg)?;
let network = Network::acquire(cfg);
let mut store = Store::acquire(cfg, network.as_ref(), false)?;
do_cmd_renew(out, cfg, &mut store, sub_args);
store.commit()?;
Ok(())
Expand Down Expand Up @@ -1882,7 +1883,7 @@ fn do_cmd_renew(out: &Arc<dyn Out>, cfg: &Config, store: &mut Store, sub_args: &
} else {
// Find and update all expiring crates.
assert!(sub_args.expiring);
renewing = WildcardAuditRenewal::expiring(cfg, store, false);
renewing = WildcardAuditRenewal::expiring(cfg, store, !sub_args.include_inactive);

if renewing.is_empty() {
info!("no wildcard audits that are eligible for renewal have expired or are expiring in the next {WILDCARD_AUDIT_EXPIRATION_STRING}");
Expand Down
3 changes: 3 additions & 0 deletions tests/snapshots/test_cli__markdown-help.snap
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,9 @@ The name of a crate to renew
#### `--expiring`
Renew all wildcard audits which will have expired six weeks from now

#### `--include-inactive`
Renew wildcard audits for inactive crates which have not been updated in 4 months

#### `-h, --help`
Print help information

Expand Down
Loading