Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Commit 5f61696

Browse files
authored
Add advanced usage and TOC (#172)
* Add advanced usage and TOC * Pngcrush * Update haiku
1 parent 71c25da commit 5f61696

12 files changed

+87
-3
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
work/
22
target/
33
.idea
4+
.DS_Store

Diff for: docs/advanced.md

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
Advanced Usage
2+
==============
3+
4+
In addition to Unit and Coverage results, this plugin supports two additional features
5+
you may want to take use of. Both options take a maximum number of bytes to copy, since the plugin
6+
is executed on the Jenkins master and syncing multiple megabytes of data can cause
7+
performance problems.
8+
9+
Custom Comments
10+
---------------
11+
12+
If you'd like to post additional text back to Phabricator, you can add text to the `.phabricator-comment` file
13+
(you can change the name of the file in your job configuration page):
14+
15+
![Comment Configuration](/docs/custom-comment.png)
16+
17+
Any text present in this file will be echoed verbatim to the comment that Jenkins posts back to
18+
Phabricator. If you'd like to preserve formatting, check the "Preserve Formatting" block and the
19+
plugin will surround the comment in triple-backticks (```)
20+
21+
Custom Lint
22+
-----------
23+
24+
If you'd like to send Lint Violations as well, you can echo Harbormaster-compatible JSON
25+
(where each line is a valid JSON dictionary) into the `.phabricator-lint` file.
26+
27+
Although each **line** must be valid JSON, note that the file as a whole is **not valid JSON**
28+
(e.g. if you call `JSON.parse('.phabricator-lint')`) it will fail. This is a design decision to
29+
make it easy for build scripts to `tee` (echo line-by-line) violations without having to
30+
produce well-formed JSON, which requires knowing upfront how many violations are present.
31+
32+
![Lint Configuration](/docs/custom-lint.png)
33+
34+
If a job was configured to run the following shell script:
35+
36+
```bash
37+
mkdir example
38+
echo "Once upon a time\nThere was a Jenkins plugin" > example/path
39+
# NOTE: tee -a to support appending multiple lints
40+
echo '{"name": "Comment Name", "code": "Haiku", "severity": "error", "path": "example/path", "line": 2, "char": 0, "description": "Line is not a Haiku" }' | tee -a .phabricator-lint
41+
```
42+
43+
You would see the following in your differential at the top:
44+
45+
![Inline Diff Lint](/docs/example-path-haiku.png)
46+
47+
And the following in the code view:
48+
49+
![Inline Diff Lint](/docs/inline-haiku.png)
50+
51+
See [Harbormaster Lint](https://secure.phabricator.com/conduit/method/harbormaster.sendmessage/)
52+
API for details on the supported JSON keys. `line`, `char`, and `description` are all optional.
53+
The rest are required.
54+
55+
The severity parameter recognizes these severity levels:
56+
57+
| Key | Name |
58+
|----------|----------|
59+
| advice | Advice |
60+
| autofix | Auto-Fix |
61+
| warning | Warning |
62+
| error | Error |
63+
| disabled | Disabled |

Diff for: docs/configure-job-parameters.png

-48.1 KB
Loading

Diff for: docs/configure-job-post-build.png

-17.9 KB
Loading

Diff for: docs/custom-comment.png

33.9 KB
Loading

Diff for: docs/custom-lint.png

28.6 KB
Loading

Diff for: docs/example-path-haiku.png

16 KB
Loading

Diff for: docs/harbormaster-plan.png

-83.8 KB
Loading

Diff for: docs/herald-rule.png

-66.9 KB
Loading

Diff for: docs/inline-haiku.png

29.2 KB
Loading

Diff for: docs/uberalls-integration.png

-86.1 KB
Loading

Diff for: readme.md

+23-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@ if Harbormaster is not enabled).
77
[Phabricator]: http://phabricator.org/
88
[Jenkins]: https://jenkins-ci.org/
99

10+
Table of Contents
11+
=================
12+
* [Configuration](#configuration)
13+
* [Phabricator Configuration](#phabricator-configuration)
14+
* [Jenkins Setup](#jenkins-setup)
15+
* [Usage](#usage)
16+
* [Jenkins Job](#jenkins-job)
17+
* [Harbormaster](#harbormaster)
18+
* [Herald](#herald)
19+
* [Advanced Usage](docs/advanced.md)
20+
* [Test Your Configuration](#test-your-configuration)
21+
* [Development](#development)
22+
* [Testing](#testing)
23+
1024
Configuration
1125
=============
1226

@@ -56,7 +70,7 @@ Jenkins Job
5670
1. Navigate to the **Post-build Actions** section.
5771
2. Click the **Add post-build action** button and select **Post to Phabricator**.
5872
3. Make sure the **Comment on Success** and **Comment with console link on Failure** checkboxes are selected.
59-
4. Optionally:
73+
4. Optionally:
6074
1. If you have [Uberalls](https://github.com/uber/uberalls) enabled, enter a path to scan for Cobertura reports.
6175
2. If you want to post additional text to Phabricator other than "Pass" and "Fail", select the **Add Custom Comment** checkbox. Then create a `.phabricator-comment` file and enter the text you want Jenkins to add to the build status comment in Phabricator.
6276
![Add post-build action](/docs/configure-job-post-build.png)
@@ -75,9 +89,9 @@ With Phabricator, Jenkins, and your Jenkins jobs configured it's time to configu
7589
7. Use this template URI to fill in the URI field for the build plan: `https://ci.example.com/buildByToken/buildWithParameters?job=test-example&DIFF_ID=${buildable.diff}&PHID=${target.phid}`
7690

7791
Be sure to replace `https://ci.example.com` with the URI of your Jenkins instance and `test-example` with the name of your Jenkins job.
78-
92+
7993
If your Jenkins instance is exposed to the internet, make sure to install the [Build Token Root Plugin][] and fill in the `token` parameter.
80-
94+
8195
[Build Token Root Plugin]: https://wiki.jenkins-ci.org/display/JENKINS/Build+Token+Root+Plugin
8296

8397
8. Click the **When Complete** dropdown menu and select **Wait For Message**.
@@ -110,6 +124,12 @@ commenting on your diff:
110124

111125
![Example](/docs/uberalls-integration.png)
112126

127+
Advanced Usage
128+
--------------
129+
130+
Now that you have build status and optionally coverage data set up, check out some
131+
[advanced features](docs/advanced.md).
132+
113133
Development
114134
-----------
115135

0 commit comments

Comments
 (0)