Updated sonar-scanner
Updated docs & code to drone 1.0 syntax
This commit is contained in:
parent
72e741c565
commit
b3f7d8facd
26
DOCS.md
26
DOCS.md
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
date: 2018-08-29T00:00:00+00:00
|
date: 2019-02-12T10:50:00+00:00
|
||||||
title: SonarQube
|
title: SonarQube
|
||||||
author: aosapps
|
author: aosapps
|
||||||
tags: [ Sonar, SonarQube, Analysis, report ]
|
tags: [ Sonar, SonarQube, Analysis, report ]
|
||||||
@ -15,7 +15,11 @@ The below pipeline configuration demonstrates simple usage:
|
|||||||
```yaml
|
```yaml
|
||||||
code-analysis:
|
code-analysis:
|
||||||
image: aosapps/drone-sonar-plugin
|
image: aosapps/drone-sonar-plugin
|
||||||
secrets: [sonar_host, sonar_token]
|
settings:
|
||||||
|
sonar_host:
|
||||||
|
from_secret: sonar_host
|
||||||
|
sonar_token:
|
||||||
|
from_secret: sonar_token
|
||||||
```
|
```
|
||||||
|
|
||||||
Customized parameters could be specified:
|
Customized parameters could be specified:
|
||||||
@ -23,13 +27,17 @@ Customized parameters could be specified:
|
|||||||
```diff
|
```diff
|
||||||
code-analysis:
|
code-analysis:
|
||||||
image: aosapps/drone-sonar-plugin
|
image: aosapps/drone-sonar-plugin
|
||||||
secrets: [sonar_host, sonar_token]
|
settings:
|
||||||
+ ver: 1.0
|
sonar_host:
|
||||||
+ timeout: 20
|
from_secret: sonar_host
|
||||||
+ sources: .
|
sonar_token:
|
||||||
+ level: DEBUG
|
from_secret: sonar_token
|
||||||
+ showProfiling: true
|
+ ver: 1.0
|
||||||
+ exclusions: **/static/**/*,**/dist/**/*.js
|
+ timeout: 20
|
||||||
|
+ sources: .
|
||||||
|
+ level: DEBUG
|
||||||
|
+ showProfiling: true
|
||||||
|
+ exclusions: **/static/**/*,**/dist/**/*.js
|
||||||
```
|
```
|
||||||
|
|
||||||
# Secret Reference
|
# Secret Reference
|
||||||
|
12
Dockerfile
12
Dockerfile
@ -1,13 +1,13 @@
|
|||||||
FROM openjdk:8-jre-alpine
|
FROM openjdk:8-jre-alpine
|
||||||
|
RUN apk add --no-cache --update nodejs
|
||||||
COPY drone-sonar /bin/
|
COPY drone-sonar /bin/
|
||||||
COPY lib/sonar-scanner-cli-3.2.0.1227.zip /bin
|
COPY lib/sonar-scanner-cli-3.3.0.1492.zip /bin
|
||||||
|
|
||||||
WORKDIR /bin
|
WORKDIR /bin
|
||||||
|
RUN unzip sonar-scanner-cli-3.3.0.1492.zip \
|
||||||
|
&& mv sonar-scanner-3.3.0.1492 sonar-scanner \
|
||||||
|
&& rm -rf sonar-scanner-cli-3.3.0.1492.zip
|
||||||
|
|
||||||
RUN unzip sonar-scanner-cli-3.2.0.1227.zip \
|
ENV PATH $PATH:/bin/sonar-scanner/bin
|
||||||
&& rm sonar-scanner-cli-3.2.0.1227.zip
|
|
||||||
|
|
||||||
ENV PATH $PATH:/bin/sonar-scanner-3.2.0.1227/bin
|
|
||||||
|
|
||||||
ENTRYPOINT /bin/drone-sonar
|
ENTRYPOINT /bin/drone-sonar
|
||||||
|
@ -25,6 +25,10 @@ docker run --rm \
|
|||||||
```yaml
|
```yaml
|
||||||
code-analysis:
|
code-analysis:
|
||||||
image: aosapps/drone-sonar-plugin
|
image: aosapps/drone-sonar-plugin
|
||||||
secrets: [sonar_host, sonar_token]
|
settings:
|
||||||
|
sonar_host:
|
||||||
|
from_secret: sonar_host
|
||||||
|
sonar_token:
|
||||||
|
from_secret: sonar_token
|
||||||
```
|
```
|
||||||
|
|
||||||
|
BIN
drone-sonar
BIN
drone-sonar
Binary file not shown.
Binary file not shown.
BIN
lib/sonar-scanner-cli-3.3.0.1492.zip
Normal file
BIN
lib/sonar-scanner-cli-3.3.0.1492.zip
Normal file
Binary file not shown.
33
main.go
33
main.go
@ -2,12 +2,11 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/codegangsta/cli"
|
"github.com/codegangsta/cli"
|
||||||
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
var build = "0" // build number set at compile time
|
var build = "1" // build number set at compile time
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := cli.NewApp()
|
app := cli.NewApp()
|
||||||
@ -30,12 +29,12 @@ func main() {
|
|||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "host",
|
Name: "host",
|
||||||
Usage: "SonarQube host",
|
Usage: "SonarQube host",
|
||||||
EnvVar: "SONAR_HOST",
|
EnvVar: "PLUGIN_SONAR_HOST",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "token",
|
Name: "token",
|
||||||
Usage: "SonarQube token",
|
Usage: "SonarQube token",
|
||||||
EnvVar: "SONAR_TOKEN",
|
EnvVar: "PLUGIN_SONAR_TOKEN",
|
||||||
},
|
},
|
||||||
|
|
||||||
// advanced parameters
|
// advanced parameters
|
||||||
@ -47,7 +46,7 @@ func main() {
|
|||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "timeout",
|
Name: "timeout",
|
||||||
Usage: "Web request timeout",
|
Usage: "Web request timeout",
|
||||||
Value: "60",
|
Value: "60",
|
||||||
EnvVar: "PLUGIN_TIMEOUT",
|
EnvVar: "PLUGIN_TIMEOUT",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
@ -86,18 +85,18 @@ func main() {
|
|||||||
func run(c *cli.Context) {
|
func run(c *cli.Context) {
|
||||||
plugin := Plugin{
|
plugin := Plugin{
|
||||||
Config: Config{
|
Config: Config{
|
||||||
Key: c.String("key"),
|
Key: c.String("key"),
|
||||||
Name: c.String("name"),
|
Name: c.String("name"),
|
||||||
Host: c.String("host"),
|
Host: c.String("host"),
|
||||||
Token: c.String("token"),
|
Token: c.String("token"),
|
||||||
|
|
||||||
Version: c.String("ver"),
|
Version: c.String("ver"),
|
||||||
Timeout: c.String("timeout"),
|
Timeout: c.String("timeout"),
|
||||||
Sources: c.String("sources"),
|
Sources: c.String("sources"),
|
||||||
Inclusions: c.String("inclusions"),
|
Inclusions: c.String("inclusions"),
|
||||||
Exclusions: c.String("exclusions"),
|
Exclusions: c.String("exclusions"),
|
||||||
Level: c.String("level"),
|
Level: c.String("level"),
|
||||||
showProfiling: c.String("showProfiling"),
|
showProfiling: c.String("showProfiling"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user