diff --git a/.automation/build.py b/.automation/build.py index a3e42b578d0..801457402e1 100644 --- a/.automation/build.py +++ b/.automation/build.py @@ -327,7 +327,11 @@ def build_dockerfile( ) docker_from += [dockerfile_item] # ARG - elif dockerfile_item.startswith("ARG"): + elif dockerfile_item.startswith("ARG") or ( + len(dockerfile_item.splitlines()) > 1 + and dockerfile_item.splitlines()[0].startswith("# renovate: ") + and dockerfile_item.splitlines()[1].startswith("ARG") + ): docker_arg += [dockerfile_item] # COPY elif dockerfile_item.startswith("COPY"): @@ -423,7 +427,10 @@ def build_dockerfile( docker_arg_top = [] docker_arg_main = [] for docker_arg_item in docker_arg: - match = re.match(r"ARG\s+([a-zA-Z_][a-zA-Z0-9_]*)\s*=?\s*", docker_arg_item) + match = re.match( + r"(?:# renovate: .*\n)?ARG\s+([a-zA-Z_][a-zA-Z0-9_]*)\s*=?\s*", + docker_arg_item, + ) arg_name = match.group(1) if arg_name in all_from_instructions: docker_arg_top += [docker_arg_item] diff --git a/CHANGELOG.md b/CHANGELOG.md index 28cd1716026..b8aa5456ff1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-linter.yml file, or with `oxsecurity/megalinter:beta` docker image - Core + - Handle renovate version comments in build script - Media