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

Add cleanup command #64

Merged
merged 3 commits into from
Jul 18, 2022
Merged

Conversation

lucian-ioan
Copy link
Collaborator

@lucian-ioan lucian-ioan commented Jul 7, 2022

Adds cleanup command which has a flag named path, by default it is changelog/fragments.
This command removes all fragments from the path.

From the root of the repository run:

elastic-agent-changelog-tool cleanup

Closes: #52

@elasticmachine
Copy link
Collaborator

elasticmachine commented Jul 7, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-07-18T10:58:08.459+0000

  • Duration: 3 min 47 sec

Test stats 🧪

Test Results
Failed 0
Passed 67
Skipped 0
Total 67

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

Copy link
Member

@endorama endorama left a comment

Choose a reason for hiding this comment

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

A small change requested to leverage already existing configuration and it's ready to be merged.

cmd/cleanup.go Outdated
return nil
},
RunE: func(cmd *cobra.Command, args []string) error {
path, err := cmd.Flags().GetString("path")
Copy link
Member

Choose a reason for hiding this comment

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

cmd/cleanup.go Outdated
},
}

cleanupCmd.Flags().String("path", "changelog/fragments", "The folder where fragments are stored.")
Copy link
Member

Choose a reason for hiding this comment

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

Remove this flag, as is possible to override this value overriding fragment_path configuration setting.

cmd/cleanup.go Outdated
return fmt.Errorf("error parsing flag 'path': %w", err)
}

err = fs.RemoveAll(path)
Copy link
Member

Choose a reason for hiding this comment

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

I was wondering if this implementation (where the entire folder is removed and recreated) is too greedy and can produce unexpected results. I'm thinking about the case in which users adds different files (non-YAML) in the fragments folder that get deleted by this implementation.

What do you think?

@lucian-ioan lucian-ioan merged commit b9aac9b into elastic:main Jul 18, 2022
@lucian-ioan lucian-ioan deleted the add_cleanup_cmd branch September 5, 2022 09:31
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.

Add cleanup command
3 participants