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

Added an Audit step for FreeBSD and DragonFly packagees. #640

Merged
merged 4 commits into from
Jan 8, 2024

Conversation

wolpert
Copy link
Contributor

@wolpert wolpert commented Jan 7, 2024

Allows for auditing the packages to be disabled since they are breaking steps. Current behaivor is the default, where if the audit fails topgrade stops. Can be disabled in the [misc] section independenly from other sections.

Probably we should have a document explaining all the Steps in the system. Maybe as a separate PR?

This is a potential fix for the bug I reported here: #639

Standards checklist:

  • The PR title is descriptive.
  • I have read CONTRIBUTING.md
  • The code compiles (cargo build)
  • The code passes rustfmt (cargo fmt)
  • The code passes clippy (cargo clippy)
  • The code passes tests (cargo test)
  • Optional: I have tested the code myself

For new steps

  • Optional: Topgrade skips this step where needed
  • Optional: The --dry-run option works with this step
  • Optional: The --yes option works with this step if it is supported by
    the underlying command

If you developed a feature or a bug fix for someone else and you do not have the
means to test it, please tag this person here.

Allows for auditing the packages to be disabled since they are breaking steps.
Current behaivor is the default, where if the audit fails topgrade stops. Can
be disabled in the [misc] section independenly from other sections
@wolpert
Copy link
Contributor Author

wolpert commented Jan 7, 2024

BTW, tested in FreeBSD.

With default configuration file, there is no change in behavior.

When the following is added to the configuration file, the Audit step is removed.

[misc]
disable = ["audit"]

Copy link
Member

@SteveLauC SteveLauC left a comment

Choose a reason for hiding this comment

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

Hi, thanks for this patch!

If you want to make audit a step, you should also call print_separator() in that function:

pub fn audit_packages(ctx: &ExecutionContext) -> Result<()> {
    let sudo = require_option(ctx.sudo().as_ref(), REQUIRE_SUDO.to_string())?;
    
    print_separator("FreeBSD Audit");
    
    Command::new(sudo)
        .args(["/usr/sbin/pkg", "audit", "-Fr"])
        .status_checked()
}

@wolpert
Copy link
Contributor Author

wolpert commented Jan 8, 2024

If you want to make audit a step, you should also call print_separator() in that function:

Good idea. Just updated with the change to both FreeBSD and DragonFly. Thanks!

Lol, my bad. Thanks for catching!

Co-authored-by: SteveLauC <[email protected]>
Copy link
Member

@SteveLauC SteveLauC left a comment

Choose a reason for hiding this comment

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

Thanks!

@SteveLauC SteveLauC linked an issue Jan 8, 2024 that may be closed by this pull request
6 tasks
@SteveLauC SteveLauC merged commit 78dc567 into topgrade-rs:main Jan 8, 2024
7 checks passed
@wolpert wolpert deleted the audit_step branch January 8, 2024 01:40
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.

FreeBSD pkg audit should be optional, or not fail if status code != 0
2 participants