Skip to content

[FR] Add --force flag to update-lock-versions #3693

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

Merged
merged 2 commits into from
May 18, 2024

Conversation

eric-forte-elastic
Copy link
Contributor

Issues

Summary

This PR adds a --force flag to lock versions to allow this command to be run in CI such that users can lock versions without needing to build a package.

Testing

python -m detection_rules dev update-lock-versions --force should not have a confirm prompt.

@eric-forte-elastic eric-forte-elastic added enhancement New feature or request python Internal python for the repository Area: DED Team: TRADE labels May 17, 2024
@eric-forte-elastic eric-forte-elastic self-assigned this May 17, 2024
Copy link
Contributor

@Mikaayenson Mikaayenson left a comment

Choose a reason for hiding this comment

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

This LGTM. IINM, for custom rule management, this is needed. We typically use build-release --update-version-lock but we decided not to add registry information. This allows us to still manage the version lock in CI without needing additional package registry info, and bypasses the interactive click confirmation.

@@ -334,7 +334,8 @@ def prune_staging_area(target_stack_version: str, dry_run: bool, exception_list:

@dev_group.command('update-lock-versions')
@click.argument('rule-ids', nargs=-1, required=False)
def update_lock_versions(rule_ids):
@click.option('--force', is_flag=True, help='Force update without confirmation')
def update_lock_versions(rule_ids: Tuple[str, ...], force: bool):
Copy link
Contributor

Choose a reason for hiding this comment

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

a nitpick: Tuple typehint is a bit too click-specific here, Sequence would be a better choice, if it is really not a list :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that Sequence is more appropriate; however, we do not use Sequence in the code elsewhere for type hinting and we do use Tuple[str, ...]. For consistency, I think we should update to Sequence in a different PR where we can modify all of the relevant type hints all at once.

@eric-forte-elastic eric-forte-elastic merged commit 707ca32 into main May 18, 2024
@eric-forte-elastic eric-forte-elastic deleted the add_force_lock_version branch May 18, 2024 00:25
protectionsmachine pushed a commit that referenced this pull request May 18, 2024
* Add --force flag to update-lock-versions

* Add type hinting

(cherry picked from commit 707ca32)
protectionsmachine pushed a commit that referenced this pull request May 18, 2024
* Add --force flag to update-lock-versions

* Add type hinting

(cherry picked from commit 707ca32)
protectionsmachine pushed a commit that referenced this pull request May 18, 2024
* Add --force flag to update-lock-versions

* Add type hinting

(cherry picked from commit 707ca32)
protectionsmachine pushed a commit that referenced this pull request May 18, 2024
* Add --force flag to update-lock-versions

* Add type hinting

(cherry picked from commit 707ca32)
protectionsmachine pushed a commit that referenced this pull request May 18, 2024
* Add --force flag to update-lock-versions

* Add type hinting

(cherry picked from commit 707ca32)
protectionsmachine pushed a commit that referenced this pull request May 18, 2024
* Add --force flag to update-lock-versions

* Add type hinting

(cherry picked from commit 707ca32)
protectionsmachine pushed a commit that referenced this pull request May 18, 2024
* Add --force flag to update-lock-versions

* Add type hinting

(cherry picked from commit 707ca32)
protectionsmachine pushed a commit that referenced this pull request May 18, 2024
* Add --force flag to update-lock-versions

* Add type hinting

(cherry picked from commit 707ca32)
protectionsmachine pushed a commit that referenced this pull request May 18, 2024
* Add --force flag to update-lock-versions

* Add type hinting

(cherry picked from commit 707ca32)
protectionsmachine pushed a commit that referenced this pull request May 18, 2024
* Add --force flag to update-lock-versions

* Add type hinting

(cherry picked from commit 707ca32)
protectionsmachine pushed a commit that referenced this pull request May 18, 2024
* Add --force flag to update-lock-versions

* Add type hinting

(cherry picked from commit 707ca32)
protectionsmachine pushed a commit that referenced this pull request May 18, 2024
* Add --force flag to update-lock-versions

* Add type hinting

(cherry picked from commit 707ca32)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport: auto enhancement New feature or request python Internal python for the repository Team: TRADE
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants