Report build error if failed to apply patch
This commit is contained in:
parent
de0d5afd78
commit
6812950908
2 changed files with 58 additions and 1 deletions
|
@ -16,9 +16,21 @@
|
|||
# Scripts that use secrets has to be a separate files, not inlined in pipeline:
|
||||
# https://buildkite.com/docs/pipelines/secrets#anti-pattern-referencing-secrets-in-your-pipeline-yaml
|
||||
|
||||
set -uo pipefail
|
||||
|
||||
scripts/phabtalk/apply_patch2.py $ph_buildable_diff \
|
||||
--path "${BUILDKITE_BUILD_PATH}"/llvm-project \
|
||||
--token $CONDUIT_TOKEN \
|
||||
--url $PHABRICATOR_HOST \
|
||||
--comment-file apply_patch.txt \
|
||||
--push-branch
|
||||
--push-branch
|
||||
|
||||
EXIT_STATUS=$?
|
||||
|
||||
if [ $EXIT_STATUS -ne 0 ]; then
|
||||
scripts/phabtalk/add_url_artifact.py --phid="$ph_target_phid" --url="$BUILDKITE_BUILD_URL" --name="Buildkite apply patch"
|
||||
scripts/buildkite/set_build_status.py
|
||||
echo failed
|
||||
fi
|
||||
|
||||
exit $EXIT_STATUS
|
45
scripts/buildkite/set_build_status.py
Executable file
45
scripts/buildkite/set_build_status.py
Executable file
|
@ -0,0 +1,45 @@
|
|||
#!/usr/bin/env python3
|
||||
# Copyright 2020 Google LLC
|
||||
#
|
||||
# Licensed under the the Apache License v2.0 with LLVM Exceptions (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://llvm.org/LICENSE.txt
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import argparse
|
||||
import glob
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import uuid
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from phabtalk.phabtalk import PhabTalk
|
||||
from buildkite.utils import format_url
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--log-level', type=str, default='WARNING')
|
||||
parser.add_argument('--success', action='store_true')
|
||||
args = parser.parse_args()
|
||||
logging.basicConfig(level=args.log_level, format='%(levelname)-7s %(message)s')
|
||||
phabtalk = PhabTalk(os.getenv('CONDUIT_TOKEN'), 'https://reviews.llvm.org/api/', False)
|
||||
build_url = f'https://reviews.llvm.org/harbormaster/build/{os.getenv("ph_build_id")}'
|
||||
print(f'Reporting results to Phabricator build {format_url(build_url)}')
|
||||
ph_buildable_diff = os.getenv('ph_buildable_diff')
|
||||
ph_target_phid = os.getenv('ph_target_phid')
|
||||
phabtalk.update_build_status(ph_buildable_diff, ph_target_phid, False, args.success)
|
||||
bug_url = f'https://github.com/google/llvm-premerge-checks/issues/new?assignees=&labels=bug' \
|
||||
f'&template=bug_report.md&title=buildkite build {os.getenv("BUILDKITE_PIPELINE_SLUG")} ' \
|
||||
f'{os.getenv("BUILDKITE_BUILD_NUMBER")}'
|
||||
print(f'{format_url(bug_url, "report issue")}')
|
Loading…
Reference in a new issue