@grafana/plugin-validator 0.7.4 → 0.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +94 -11
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -6,36 +6,67 @@ A tool for validating community plugins for publishing to Grafana.com.
6
6
 
7
7
  The tool expects path to either a remote or a local ZIP archive.
8
8
 
9
- ## Install
9
+ ## Install and usage
10
+
11
+ ### With docker (recommended\*)
10
12
 
11
13
  ```SHELL
12
- cd pkg/cmd/plugincheck2
13
- go install
14
+ docker run --pull=always grafana/plugin-validator-cli -sourceCodeUri [source_code_location/] [plugin_archive.zip]
15
+ ```
16
+
17
+ Example:
18
+
19
+ ```SHELL
20
+ docker run --pull=always grafana/plugin-validator-cli -sourceCodeUri https://github.com/grafana/clock-panel/tree/v2.1.2 https://github.com/grafana/clock-panel/releases/download/v2.1.2/grafana-clock-panel-2.1.2.zip
14
21
  ```
15
22
 
16
- ## Run
23
+ > \* Docker is recommended because the image contains all the [security scanning tools](#security-tools) for the validator
17
24
 
18
- Typically running the checker with default settings is the easiest method to see if there are issues with a plugin.
25
+ ### With NPX
19
26
 
20
27
  ```SHELL
21
- plugincheck2 -config config/default.yaml https://github.com/marcusolsson/grafana-jsonapi-datasource/releases/download/v0.6.0/marcusolsson-json-datasource-0.6.0.zip
28
+ npx -y @grafana/plugin-validator -sourceCodeUri [source_code_location/] [plugin_archive.zip]
22
29
  ```
23
30
 
24
- To wrap the output with another tool (like the validator ui), running with the `terse-json.yaml` config can be used.
31
+ Example:
32
+
33
+ ```SHELL
34
+ npx -y @grafana/plugin-validator -sourceCodeUri https://github.com/grafana/clock-panel/tree/v2.1.2 https://github.com/grafana/clock-panel/releases/download/v2.1.2/grafana-clock-panel-2.1.2.zip
35
+ ```
36
+
37
+ ### Locally
38
+
39
+ First you must compile and install it
25
40
 
26
41
  ```SHELL
27
- plugincheck2 -config config/terse-json.yaml https://github.com/marcusolsson/grafana-jsonapi-datasource/releases/download/v0.6.0/marcusolsson-json-datasource-0.6.0.zip
42
+ git clone git@github.com:grafana/plugin-validator.git
43
+ cd plugin-validator/pkg/cmd/plugincheck2
44
+ go install
28
45
  ```
29
46
 
30
- Verbose json output is available to show all checks made, with status for each.
47
+ Then you can run the utility
31
48
 
32
49
  ```SHELL
33
- plugincheck2 -config config/verbose-json.yaml https://github.com/marcusolsson/grafana-jsonapi-datasource/releases/download/v0.6.0/marcusolsson-json-datasource-0.6.0.zip
50
+ plugincheck2 -sourceCodeUri [source_code_location/] [plugin_archive.zip]
51
+ ```
52
+
53
+ ## Options
54
+
55
+ ```
56
+ ❯ plugincheck2 -help
57
+ Usage plugincheck2:
58
+ -config string (optional)
59
+ Path to configuration file
60
+ -sourceCodeUri string (optional)
61
+ URI to the source code of the plugin. If set, the source code will be downloaded and analyzed. This can be a ZIP file URL, an URL to git repository or a local file (starting with `file://`)
62
+ -strict (optional)
63
+ If set, plugincheck returns non-zero exit code for warnings
64
+
34
65
  ```
35
66
 
36
67
  ## Configuration
37
68
 
38
- You must pass a configuration file to the validator with the `-config` option. Several configuraton examples are available to use here <https://github.com/grafana/plugin-validator/tree/main/config>
69
+ You can pass a configuration file to the validator with the `-config` option. Several configuraton examples are available to use here <https://github.com/grafana/plugin-validator/tree/main/config>
39
70
 
40
71
  ### Enabling and disabling analyzers via config
41
72
 
@@ -74,6 +105,58 @@ Severity levels could be: `error`, `warning`, `ok`
74
105
 
75
106
  Please notice that Grafanalabs uses its own configuration for plugins submissions and your own config file can't change these rules.
76
107
 
108
+ ## Debug mode
109
+
110
+ You can run the validator in debug mode to get more information about the running checks and possible errors.
111
+
112
+ With Docker:
113
+
114
+ ```SHELL
115
+ docker run --pull=always -e DEBUG=1 grafana/plugin-validator-cli -sourceCodeUri https://github.com/grafana/clock-panel/tree/v2.1.2 https://github.com/grafana/clock-panel/releases/download/v2.1.2/grafana-clock-panel-2.1.2.zip
116
+ ```
117
+
118
+ With NPX:
119
+
120
+ ```SHELL
121
+ DEBUG=1 npx -y @grafana/plugin-validator -sourceCodeUri https://github.com/grafana/clock-panel/tree/v2.1.2 https://github.com/grafana/clock-panel/releases/download/v2.1.2/grafana-clock-panel-2.1.2.zip
122
+ ```
123
+
124
+ Locally:
125
+
126
+ ```SHELL
127
+ DEBUG=1 plugincheck2 -sourceCodeUri https://github.com/grafana/clock-panel/tree/v2.1.2 https://github.com/grafana/clock-panel/releases/download/v2.1.2/grafana-clock-panel-2.1.2.zip
128
+ ```
129
+
130
+ ## Sourcecode and Git repositories
131
+
132
+ You may pass the sourceCodeUri to the validator in order to perform source code checks (`-sourceCodeUri` option).
133
+
134
+ ### Using git URLs
135
+
136
+ The following git services are supported
137
+
138
+ - GitHub
139
+ - GitLab
140
+ - Bitbucket
141
+
142
+ Make sure to include the ref (branch or tag) of the corresponding source code.
143
+
144
+ e.g.: You are validating version `v2.1.2` and your project is in github. Make sure you create a corresponding tag or branch and use the url `https://github.com/grafana/clock-panel/tree/v2.1.2`
145
+
146
+ > Do you use a different service and would like us to support it? Open a [feature request](https://github.com/grafana/clock-panel/issues)
147
+
148
+ ## Security tools
149
+
150
+ This validator makes uses of the following open source security tools:
151
+
152
+ - [osv-scanner](https://github.com/google/osv-scanner)
153
+ - [semgrep](https://github.com/returntocorp/semgrep)
154
+ - [gosec](https://github.com/securego/gosec)
155
+
156
+ If you run the validator locally or via NPX you can benefit from installing these tools in your system to make them part of your validation checks.
157
+
158
+ ---
159
+
77
160
  ## Analyzers
78
161
 
79
162
  The plugincheck tool runs a series of analyzers to ensure submitted plugins are following best practices, and speed up the process of approving a plugin for publishing.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/plugin-validator",
3
- "version": "0.7.4",
3
+ "version": "0.7.5",
4
4
  "description": "Grafana Plugin Validator",
5
5
  "main": "index.js",
6
6
  "scripts": {