show different icon if build failed but pkg_url is set

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2020-07-06 19:04:07 +02:00
parent dfe95c0e2b
commit 921ce93902
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
3 changed files with 25 additions and 15 deletions

View File

@ -21,10 +21,18 @@ const buildsTable = `
{{/each}}
`.trim()
const buildRow = `
{{#if this.success}}
{{#if this.success }}
{{#if this.pkg_url }}
| :heavy_check_mark: | {{ this.commit }} | [{{ this.id }}]({{ this.url }}) | {{formatDate this.meta.created }} | {{ shortenDuration this.duration }} | \`{{ this.platform }}\` | [:package:\`{{fileExt this.pkg_url }}\`]({{ this.pkg_url }}) {{ genQRCodeUrl this.pkg_url }}|
{{else}}
| :interrobang: | {{ this.commit }} | [{{ this.id }}]({{ this.url }}) | {{formatDate this.meta.created }} | {{ shortenDuration this.duration }} | \`{{ this.platform }}\` | [:page_facing_up:\`log\`]({{ this.url }}consoleText) |
{{/if}}
{{else}}
{{#if this.pkg_url }}
| :heavy_multiplication_x: | {{ this.commit }} | [{{ this.id }}]({{ this.url }}) | {{formatDate this.meta.created }} | {{ shortenDuration this.duration }} | \`{{ this.platform }}\` | [:package:\`{{fileExt this.pkg_url }}\`]({{ this.pkg_url }}) {{ genQRCodeUrl this.pkg_url }}|
{{else}}
| :x: | {{ this.commit }} | [{{ this.id }}]({{ this.url }}) | {{formatDate this.meta.created }} | {{ shortenDuration this.duration }} | \`{{ this.platform }}\` | [:page_facing_up:\`log\`]({{ this.url }}consoleText) |
{{/if}}
{{/if}}
`.trim()
module.exports = { main, partials: {buildRow, buildsTable} }

View File

@ -12,8 +12,8 @@ const COMMENT = `
### Jenkins Builds
| :grey_question: | Commit | :hash: | Finished (UTC) | Duration | Platform | Result |
|-|-|-|-|-|-|-|
| :heavy_check_mark: | COMMIT-0 | [ID-1](URL-1/) | 2018-12-20 08:25:56 | DURATION-1 | \`PLATFORM-1\` | [:package:\`exe\`](https://example.org/StatusIm-123-456-abc-pr.exe) |
| :heavy_check_mark: | COMMIT-0 | [ID-2](URL-2/) | 2018-12-20 08:26:53 | DURATION-2 | \`PLATFORM-2\` | [:package:\`App\`](https://example.org/StatusIm-123-456-abc-pr.AppImage) |
| :heavy_check_mark: | COMMIT-0 | [ID-1](URL-1/) | 2018-12-20 08:25:56 | DURATION-1 | \`PLATFORM-1\` | [:package:\`apk\`](https://example.org/StatusIm-123-456-abc-pr.apk) [:calling:](https://chart.apis.google.com/chart?cht=qr&chs=400x400&chld=L%7C%0A1&chl=https%3A%2F%2Fexample.org%2FStatusIm-123-456-abc-pr.apk)|
| :heavy_check_mark: | COMMIT-0 | [ID-2](URL-2/) | 2018-12-20 08:26:53 | DURATION-2 | \`PLATFORM-2\` | [:package:\`exe\`](https://example.org/StatusIm-123-456-abc-pr.exe) |
`
const COMMENT_FOLDED = `
@ -23,24 +23,24 @@ const COMMENT_FOLDED = `
| :grey_question: | Commit | :hash: | Finished (UTC) | Duration | Platform | Result |
|-|-|-|-|-|-|-|
| :heavy_check_mark: | COMMIT-0 | [ID-1](URL-1/) | 2018-12-20 08:25:56 | DURATION-1 | \`PLATFORM-1\` | [:package:\`exe\`](https://example.org/StatusIm-123-456-abc-pr.exe) |
| :heavy_check_mark: | COMMIT-0 | [ID-2](URL-2/) | 2018-12-20 08:26:53 | DURATION-2 | \`PLATFORM-2\` | [:package:\`App\`](https://example.org/StatusIm-123-456-abc-pr.AppImage) |
| :heavy_check_mark: | COMMIT-0 | [ID-1](URL-1/) | 2018-12-20 08:25:56 | DURATION-1 | \`PLATFORM-1\` | [:package:\`apk\`](https://example.org/StatusIm-123-456-abc-pr.apk) [:calling:](https://chart.apis.google.com/chart?cht=qr&chs=400x400&chld=L%7C%0A1&chl=https%3A%2F%2Fexample.org%2FStatusIm-123-456-abc-pr.apk)|
| :heavy_check_mark: | COMMIT-0 | [ID-2](URL-2/) | 2018-12-20 08:26:53 | DURATION-2 | \`PLATFORM-2\` | [:package:\`exe\`](https://example.org/StatusIm-123-456-abc-pr.exe) |
| :x: | COMMIT-0 | [ID-3](URL-3/) | 2018-12-20 08:27:50 | DURATION-3 | \`PLATFORM-3\` | [:page_facing_up:\`log\`](URL-3/consoleText) |
| | | | | | | |
| :heavy_check_mark: | COMMIT-1 | [ID-4](URL-4/) | 2018-12-20 08:28:47 | DURATION-4 | \`PLATFORM-4\` | [:package:\`pkg\`](https://unknown.example.org/path/package) |
| :heavy_check_mark: | COMMIT-1 | [ID-5](URL-5/) | 2018-12-20 08:29:43 | DURATION-5 | \`PLATFORM-5\` | [:package:\`apk\`](https://example.org/StatusIm-123-456-abc-pr.apk) [:calling:](https://chart.apis.google.com/chart?cht=qr&chs=400x400&chld=L%7C%0A1&chl=https%3A%2F%2Fexample.org%2FStatusIm-123-456-abc-pr.apk)|
| :x: | COMMIT-1 | [ID-6](URL-6/) | 2018-12-20 08:30:40 | DURATION-6 | \`PLATFORM-6\` | [:page_facing_up:\`log\`](URL-6/consoleText) |
| :heavy_check_mark: | COMMIT-1 | [ID-7](URL-7/) | 2018-12-20 08:31:37 | DURATION-7 | \`PLATFORM-7\` | [:package:\`App\`](https://example.org/StatusIm-123-456-abc-pr.AppImage) |
| :heavy_check_mark: | COMMIT-1 | [ID-4](URL-4/) | 2018-12-20 08:28:47 | DURATION-4 | \`PLATFORM-4\` | [:package:\`App\`](https://example.org/StatusIm-123-456-abc-pr.AppImage) |
| :heavy_check_mark: | COMMIT-1 | [ID-5](URL-5/) | 2018-12-20 08:29:43 | DURATION-5 | \`PLATFORM-5\` | [:package:\`ipa\`](https://i.diawi.com/ABCDxyz1) [:calling:](https://chart.apis.google.com/chart?cht=qr&chs=400x400&chld=L%7C%0A1&chl=https%3A%2F%2Fi.diawi.com%2FABCDxyz1)|
| :heavy_multiplication_x: | COMMIT-1 | [ID-6](URL-6/) | 2018-12-20 08:30:40 | DURATION-6 | \`PLATFORM-6\` | [:package:\`pkg\`](https://unknown.example.org/path/package) |
| :interrobang: | COMMIT-1 | [ID-7](URL-7/) | 2018-12-20 08:31:37 | DURATION-7 | \`PLATFORM-7\` | [:page_facing_up:\`log\`](URL-7/consoleText) |
</details>
| :grey_question: | Commit | :hash: | Finished (UTC) | Duration | Platform | Result |
|-|-|-|-|-|-|-|
| :heavy_check_mark: | COMMIT-2 | [ID-8](URL-8/) | 2018-12-20 08:32:34 | DURATION-8 | \`PLATFORM-8\` | [:package:\`ipa\`](https://i.diawi.com/ABCDxyz1) [:calling:](https://chart.apis.google.com/chart?cht=qr&chs=400x400&chld=L%7C%0A1&chl=https%3A%2F%2Fi.diawi.com%2FABCDxyz1)|
| :x: | COMMIT-2 | [ID-9](URL-9/) | 2018-12-20 08:33:31 | DURATION-9 | \`PLATFORM-9\` | [:page_facing_up:\`log\`](URL-9/consoleText) |
| :heavy_check_mark: | COMMIT-2 | [ID-10](URL-10/) | 2018-12-20 08:34:27 | DURATION-10 | \`PLATFORM-10\` | [:package:\`apk\`](https://example.org/StatusIm-123-456-abc-pr.apk) [:calling:](https://chart.apis.google.com/chart?cht=qr&chs=400x400&chld=L%7C%0A1&chl=https%3A%2F%2Fexample.org%2FStatusIm-123-456-abc-pr.apk)|
| :heavy_check_mark: | COMMIT-2 | [ID-11](URL-11/) | 2018-12-20 08:35:24 | DURATION-11 | \`PLATFORM-11\` | [:package:\`exe\`](https://example.org/StatusIm-123-456-abc-pr.exe) |
| :heavy_check_mark: | COMMIT-2 | [ID-8](URL-8/) | 2018-12-20 08:32:34 | DURATION-8 | \`PLATFORM-8\` | [:package:\`apk\`](https://example.org/StatusIm-123-456-abc-pr.apk) [:calling:](https://chart.apis.google.com/chart?cht=qr&chs=400x400&chld=L%7C%0A1&chl=https%3A%2F%2Fexample.org%2FStatusIm-123-456-abc-pr.apk)|
| :heavy_multiplication_x: | COMMIT-2 | [ID-9](URL-9/) | 2018-12-20 08:33:31 | DURATION-9 | \`PLATFORM-9\` | [:package:\`exe\`](https://example.org/StatusIm-123-456-abc-pr.exe) |
| :interrobang: | COMMIT-2 | [ID-10](URL-10/) | 2018-12-20 08:34:27 | DURATION-10 | \`PLATFORM-10\` | [:page_facing_up:\`log\`](URL-10/consoleText) |
| :heavy_check_mark: | COMMIT-2 | [ID-11](URL-11/) | 2018-12-20 08:35:24 | DURATION-11 | \`PLATFORM-11\` | [:package:\`App\`](https://example.org/StatusIm-123-456-abc-pr.AppImage) |
| | | | | | | |
| :x: | COMMIT-3 | [ID-12](URL-12/) | 2018-12-20 08:36:21 | DURATION-12 | \`PLATFORM-12\` | [:page_facing_up:\`log\`](URL-12/consoleText) |
| :heavy_multiplication_x: | COMMIT-3 | [ID-12](URL-12/) | 2018-12-20 08:36:21 | DURATION-12 | \`PLATFORM-12\` | [:package:\`ipa\`](https://i.diawi.com/ABCDxyz1) [:calling:](https://chart.apis.google.com/chart?cht=qr&chs=400x400&chld=L%7C%0A1&chl=https%3A%2F%2Fi.diawi.com%2FABCDxyz1)|
`
describe('Comments', () => {

View File

@ -1,9 +1,11 @@
const PKG_URLS = [
'https://example.org/StatusIm-123-456-abc-pr.apk',
'https://example.org/StatusIm-123-456-abc-pr.exe',
null,
'https://example.org/StatusIm-123-456-abc-pr.AppImage',
'https://i.diawi.com/ABCDxyz1',
'https://unknown.example.org/path/package',
null,
]
/* example valid build */
@ -24,7 +26,7 @@ const getBuild = (idx) => ({
platform: `PLATFORM-${idx}`,
duration: `DURATION-${idx} 12 sec`,
url: `URL-${idx}/`,
pkg_url: PKG_URLS[idx%PKG_URLS.length],
pkg_url: PKG_URLS[(idx-1)%PKG_URLS.length],
meta: { created: 1545294300000+(idx*56789) },
})