commit
3d7a3b15dc
14
DOCS.md
14
DOCS.md
@ -1,5 +1,5 @@
|
||||
---
|
||||
date: 2018-08-29T00:00:00+00:00
|
||||
date: 2019-02-12T10:50:00+00:00
|
||||
title: SonarQube
|
||||
author: aosapps
|
||||
tags: [ Sonar, SonarQube, Analysis, report ]
|
||||
@ -15,7 +15,11 @@ The below pipeline configuration demonstrates simple usage:
|
||||
```yaml
|
||||
code-analysis:
|
||||
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:
|
||||
@ -23,7 +27,11 @@ Customized parameters could be specified:
|
||||
```diff
|
||||
code-analysis:
|
||||
image: aosapps/drone-sonar-plugin
|
||||
secrets: [sonar_host, sonar_token]
|
||||
settings:
|
||||
sonar_host:
|
||||
from_secret: sonar_host
|
||||
sonar_token:
|
||||
from_secret: sonar_token
|
||||
+ ver: 1.0
|
||||
+ timeout: 20
|
||||
+ sources: .
|
||||
|
15
Dockerfile
15
Dockerfile
@ -1,13 +1,18 @@
|
||||
FROM openjdk:8-jre-alpine
|
||||
|
||||
COPY drone-sonar /bin/
|
||||
COPY lib/sonar-scanner-cli-3.2.0.1227.zip /bin
|
||||
ARG SONAR_VERSION=3.3.0.1492
|
||||
ARG SONAR_SCANNER_CLI=sonar-scanner-cli-${SONAR_VERSION}
|
||||
ARG SONAR_SCANNER=sonar-scanner-${SONAR_VERSION}
|
||||
|
||||
RUN apk add --no-cache --update nodejs curl
|
||||
COPY drone-sonar /bin/
|
||||
WORKDIR /bin
|
||||
|
||||
RUN unzip sonar-scanner-cli-3.2.0.1227.zip \
|
||||
&& rm sonar-scanner-cli-3.2.0.1227.zip
|
||||
RUN curl https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/${SONAR_SCANNER_CLI}.zip -so /bin/${SONAR_SCANNER_CLI}.zip
|
||||
RUN unzip ${SONAR_SCANNER_CLI}.zip \
|
||||
&& rm ${SONAR_SCANNER_CLI}.zip \
|
||||
&& apk del curl
|
||||
|
||||
ENV PATH $PATH:/bin/sonar-scanner-3.2.0.1227/bin
|
||||
ENV PATH $PATH:/bin/${SONAR_SCANNER}/bin
|
||||
|
||||
ENTRYPOINT /bin/drone-sonar
|
||||
|
@ -25,6 +25,10 @@ docker run --rm \
|
||||
```yaml
|
||||
code-analysis:
|
||||
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.
9
main.go
9
main.go
@ -2,12 +2,11 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"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() {
|
||||
app := cli.NewApp()
|
||||
@ -30,12 +29,12 @@ func main() {
|
||||
cli.StringFlag{
|
||||
Name: "host",
|
||||
Usage: "SonarQube host",
|
||||
EnvVar: "SONAR_HOST",
|
||||
EnvVar: "PLUGIN_SONAR_HOST",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "token",
|
||||
Usage: "SonarQube token",
|
||||
EnvVar: "SONAR_TOKEN",
|
||||
EnvVar: "PLUGIN_SONAR_TOKEN",
|
||||
},
|
||||
|
||||
// advanced parameters
|
||||
|
Loading…
Reference in New Issue
Block a user