Skip to content

Commit b992ff4

Browse files
committed
Merge branch 'main' into alpha
2 parents d1595c6 + 5c7fae2 commit b992ff4

File tree

477 files changed

+99149
-45890
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

477 files changed

+99149
-45890
lines changed

.automation/build.py

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,11 @@ def build_dockerfile(
327327
)
328328
docker_from += [dockerfile_item]
329329
# ARG
330-
elif dockerfile_item.startswith("ARG"):
330+
elif dockerfile_item.startswith("ARG") or (
331+
len(dockerfile_item.splitlines()) > 1
332+
and dockerfile_item.splitlines()[0].startswith("# renovate: ")
333+
and dockerfile_item.splitlines()[1].startswith("ARG")
334+
):
331335
docker_arg += [dockerfile_item]
332336
# COPY
333337
elif dockerfile_item.startswith("COPY"):
@@ -423,7 +427,10 @@ def build_dockerfile(
423427
docker_arg_top = []
424428
docker_arg_main = []
425429
for docker_arg_item in docker_arg:
426-
match = re.match(r"ARG\s+([a-zA-Z_][a-zA-Z0-9_]*)\s*=?\s*", docker_arg_item)
430+
match = re.match(
431+
r"(?:# renovate: .*\n)?ARG\s+([a-zA-Z_][a-zA-Z0-9_]*)\s*=?\s*",
432+
docker_arg_item,
433+
)
427434
arg_name = match.group(1)
428435
if arg_name in all_from_instructions:
429436
docker_arg_top += [docker_arg_item]
@@ -523,7 +530,7 @@ def build_dockerfile(
523530
+ ' && chown -R "$(id -u)":"$(id -g)" node_modules # fix for https://github.com/npm/cli/issues/5900 \\\n'
524531
+ ' && echo "Removing extra node_module files…" \\\n'
525532
+ ' && find . \\( -not -path "/proc" \\)'
526-
+ ' -and \\( -type f'
533+
+ " -and \\( -type f"
527534
+ ' \\( -iname "*.d.ts"'
528535
+ ' -o -iname "*.map"'
529536
+ ' -o -iname "*.npmignore"'
@@ -532,7 +539,7 @@ def build_dockerfile(
532539
+ ' -o -iname "README.md"'
533540
+ ' -o -iname ".package-lock.json"'
534541
+ ' -o -iname "package-lock.json"'
535-
+ ' \\) -o -type d -name /root/.npm/_cacache \\) -delete \n'
542+
+ " \\) -o -type d -name /root/.npm/_cacache \\) -delete \n"
536543
+ "WORKDIR /\n"
537544
)
538545
replace_in_file(dockerfile, "#NPM__START", "#NPM__END", npm_install_command)
@@ -1111,7 +1118,7 @@ def generate_flavor_documentation(flavor_id, flavor, linters_tables_md):
11111118
def dump_as_json(value: Any, empty_value: str) -> str:
11121119
if not value:
11131120
return empty_value
1114-
# Covert any value to string with JSON
1121+
# Convert any value to string with JSON
11151122
# Don't indent since markdown table supports single line only
11161123
result = json.dumps(value, indent=None, sort_keys=True)
11171124
return f"`{result}`"
@@ -2350,7 +2357,7 @@ def add_in_config_schema_file(variables):
23502357
json_schema["properties"] = json_schema_props
23512358
if updated is True:
23522359
with open(CONFIG_JSON_SCHEMA, "w", encoding="utf-8") as outfile:
2353-
json.dump(json_schema, outfile, indent=4, sort_keys=True)
2360+
json.dump(json_schema, outfile, indent=2, sort_keys=True)
23542361
outfile.write("\n")
23552362

23562363

@@ -2367,7 +2374,7 @@ def remove_in_config_schema_file(variables):
23672374
json_schema["properties"] = json_schema_props
23682375
if updated is True:
23692376
with open(CONFIG_JSON_SCHEMA, "w", encoding="utf-8") as outfile:
2370-
json.dump(json_schema, outfile, indent=4, sort_keys=True)
2377+
json.dump(json_schema, outfile, indent=2, sort_keys=True)
23712378
outfile.write("\n")
23722379

23732380

@@ -2707,7 +2714,7 @@ def generate_json_schema_enums():
27072714
with open(DESCRIPTOR_JSON_SCHEMA, "r", encoding="utf-8") as json_file:
27082715
json_schema = json.load(json_file)
27092716
json_schema["definitions"]["enum_flavors"]["enum"] = ["all_flavors"] + list(
2710-
flavors.keys()
2717+
sorted(set(list(flavors.keys())))
27112718
)
27122719
with open(DESCRIPTOR_JSON_SCHEMA, "w", encoding="utf-8") as outfile:
27132720
json.dump(json_schema, outfile, indent=2, sort_keys=True)
@@ -2724,6 +2731,14 @@ def generate_json_schema_enums():
27242731
json_schema["definitions"]["enum_linter_keys"]["enum"] = [x.name for x in linters]
27252732
# Deprecated linters
27262733
json_schema["definitions"]["enum_linter_keys"]["enum"] += DEPRECATED_LINTERS
2734+
2735+
# Sort:
2736+
json_schema["definitions"]["enum_descriptor_keys"]["enum"] = sorted(
2737+
set(json_schema["definitions"]["enum_descriptor_keys"]["enum"])
2738+
)
2739+
json_schema["definitions"]["enum_linter_keys"]["enum"] = sorted(
2740+
set(json_schema["definitions"]["enum_linter_keys"]["enum"])
2741+
)
27272742
with open(CONFIG_JSON_SCHEMA, "w", encoding="utf-8") as outfile:
27282743
json.dump(json_schema, outfile, indent=2, sort_keys=True)
27292744
outfile.write("\n")
@@ -3352,17 +3367,22 @@ def update_workflow_linters(file_path, linters):
33523367

33533368

33543369
if __name__ == "__main__":
3370+
logging_format = (
3371+
"[%(levelname)s] %(message)s"
3372+
if "CI" in os.environ
3373+
else "%(asctime)s [%(levelname)s] %(message)s"
3374+
)
33553375
try:
33563376
logging.basicConfig(
33573377
force=True,
33583378
level=logging.INFO,
3359-
format="%(asctime)s [%(levelname)s] %(message)s",
3379+
format=logging_format,
33603380
handlers=[logging.StreamHandler(sys.stdout)],
33613381
)
33623382
except ValueError:
33633383
logging.basicConfig(
33643384
level=logging.INFO,
3365-
format="%(asctime)s [%(levelname)s] %(message)s",
3385+
format=logging_format,
33663386
handlers=[logging.StreamHandler(sys.stdout)],
33673387
)
33683388
config.init_config("build")

0 commit comments

Comments
 (0)