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

feat(eol): added eol dates #148

Open
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

DmitriyLewen
Copy link
Contributor

@DmitriyLewen DmitriyLewen commented Apr 15, 2022

Description

Added list of end-of-life dates.

EOL dated taken from:

Copy link
Collaborator

@knqyf263 knqyf263 left a comment

Choose a reason for hiding this comment

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

main.go Outdated
if err := src.Update(); err != nil {
return xerrors.Errorf("Alpine end of life dates update error: %w", err)
}
commitMsg = "CBL-Mariner Vulnerability Data"
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is not CBL-Mariner

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, changed

want map[string]time.Time
}{
{
name: "happy path",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add sad path?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added 2 tests

Comment on lines 100 to 102
if err := os.MkdirAll(dir, os.ModePerm); err != nil {
return xerrors.Errorf("failed to mkdir: %w", err)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

WriteJSON also creates a dir.

if err := fs.MkdirAll(dir, os.ModePerm); err != nil {
return xerrors.Errorf("unable to create a directory: %w", err)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh, i didn't see that. Thank you. Removed

Comment on lines 96 to 99
dir := filepath.Join(config.vulnListDir, eolAlpineFolder)
if err := os.RemoveAll(dir); err != nil {
return xerrors.Errorf("unable to remove github security advisory directory: %w", err)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is a single file, right? Looks like we don't have to remove dir as it overwrites the existing file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

}
}

func (config Config) Update() error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: a single letter name is fine.

Suggested change
func (config Config) Update() error {
func (c Config) Update() error {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed

return eolDates, nil
}

func (config Config) save(dates map[string]time.Time) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed


const (
eolAlpineFolder = "eol/alpine"
eolAlpineFile = "eol-alpine"
Copy link
Collaborator

Choose a reason for hiding this comment

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

What if we have an entire file name here?

Suggested change
eolAlpineFile = "eol-alpine"
eolAlpineFile = "alpine.json"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed

@DmitriyLewen DmitriyLewen self-assigned this Apr 18, 2022
@DmitriyLewen
Copy link
Contributor Author

DmitriyLewen commented Apr 18, 2022

In addition, we have to add this updater here.

Added, thanks!

@DmitriyLewen DmitriyLewen changed the title feat(alpine): added parser for alpine eol dates feat(eol): added eol dates Apr 21, 2022
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.

None yet

2 participants