1
0
Fork 0

Add link to the build in "setup" step

This commit is contained in:
Mikhail Goncharov 2020-10-09 12:50:44 +02:00
parent 3df81c372f
commit 322cfbda8c
2 changed files with 9 additions and 7 deletions

View file

@ -18,6 +18,7 @@ import os
from choose_projects import ChooseProjects
import git
from phabtalk.phabtalk import PhabTalk
from steps import generic_linux, generic_windows, from_shell_output
import yaml
@ -34,6 +35,11 @@ if __name__ == '__main__':
log_level = os.getenv('ph_log_level', 'INFO')
logging.basicConfig(level=log_level, format='%(levelname)-7s %(message)s')
phid = os.getenv('ph_target_phid')
# Add link in review to the build.
if phid is not None:
PhabTalk(os.getenv('CONDUIT_TOKEN')).maybe_add_url_artifact(phid, os.getenv('BUILDKITE_BUILD_URL'), 'buildkite')
# List all affected projects.
repo = git.Repo('.')
patch = repo.git.diff("HEAD~1")
@ -63,7 +69,7 @@ if __name__ == '__main__':
for gen in steps_generators:
steps.extend(from_shell_output(gen))
if os.getenv('ph_target_phid') is None:
if phid is None:
logging.warning('ph_target_phid is not specified. Skipping "Report" step')
else:
steps.append({
@ -92,5 +98,5 @@ if __name__ == '__main__':
'timeout_in_minutes': 10,
}
steps.append(report_step)
print(yaml.dump({'steps': steps}))

View file

@ -53,13 +53,9 @@ def generic_linux(projects: str, check_diff: bool) -> List:
'cd "$BUILDKITE_BUILD_CHECKOUT_PATH"',
'set +e',
]
if check_diff:
commands.extend([
# Add link in review to the build.
'${SRC}/scripts/add_phabricator_artifact.py '
'--phid="$ph_target_phid" '
'--url="$BUILDKITE_BUILD_URL" '
'--name="Buildkite build"' if check_diff else '',
'${SRC}/scripts/premerge_checks.py --check-clang-format --check-clang-tidy '
f'--projects="{projects}" --log-level={log_level} {filter_output}',
])