Skip to content

Commit 0a1ff61

Browse files
Merge pull request #97 from drone-plugins/feat/force-nodejs-18
Force NodeJs 18
2 parents eb78926 + e4fa274 commit 0a1ff61

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

.drone.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ steps:
1919
when:
2020
ref:
2121
- "refs/pull/**" # Only run for pull requests
22-
- name: publish-2.4.0
22+
- name: publish-2.4.1
2323
image: plugins/docker:20
2424
settings:
2525
# auto_tag: true
2626
# auto_tag_suffix: v2.0.2-java17
2727
tags:
28-
- v2.4.0
28+
- v2.4.1
2929
# - latest
3030
# - stable-java17
3131
daemon_off: false

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ RUN go get github.com/urfave/cli
1313
RUN go get github.com/joho/godotenv
1414
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o harness-sonar
1515

16-
FROM amazoncorretto:17.0.8-alpine3.18
16+
FROM amazoncorretto:17.0.11-alpine3.19
1717

1818
ARG SONAR_VERSION=5.0.1.3006
1919
ARG SONAR_SCANNER_CLI=sonar-scanner-cli-${SONAR_VERSION}
@@ -23,7 +23,7 @@ ARG SONAR_SCANNER=sonar-scanner-${SONAR_VERSION}
2323
# && apt-get install -y nodejs curl \
2424
# && apt-get clean
2525

26-
RUN apk --no-cache --update add nodejs curl unzip git php python3 py3-pip maven gcc g++ make ruby ruby-dev perl
26+
RUN apk --no-cache --update add nodejs-current npm curl unzip git php python3 py3-pip maven gcc g++ make ruby ruby-dev perl
2727

2828
COPY --from=build /go/src/github.com/diegopereiraeng/harness-cie-sonarqube-scanner/harness-sonar /bin/
2929
WORKDIR /bin

main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,11 @@ func main() {
267267
Value: "/harness",
268268
EnvVar: "PLUGIN_WORKSPACE",
269269
},
270+
cli.StringFlag{
271+
Name: "sonar_scanner_opts",
272+
Usage: "sonar scanner jvm ops",
273+
EnvVar: "PLUGIN_SONAR_SCANNER_OPTS",
274+
},
270275
}
271276
app.Run(os.Args)
272277
}
@@ -315,6 +320,7 @@ func run(c *cli.Context) {
315320
SkipScan: c.Bool("skip_scan"),
316321
WaitQualityGate: c.Bool("wait_qualitygate"),
317322
Workspace: c.String("workspace"),
323+
SonarOPS: c.String("sonar_scanner_opts"),
318324
},
319325
Output: Output{
320326
OutputFile: c.String("output-file"),

plugin.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ type (
8989
SkipScan bool
9090
WaitQualityGate bool
9191
Workspace string
92+
SonarOPS string
9293
}
9394
Output struct {
9495
OutputFile string // File where plugin output are saved
@@ -473,6 +474,13 @@ func (p Plugin) Exec() error {
473474
params := strings.Split(p.Config.CustomJvmParams, ",")
474475
args = append(args, params...)
475476
}
477+
478+
if len(p.Config.SonarOPS) >= 1 {
479+
existingOpts := os.Getenv("SONAR_SCANNER_OPTS")
480+
newOpts := existingOpts + " " + p.Config.SonarOPS
481+
os.Setenv("SONAR_SCANNER_OPTS", newOpts)
482+
}
483+
476484
taskFilePath := ".scannerwork/report-task.txt"
477485

478486
if len(p.Config.Workspace) >= 1 {

0 commit comments

Comments
 (0)