mirror of
https://github.com/kytay/drone-plugins.git
synced 2026-06-04 10:23:49 +08:00
chore: update changes on documentation
This commit is contained in:
@@ -9,7 +9,7 @@ apt-get install -y curl zip
|
||||
|
||||
RUN curl https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/${SONAR_SCANNER_CLI}.zip -so /opt/${SONAR_SCANNER_CLI}.zip && \
|
||||
unzip -d /opt /opt/${SONAR_SCANNER_CLI}.zip && \
|
||||
rm /opt/${SONAR_SCANNER_CLI}.zip
|
||||
rm /opt/${SONAR_SCANNER_CLI}.zip
|
||||
|
||||
COPY docker-entrypoint.sh /usr/bin/docker-entrypoint.sh
|
||||
RUN chmod +x /usr/bin/docker-entrypoint.sh
|
||||
|
||||
@@ -19,13 +19,6 @@ example: |
|
||||
kind: pipeline
|
||||
name: default
|
||||
steps:
|
||||
- name: generate sonar-project.properties
|
||||
image: alpine
|
||||
commands:
|
||||
- set -e
|
||||
- echo "" > ./sonar-project.properties
|
||||
- echo "sonar.projectKey=${DRONE_REPO}" >> ./sonar-project.properties
|
||||
- echo "sonar.projectName=${DRONE_REPO}" >> ./sonar-project.properties
|
||||
- name: perform code-analysis
|
||||
image: kytay/sonar-node-plugin
|
||||
settings:
|
||||
@@ -33,7 +26,7 @@ example: |
|
||||
from_secret: sonar_host
|
||||
sonar_token:
|
||||
from_secret: sonar_token
|
||||
use_node_version: 14
|
||||
use_node_version: 16.18.1
|
||||
properties:
|
||||
sonar_host:
|
||||
type: string
|
||||
@@ -88,6 +81,6 @@ properties:
|
||||
defaultValue: ""
|
||||
description: >-
|
||||
Specify the node version to use for sonar-scanner, the most recent node LTS version will be selected if this variable is not specified.
|
||||
Example Values: 14, 14.21.1, v14, v14.21.1
|
||||
Example Values: 16, 16.18.1, v16, v16.18.1
|
||||
secret: false
|
||||
required: false
|
||||
@@ -1,7 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "#################################"
|
||||
echo "Initialising sonar-node-plugin..."
|
||||
echo "#################################"
|
||||
|
||||
JAVA_OPTS=""
|
||||
|
||||
if [[ -n ${DRONE_WORKSPACE} ]]; then
|
||||
echo "sonar.projectBaseDir=${DRONE_WORKSPACE}" >> /opt/${SONAR_SCANNER}/conf/sonar-scanner.properties
|
||||
if [[ ! -f "/drone/src/sonar-project.properties" ]]; then
|
||||
JAVA_OPTS+=" -Dsonar.projectKey=${DRONE_REPO_NAMESPACE}:${DRONE_REPO_NAME}"
|
||||
JAVA_OPTS+=" -Dsonar.projectName=${DRONE_REPO}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -n ${PLUGIN_SONAR_HOST} ]]; then
|
||||
JAVA_OPTS+=" -Dsonar.host.url=${PLUGIN_SONAR_HOST}"
|
||||
fi
|
||||
@@ -22,10 +36,6 @@ if [[ -n ${PLUGIN_SONAR_PROJECT_SETTINGS} ]]; then
|
||||
JAVA_OPTS+=" -Dproject.settings=${PLUGIN_SONAR_PROJECT_SETTINGS}"
|
||||
fi
|
||||
|
||||
if [[ -n ${PLUGIN_SONAR_DEBUG} && ${PLUGIN_SONAR_DEBUG} == "true" ]]; then
|
||||
JAVA_OPTS+=" -X"
|
||||
fi
|
||||
|
||||
# additional setup for nvm installation
|
||||
touch $HOME/.bashrc
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
|
||||
@@ -48,4 +58,13 @@ else
|
||||
nvm use --lts
|
||||
fi
|
||||
|
||||
echo "############################################################"
|
||||
echo "Initialised sonar-node-plugin - ready to perform sonar scan."
|
||||
echo "############################################################"
|
||||
|
||||
if [[ -n ${PLUGIN_SONAR_DEBUG} && ${PLUGIN_SONAR_DEBUG} == "true" ]]; then
|
||||
JAVA_OPTS+=" -X"
|
||||
echo "JAVA_OPTS=${JAVA_OPTS}"
|
||||
fi
|
||||
|
||||
sonar-scanner ${JAVA_OPTS}
|
||||
Reference in New Issue
Block a user