Add disabled flag support for automation scripts (#553)
- Add 'disabled' field to AutoConfig class - Skip disabled scripts in update-release-data.py unless force flag is used
This commit is contained in:
@@ -21,6 +21,7 @@ class AutoConfig:
|
|||||||
self.script = f"{self.method}.py"
|
self.script = f"{self.method}.py"
|
||||||
self.url = data[self.method]
|
self.url = data[self.method]
|
||||||
self.version_template = Template(data.get("template", DEFAULT_VERSION_TEMPLATE))
|
self.version_template = Template(data.get("template", DEFAULT_VERSION_TEMPLATE))
|
||||||
|
self.disabled = data.get("disabled", False)
|
||||||
|
|
||||||
regexes_include = data.get("regex", DEFAULT_VERSION_REGEX)
|
regexes_include = data.get("regex", DEFAULT_VERSION_REGEX)
|
||||||
regexes_include = regexes_include if isinstance(regexes_include, list) else [regexes_include]
|
regexes_include = regexes_include if isinstance(regexes_include, list) else [regexes_include]
|
||||||
@@ -45,6 +46,9 @@ class AutoConfig:
|
|||||||
logging.debug(f"{version} does not match any include or exclude patterns")
|
logging.debug(f"{version} does not match any include or exclude patterns")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def is_disabled(self) -> bool:
|
||||||
|
return self.disabled
|
||||||
|
|
||||||
def is_excluded(self, version: str) -> bool:
|
def is_excluded(self, version: str) -> bool:
|
||||||
return self.first_match(version) is None
|
return self.first_match(version) is None
|
||||||
|
|
||||||
|
|||||||
@@ -121,6 +121,10 @@ def run_scripts(summary: GitHubStepSummary, products: list[ProductFrontmatter],
|
|||||||
try:
|
try:
|
||||||
__delete_data(product)
|
__delete_data(product)
|
||||||
for config in configs:
|
for config in configs:
|
||||||
|
if config.is_disabled() and not force:
|
||||||
|
logging.info(f"skipping script {config.script} for {product.name} as it is disabled")
|
||||||
|
continue
|
||||||
|
|
||||||
success = __run_script(product, config, exec_summary)
|
success = __run_script(product, config, exec_summary)
|
||||||
if not success:
|
if not success:
|
||||||
__revert_data(product)
|
__revert_data(product)
|
||||||
|
|||||||
Reference in New Issue
Block a user