From c1b774cdb690c33438ec6d5e79ffd8af72bbbe50 Mon Sep 17 00:00:00 2001 From: Ross Wolf <31489089+rw-access@users.noreply.github.com> Date: Wed, 18 Aug 2021 16:55:21 -0600 Subject: [PATCH] Skip etc/packages.yml from backport: auto (#1437) (cherry picked from commit d647c7b809f19e0f53b935926ea48c3b9ec0b425) --- detection_rules/devtools.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/detection_rules/devtools.py b/detection_rules/devtools.py index d26d07d70..22281acbb 100644 --- a/detection_rules/devtools.py +++ b/detection_rules/devtools.py @@ -128,6 +128,10 @@ class GitChangeEntry: @click.option("--dry-run", is_flag=True, help="List the changes that would be made") def prune_staging_area(target_stack_version: str, dry_run: bool): """Prune the git staging area to remove changes to incompatible rules.""" + exceptions = { + "etc/packages.yml", + } + target_stack_version = Version(target_stack_version)[:2] # load a structured summary of the diff from git @@ -138,6 +142,11 @@ def prune_staging_area(target_stack_version: str, dry_run: bool): reversions: List[GitChangeEntry] = [] for change in changes: + if str(change.path) in exceptions: + # Don't backport any changes to files matching the list of exceptions + reversions.append(change) + continue + # it's a change to a rule file, load it and check the version if str(change.path.absolute()).startswith(RULES_DIR) and change.path.suffix == ".toml": # bypass TOML validation in case there were schema changes