Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report PR start time too #1407

Merged
merged 3 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
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 +'%Y-%m-%d, %a %H:%M CET')
ktf marked this conversation as resolved.
Show resolved Hide resolved
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
Loading