{% extends "projects/base.html" %} {% import "site_shell/_macros.html" as ui %} {% block title %}{{ watch.name }} - Watch - {{ project.name }} - Pychestrate{% endblock %} {% block content %} {% macro event_summary(event) -%} {%- if event.tag is defined and event.tag %}New tag {{ event.tag }} {%- elif event.build_id is defined and event.build_id %}Build #{{ event.build_id }} {{ event.build_status if event.build_status is defined and event.build_status else 'finished' }}{% if event.branch is defined and event.branch %} on {{ event.branch }}{% endif %} {%- elif event.created is defined and event.created %}New branch {{ event.branch }} {%- elif event.branch is defined and event.branch %}New commits on {{ event.branch }} {%- else %}Event{% endif -%} {%- if event.commit_sha is defined and event.commit_sha and event.commit_sha != 'HEAD' %} ({{ event.commit_sha[:10] }}){% endif -%} {%- endmacro %} {% set trigger = watch.trigger_source.value %} {% set sample_status = test_sample.sample_build_status if test_sample.sample_build_status is defined else 'succeeded' %}
{{ watch.description or 'Event watch' }}
| Branch | {% if watch.conditions.branch_pattern %}matches {{ watch.conditions.branch_pattern }}{% else %}any branch{% endif %} |
|---|---|
| Tag | {% if watch.conditions.tag_pattern %}matches {{ watch.conditions.tag_pattern }}{% else %}any tag{% endif %} |
| Build result | {% if watch.conditions.build_status in ('succeeded', 'failed') %}{{ watch.conditions.build_status }}{% else %}succeeded or failed{% endif %} |
| Changed files | match {{ watch.conditions.file_pattern }} |
| Created | {{ watch.created_at | format_datetime('%Y-%m-%d %H:%M:%S') }} |
| Updated | {{ watch.updated_at | format_datetime('%Y-%m-%d %H:%M:%S') }} |
| Action | Target | Parameters |
|---|---|---|
| {{ action_labels.get(action.action.value, action.action.value) }} | {% if action.action.value == 'trigger_build' %} {{ target_names.get('trigger_build:' ~ action.target_id) or ('Build specification #' ~ action.target_id ~ ' (removed)') }} {% elif action.action.value == 'trigger_pipeline' %} {{ target_names.get('trigger_pipeline:' ~ action.target_id) or ('Pipeline #' ~ action.target_id ~ ' (removed)') }} {% elif action.action.value == 'trigger_infra_job' %} {{ target_names.get('trigger_infra_job:' ~ action.target_id) or ('Infrastructure specification #' ~ action.target_id ~ ' (removed)') }} {% elif action.action.value == 'trigger_test_job' %} {{ target_names.get('trigger_test_job:' ~ action.target_id) or ('Test specification #' ~ action.target_id ~ ' (removed)') }} {% elif action.target_id %} #{{ action.target_id }} {% else %} none {% endif %} | {% if action.parameters %}{{ action.parameters | tojson }}{% else %}none{% endif %} |
Check a sample event against the conditions. Nothing is run.
{% if test_result %}Would run This event matches every condition, so the watch would run its {{ test_result.actions_count }} action{{ '' if test_result.actions_count == 1 else 's' }}.
{% elif test_result.conditions_match %}Would not run The event matches, but the watch is disabled.
{% else %}Would not run The event does not match every condition.
{% endif %}| Condition | Requires | Sample | Result |
|---|---|---|---|
| {{ label }} | {% if key == 'build_status' %}{{ outcome.pattern }}{% else %}matches {{ outcome.pattern }}{% endif %} |
{{ outcome.value or '(empty)' }} | {% if outcome.matches %}matches{% else %}does not match{% endif %} |
This watch has no conditions. {{ {'repository_commit': 'Every new commit', 'repository_branch': 'Every new branch', 'repository_tag': 'Every new tag', 'build_completion': 'Every finished build'}.get(trigger, 'Every event') }} starts it.
{% endif %}| Triggered At | Event | Actions | Result |
|---|---|---|---|
| {{ log.triggered_at | format_datetime('%Y-%m-%d %H:%M:%S') }} | {% if log.trigger_event %}{{ event_summary(log.trigger_event) }}{% else %}n/a{% endif %} |
{% for executed in log.actions_executed %}
{% set action_value = executed.action if executed.action is defined else 'action' %}
{{ action_labels.get(action_value, action_value) }}{% if executed.success is defined and executed.success %}{% if executed.result_id is defined and executed.result_id %}: #{{ executed.result_id }} started{% else %}: done{% endif %}{% endif %}
{% else %}
none
{% endfor %}
|
{% if log.success %}
succeeded
{% else %}
failed
{% if log.error_message %} {{ log.error_message }} {% endif %}
{% endif %}
|