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

Commit 3d7a3b1

Browse files
authored
Merge pull request #1 from OnekO/update/drone-1.0
Update/drone 1.0
2 parents 72e741c + d57e2a5 commit 3d7a3b1

File tree

6 files changed

+48
-32
lines changed

6 files changed

+48
-32
lines changed

DOCS.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
date: 2018-08-29T00:00:00+00:00
2+
date: 2019-02-12T10:50:00+00:00
33
title: SonarQube
44
author: aosapps
55
tags: [ Sonar, SonarQube, Analysis, report ]
@@ -15,21 +15,29 @@ The below pipeline configuration demonstrates simple usage:
1515
```yaml
1616
code-analysis:
1717
image: aosapps/drone-sonar-plugin
18-
secrets: [sonar_host, sonar_token]
18+
settings:
19+
sonar_host:
20+
from_secret: sonar_host
21+
sonar_token:
22+
from_secret: sonar_token
1923
```
2024
2125
Customized parameters could be specified:
2226
2327
```diff
2428
code-analysis:
2529
image: aosapps/drone-sonar-plugin
26-
secrets: [sonar_host, sonar_token]
27-
+ ver: 1.0
28-
+ timeout: 20
29-
+ sources: .
30-
+ level: DEBUG
31-
+ showProfiling: true
32-
+ exclusions: **/static/**/*,**/dist/**/*.js
30+
settings:
31+
sonar_host:
32+
from_secret: sonar_host
33+
sonar_token:
34+
from_secret: sonar_token
35+
+ ver: 1.0
36+
+ timeout: 20
37+
+ sources: .
38+
+ level: DEBUG
39+
+ showProfiling: true
40+
+ exclusions: **/static/**/*,**/dist/**/*.js
3341
```
3442
3543
# Secret Reference

Dockerfile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
FROM openjdk:8-jre-alpine
22

3-
COPY drone-sonar /bin/
4-
COPY lib/sonar-scanner-cli-3.2.0.1227.zip /bin
3+
ARG SONAR_VERSION=3.3.0.1492
4+
ARG SONAR_SCANNER_CLI=sonar-scanner-cli-${SONAR_VERSION}
5+
ARG SONAR_SCANNER=sonar-scanner-${SONAR_VERSION}
56

7+
RUN apk add --no-cache --update nodejs curl
8+
COPY drone-sonar /bin/
69
WORKDIR /bin
710

8-
RUN unzip sonar-scanner-cli-3.2.0.1227.zip \
9-
&& rm sonar-scanner-cli-3.2.0.1227.zip
11+
RUN curl https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/${SONAR_SCANNER_CLI}.zip -so /bin/${SONAR_SCANNER_CLI}.zip
12+
RUN unzip ${SONAR_SCANNER_CLI}.zip \
13+
&& rm ${SONAR_SCANNER_CLI}.zip \
14+
&& apk del curl
1015

11-
ENV PATH $PATH:/bin/sonar-scanner-3.2.0.1227/bin
16+
ENV PATH $PATH:/bin/${SONAR_SCANNER}/bin
1217

1318
ENTRYPOINT /bin/drone-sonar

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ docker run --rm \
2525
```yaml
2626
code-analysis:
2727
image: aosapps/drone-sonar-plugin
28-
secrets: [sonar_host, sonar_token]
28+
settings:
29+
sonar_host:
30+
from_secret: sonar_host
31+
sonar_token:
32+
from_secret: sonar_token
2933
```
3034

drone-sonar

-8 KB
Binary file not shown.
-532 KB
Binary file not shown.

main.go

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ package main
22

33
import (
44
"fmt"
5-
"os"
6-
75
"github.com/codegangsta/cli"
6+
"os"
87
)
98

10-
var build = "0" // build number set at compile time
9+
var build = "1" // build number set at compile time
1110

1211
func main() {
1312
app := cli.NewApp()
@@ -30,12 +29,12 @@ func main() {
3029
cli.StringFlag{
3130
Name: "host",
3231
Usage: "SonarQube host",
33-
EnvVar: "SONAR_HOST",
32+
EnvVar: "PLUGIN_SONAR_HOST",
3433
},
3534
cli.StringFlag{
3635
Name: "token",
3736
Usage: "SonarQube token",
38-
EnvVar: "SONAR_TOKEN",
37+
EnvVar: "PLUGIN_SONAR_TOKEN",
3938
},
4039

4140
// advanced parameters
@@ -47,7 +46,7 @@ func main() {
4746
cli.StringFlag{
4847
Name: "timeout",
4948
Usage: "Web request timeout",
50-
Value: "60",
49+
Value: "60",
5150
EnvVar: "PLUGIN_TIMEOUT",
5251
},
5352
cli.StringFlag{
@@ -86,18 +85,18 @@ func main() {
8685
func run(c *cli.Context) {
8786
plugin := Plugin{
8887
Config: Config{
89-
Key: c.String("key"),
90-
Name: c.String("name"),
91-
Host: c.String("host"),
92-
Token: c.String("token"),
88+
Key: c.String("key"),
89+
Name: c.String("name"),
90+
Host: c.String("host"),
91+
Token: c.String("token"),
9392

94-
Version: c.String("ver"),
95-
Timeout: c.String("timeout"),
96-
Sources: c.String("sources"),
97-
Inclusions: c.String("inclusions"),
98-
Exclusions: c.String("exclusions"),
99-
Level: c.String("level"),
100-
showProfiling: c.String("showProfiling"),
93+
Version: c.String("ver"),
94+
Timeout: c.String("timeout"),
95+
Sources: c.String("sources"),
96+
Inclusions: c.String("inclusions"),
97+
Exclusions: c.String("exclusions"),
98+
Level: c.String("level"),
99+
showProfiling: c.String("showProfiling"),
101100
},
102101
}
103102

0 commit comments

Comments
 (0)