Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions buildkite/bazelci.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import random
import re
import requests
import shlex
import shutil
import stat
import subprocess
Expand Down Expand Up @@ -3393,19 +3394,22 @@ def get_platform_for_task(task, task_config):
return task_config.get("platform", task)


_SAFE_CONFIG_PATH = re.compile(r"^\.bazelci/[A-Za-z0-9_./-]+\.(yml|yaml)$")


def create_config_validation_steps(git_commit):
config_files = [
path
for path in get_modified_files(git_commit)
if path.startswith(".bazelci/") and os.path.splitext(path)[1] in CONFIG_FILE_EXTENSIONS
if _SAFE_CONFIG_PATH.fullmatch(path)
]
return [
create_step(
label=":cop: Validate {}".format(f),
commands=[
fetch_ci_scripts_command(),
"{} bazelci.py project_pipeline --file_config={}".format(
PLATFORMS[DEFAULT_PLATFORM]["python"], f
PLATFORMS[DEFAULT_PLATFORM]["python"], shlex.quote(f)
),
],
platform=DEFAULT_PLATFORM,
Expand Down