Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
eac66813
Unverified
Commit
eac66813
authored
Jan 06, 2020
by
Ryan McKinley
Committed by
GitHub
Jan 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Toolkit: add git log info to the plugin build report (#21344)
parent
f0764ced
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
2 deletions
+56
-2
packages/grafana-toolkit/src/cli/tasks/plugin.ci.ts
+2
-1
packages/grafana-toolkit/src/plugins/types.ts
+17
-0
packages/grafana-toolkit/src/plugins/utils.ts
+37
-1
No files found.
packages/grafana-toolkit/src/cli/tasks/plugin.ci.ts
View file @
eac66813
...
@@ -9,7 +9,7 @@ import { PluginMeta } from '@grafana/data';
...
@@ -9,7 +9,7 @@ import { PluginMeta } from '@grafana/data';
import
execa
=
require
(
'execa'
);
import
execa
=
require
(
'execa'
);
import
path
=
require
(
'path'
);
import
path
=
require
(
'path'
);
import
fs
from
'fs'
;
import
fs
from
'fs'
;
import
{
getPackageDetails
,
findImagesInFolder
,
getGrafanaVersions
}
from
'../../plugins/utils'
;
import
{
getPackageDetails
,
findImagesInFolder
,
getGrafanaVersions
,
readGitLog
}
from
'../../plugins/utils'
;
import
{
import
{
job
,
job
,
getJobFolder
,
getJobFolder
,
...
@@ -324,6 +324,7 @@ const pluginReportRunner: TaskRunner<PluginCIOptions> = async ({ upload }) => {
...
@@ -324,6 +324,7 @@ const pluginReportRunner: TaskRunner<PluginCIOptions> = async ({ upload }) => {
tests
:
agregateTestInfo
(),
tests
:
agregateTestInfo
(),
artifactsBaseURL
:
await
getCircleDownloadBaseURL
(),
artifactsBaseURL
:
await
getCircleDownloadBaseURL
(),
grafanaVersion
:
getGrafanaVersions
(),
grafanaVersion
:
getGrafanaVersions
(),
git
:
await
readGitLog
(),
};
};
const
pr
=
getPullRequestNumber
();
const
pr
=
getPullRequestNumber
();
if
(
pr
)
{
if
(
pr
)
{
...
...
packages/grafana-toolkit/src/plugins/types.ts
View file @
eac66813
...
@@ -11,6 +11,7 @@ export interface PluginBuildReport {
...
@@ -11,6 +11,7 @@ export interface PluginBuildReport {
workflow
:
WorkflowInfo
;
workflow
:
WorkflowInfo
;
coverage
:
CoverageInfo
[];
coverage
:
CoverageInfo
[];
tests
:
TestResultsInfo
[];
tests
:
TestResultsInfo
[];
git
?:
GitLogInfo
;
pullRequest
?:
number
;
pullRequest
?:
number
;
artifactsBaseURL
?:
string
;
artifactsBaseURL
?:
string
;
grafanaVersion
?:
KeyValue
<
string
>
;
grafanaVersion
?:
KeyValue
<
string
>
;
...
@@ -70,3 +71,19 @@ export interface ZipFileInfo {
...
@@ -70,3 +71,19 @@ export interface ZipFileInfo {
sha1
?:
string
;
sha1
?:
string
;
md5
?:
string
;
md5
?:
string
;
}
}
interface
UserInfo
{
name
:
string
;
email
:
string
;
time
?:
number
;
}
export
interface
GitLogInfo
{
commit
:
string
;
tree
:
string
;
subject
:
string
;
body
?:
string
;
notes
?:
string
;
author
:
UserInfo
;
commiter
:
UserInfo
;
}
packages/grafana-toolkit/src/plugins/utils.ts
View file @
eac66813
...
@@ -2,7 +2,7 @@ import execa from 'execa';
...
@@ -2,7 +2,7 @@ import execa from 'execa';
import
path
from
'path'
;
import
path
from
'path'
;
import
fs
from
'fs'
;
import
fs
from
'fs'
;
import
{
KeyValue
}
from
'@grafana/data'
;
import
{
KeyValue
}
from
'@grafana/data'
;
import
{
ExtensionSize
,
ZipFileInfo
}
from
'./types'
;
import
{
ExtensionSize
,
ZipFileInfo
,
GitLogInfo
}
from
'./types'
;
const
md5File
=
require
(
'md5-file'
);
const
md5File
=
require
(
'md5-file'
);
...
@@ -92,3 +92,39 @@ export function findImagesInFolder(dir: string, prefix = '', append?: string[]):
...
@@ -92,3 +92,39 @@ export function findImagesInFolder(dir: string, prefix = '', append?: string[]):
return
imgs
;
return
imgs
;
}
}
export
async
function
readGitLog
():
Promise
<
GitLogInfo
|
undefined
>
{
try
{
let
exe
=
await
execa
(
'git'
,
[
'log'
,
'-1'
,
// last line
'--pretty=format:{%n "commit": "%H",%n "tree": "%T",%n "subject": "%s",%n "author": {%n "name": "%aN",%n "email": "%aE",%n "time":"%at" },%n "commiter": {%n "name": "%cN",%n "email": "%cE",%n "time":"%ct" }%n}'
,
]);
const
info
=
JSON
.
parse
(
exe
.
stdout
)
as
GitLogInfo
;
// Read the body
exe
=
await
execa
(
'git'
,
[
'log'
,
'-1'
,
// last line
'--pretty=format:%b'
,
// Just the body (with newlines!)
]);
if
(
exe
.
stdout
&&
exe
.
stdout
.
length
)
{
info
.
body
=
exe
.
stdout
.
trim
();
}
// Read any commit notes
exe
=
await
execa
(
'git'
,
[
'log'
,
'-1'
,
// last line
'--pretty=format:%N'
,
// commit notes (with newlines!)
]);
if
(
exe
.
stdout
&&
exe
.
stdout
.
length
)
{
info
.
notes
=
exe
.
stdout
.
trim
();
}
return
info
;
}
catch
(
err
)
{
console
.
warn
(
'Error REading Git log info'
,
err
);
}
return
undefined
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment