Skip to content

Commit

Permalink
Report PR start time too (#1407)
Browse files Browse the repository at this point in the history
  • Loading branch information
singiamtel authored Nov 14, 2024
1 parent 84ef3d4 commit 4d4a85f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ci/build-loop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
. build-helpers.sh
get_config

ensure_vars CI_NAME CHECK_NAME PR_REPO PR_BRANCH PACKAGE ALIBUILD_DEFAULTS
PR_START_TIME=$(TZ=Europe/Zurich date +'%a %H:%M CET')
echo "$PR_START_TIME: Started building check $CHECK_NAME for $PR_REPO@$PR_HASH on $host_id"

ensure_vars CI_NAME CHECK_NAME PR_REPO PR_BRANCH PACKAGE ALIBUILD_DEFAULTS PR_START_TIME

: "${WORKERS_POOL_SIZE:=1}" "${WORKER_INDEX:=0}" "${PR_REPO_CHECKOUT:=$(basename "$PR_REPO")}"

Expand Down Expand Up @@ -47,12 +50,12 @@ case "$BUILD_TYPE" in
# Create a status on GitHub showing the build start time, but only if this is
# the first build of this check!
# If we are running in Nomad, add a link to the this allocation.
untested) report_pr_errors --pending -m "Started $(TZ=Europe/Zurich date +'%a %H:%M CET') on $host_id" \
untested) report_pr_errors --pending -m "Started $PR_START_TIME on $host_id" \
${NOMAD_ALLOC_ID:+--log-url "https://alinomad.cern.ch/ui/allocations/$NOMAD_ALLOC_ID"} ;;
# Rebuilds only change the existing status's message, keeping the red status
# and URL intact.
failed) set-github-status -k -c "$PR_REPO@$PR_HASH" -s "$CHECK_NAME/$(build_type_to_status "$BUILD_TYPE")" \
-m "Rechecking since $(TZ=Europe/Zurich date +'%a %H:%M CET') on $host_id" ;;
-m "Rechecking since $PR_START_TIME on $host_id" ;;
# See above for why we don't update the status for green checks.
succeeded) ;;
esac
Expand Down
2 changes: 2 additions & 0 deletions report-pr-errors
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ class Logs(object):
self.fst_task_timeout or
self.fst_failed_command),
'hostname': htmlescape(platform.node()),
'pr_start_time': os.getenv('PR_START_TIME', ''),
'finish_time': datetime.datetime.now().strftime('%a %-d %b %Y, %H:%M:%S %Z'),
'repo': self.pr_built.repo_name,
'pr_id': self.pr_built.id,
Expand Down Expand Up @@ -588,6 +589,7 @@ PRETTY_LOG_TEMPLATE = '''\
<h1>The build %(status)s</h1>
<table>
<tr><th>Build host</th><td>%(hostname)s</td></tr>
<tr><th>Started at</th><td>%(pr_start_time)s</td></tr>
<tr><th>Finished at</th><td>%(finish_time)s</td></tr>
<tr><th>Built PR</th>
<td><a href="https://github.com/%(repo)s/pull/%(pr_id)s">%(repo)s#%(pr_id)s</a></td></tr>
Expand Down

0 comments on commit 4d4a85f

Please sign in to comment.