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

Annotations priority docs #2683

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions pages/agent/v3/cli_annotate.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,27 @@ steps:

<%= image "annotations-styles.png", alt: "Screenshot of available annotation styles" %>

## Annotation ordering

Annotations are ordered by priority (highest to lowest) and then by most recently created. Priority can be set with the `--priority` option when creating the annotation with `buildkite-agent annotate`. Priority ranges from `1` to `10`, with `10` being the highest priority and `1` being the lowest. If priority is not set, the default priority is `3`. If two annotations have the same priority, the one created most recently will be displayed first.
matthewborden marked this conversation as resolved.
Show resolved Hide resolved

This is an example pipeline that showcases how to use priority to order annotations:

```yaml
steps:
- label: "\:console\: Annotation Test"
command: |
buildkite-agent annotate 'Example 1 (Priority 1)' --context 'first' --priority 1
buildkite-agent annotate 'Example 2 (Priority 10)' --style 'info' --context 'second' --priority 10
buildkite-agent annotate 'Example 3 (Priority 4)' --style 'warning' --context 'third' --priority 4
buildkite-agent annotate 'Example 4 (Priority 4)' --style 'error' --context 'fourth' --priority 4
buildkite-agent annotate 'Example 5 (Priority 3, Default)' --style 'success' --context 'fifth'
Comment on lines +50 to +54
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the code block doesn't hold the entire width of each line, I'd move the --priority X options to the first position, similar to how the --style options are in the first position (in the section above)...

Suggested change
buildkite-agent annotate 'Example 1 (Priority 1)' --context 'first' --priority 1
buildkite-agent annotate 'Example 2 (Priority 10)' --style 'info' --context 'second' --priority 10
buildkite-agent annotate 'Example 3 (Priority 4)' --style 'warning' --context 'third' --priority 4
buildkite-agent annotate 'Example 4 (Priority 4)' --style 'error' --context 'fourth' --priority 4
buildkite-agent annotate 'Example 5 (Priority 3, Default)' --style 'success' --context 'fifth'
buildkite-agent annotate 'Example 1 (Priority 1)' --priority 1 --context 'first'
buildkite-agent annotate 'Example 2 (Priority 10)' --priority 10 --style 'info' --context 'second'
buildkite-agent annotate 'Example 3 (Priority 4)' --priority 4 --style 'warning' --context 'third'
buildkite-agent annotate 'Example 4 (Priority 4)' --priority 4 --style 'error' --context 'fourth'
buildkite-agent annotate 'Example 5 (Priority 3, Default)' --style 'success' --context 'fifth'

```

Which would produce the following ordering:
matthewborden marked this conversation as resolved.
Show resolved Hide resolved

<%= image "annotations-priority.png", alt: "Screenshot of annotations with different priorities" %>

## Supported Markdown syntax

We use CommonMark with GitHub Flavored Markdown extensions to provide consistent, unambiguous Markdown syntax.
Expand Down
9 changes: 9 additions & 0 deletions pages/apis/rest_api/annotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ curl -H "Authorization: Bearer $TOKEN" \
"id": "de0d4ab5-6360-467a-a34b-e5ef5db5320d",
"context": "default",
"style": "info",
"priority" : 3,
"body_html": "<h1>My Markdown Heading</h1>\n<img src=\"artifact://indy.png\" alt=\"Belongs in a museum\" height=250 />",
"created_at": "2019-04-09T18:07:15.775Z",
"updated_at": "2019-08-06T20:58:49.396Z"
Expand All @@ -42,6 +43,7 @@ curl -H "Authorization: Bearer $TOKEN" \
"id": "5b3ceff6-78cb-4fe9-88ae-51be5f145977",
"context": "coverage",
"style": "info",
"priority" : 3,
"body_html": "Read the <a href=\"artifact://coverage/index.html\">uploaded coverage report</a>",
"created_at": "2019-04-09T18:07:16.320Z",
"updated_at": "2019-04-09T18:07:16.320Z"
Expand Down Expand Up @@ -123,6 +125,13 @@ Optional [request body properties](/docs/api#request-body-properties):
<p class="Docs__api-param-eg"><em>Example:</em> <code>"coverage"</code></p>
</td>
</tr>
<tr>
<th><code>priority</code></th>
<td>
An integer value by which to order the annotations on the build. This allows influencing the order of annotations. Ranges from 1 to 10, with 10 being the highest priority and 1 being the lowest. If priority is not set, the default priority is 3.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
An integer value by which to order the annotations on the build. This allows influencing the order of annotations. Ranges from 1 to 10, with 10 being the highest priority and 1 being the lowest. If priority is not set, the default priority is 3.
An integer value used to order the annotations on the build, allowing for controlled prioritization. Priority levels ranges from 1 to 10, with 10 being the highest priority and 1 being the lowest. If not specified, annotations default to a priority of 3.

seeing if I can make the phrasing just a little more concise :)

<p class="Docs__api-param-eg"><em>Example:</em> <code>"coverage"</code></p>
</td>
</tr>
<tr>
<th><code>append</code></th>
<td>
Expand Down
Loading