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

bug: config file generated by --generate-default-config contains removed and deprecated flags #8043

Closed
DmitriyLewen opened this issue Dec 4, 2024 Discussed in #8035 · 1 comment · Fixed by #8046
Closed
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.
Milestone

Comments

@DmitriyLewen
Copy link
Contributor

Description

Trivy includes all flags into config file when using --generate-default-config command.
But Trivy returns error for this config file:

➜ trivy image   
2024-12-03T12:44:48-07:00       INFO    Loaded  file_path="trivy.yaml"
2024-12-03T12:44:48-07:00       ERROR   "--reset" was removed. Use "trivy clean --all" instead.
2024-12-03T12:44:48-07:00       FATAL   Fatal error     flag error: db flag error: unable to parse flag: removed flag ("--reset")

We need to exclude removed and obsolete flags from the generated configuration file.

Discussed in #8035

@DmitriyLewen DmitriyLewen added the kind/bug Categorizes issue or PR as related to a bug. label Dec 4, 2024
@DmitriyLewen DmitriyLewen self-assigned this Dec 4, 2024
@DmitriyLewen DmitriyLewen modified the milestones: v0.58.1, v0.59.0 Dec 11, 2024
@dupuyarc
Copy link

Although this bug was closed, I am seeing these errors in v0.58.2, and there were other problems with the generation that the original bug reporter didn't encounter, please see my comment in discussion 8035 for details, summary quoted below:

The generated config file should work with the same version of trivy used to generate it.

Also, the configuration generator should at least

  1. Issue a warning that the default ignore file doesn't exist, or
  2. Create the file if it doesn't exist.
  3. Alternately trivy could consider non-existence of a configured ignore file a non-fatal error.

My preference would be for (1) but any of these would be acceptable.

Finally, the generated config file sets the option to generate a config file, which fails (since it now exists).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants