From accc3466551354ae1318e8a29a414283125ab339 Mon Sep 17 00:00:00 2001 From: Dariusz Dwornikowski Date: Sat, 11 Jul 2020 13:06:03 +0200 Subject: [PATCH 1/4] Add setting of projectName --- README.md | 1 + action.yaml | 4 ++++ entrypoint.sh | 3 +++ 3 files changed, 8 insertions(+) diff --git a/README.md b/README.md index e897d4a..c952cb6 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ uses: kitabisa/sonarqube-action@master with: projectBaseDir: my-custom-directory projectKey: my-custom-project + projectName: "my-project-name" ``` ## Secrets diff --git a/action.yaml b/action.yaml index 411651c..5e44bae 100644 --- a/action.yaml +++ b/action.yaml @@ -15,6 +15,10 @@ inputs: description: "The project's unique key. Allowed characters are: letters, numbers, -, _, . and :, with at least one non-digit." required: false default: "" + projectName: + description: "The project's name. If not given name will be generated by SonarQube" + required: false + default: "" projectBaseDir: description: "Set the sonar.projectBaseDir analysis property" required: false diff --git a/entrypoint.sh b/entrypoint.sh index 5977021..a38febe 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -12,10 +12,13 @@ fi [[ ! -z ${INPUT_PASSWORD} ]] && SONAR_PASSWORD="${INPUT_PASSWORD}" || SONAR_PASSWORD="" [[ -z ${INPUT_PROJECTKEY} ]] && SONAR_PROJECTKEY="${PWD##*/}" || SONAR_PROJECTKEY="${INPUT_PROJECTKEY}" +[[ -z ${INPUT_PROJECTNAME} ]] && SONAR_PROJECTNAME="${PWD##*/}" || SONAR_PROJECTKEY="${INPUT_PROJECTNAME}" + sonar-scanner \ -Dsonar.host.url=${INPUT_HOST} \ -Dsonar.projectKey=${SONAR_PROJECTKEY} \ + -Dsonar.projectName=${SONAR_PROJECTNAME} \ -Dsonar.projectBaseDir=${INPUT_PROJECTBASEDIR} \ -Dsonar.login=${INPUT_LOGIN} \ -Dsonar.password=${INPUT_PASSWORD} \ From 5379cc65b4505e11c4c7e3a6a04d5ba6d015a8bc Mon Sep 17 00:00:00 2001 From: Dariusz Dwornikowski Date: Tue, 14 Jul 2020 09:45:39 +0200 Subject: [PATCH 2/4] Add setting of projectVersion --- action.yaml | 6 +++++- entrypoint.sh | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/action.yaml b/action.yaml index 5e44bae..d221890 100644 --- a/action.yaml +++ b/action.yaml @@ -16,7 +16,11 @@ inputs: required: false default: "" projectName: - description: "The project's name. If not given name will be generated by SonarQube" + description: "Name of the project that will be displayed on the web interface." + required: false + default: "" + projectVersion: + description: "The project version." required: false default: "" projectBaseDir: diff --git a/entrypoint.sh b/entrypoint.sh index a38febe..6b59027 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -13,6 +13,7 @@ fi [[ ! -z ${INPUT_PASSWORD} ]] && SONAR_PASSWORD="${INPUT_PASSWORD}" || SONAR_PASSWORD="" [[ -z ${INPUT_PROJECTKEY} ]] && SONAR_PROJECTKEY="${PWD##*/}" || SONAR_PROJECTKEY="${INPUT_PROJECTKEY}" [[ -z ${INPUT_PROJECTNAME} ]] && SONAR_PROJECTNAME="${PWD##*/}" || SONAR_PROJECTKEY="${INPUT_PROJECTNAME}" +[[ -z ${INPUT_PROJECTVERSION} ]] && SONAR_PROJECTVERSION="${PWD##*/}" || SONAR_PROJECTKEY="${INPUT_PROJECTVERSION}" sonar-scanner \ From 80213a727e8fe6643e0035d2dcaf2649b152026c Mon Sep 17 00:00:00 2001 From: Dariusz Dwornikowski Date: Thu, 16 Jul 2020 12:38:54 +0200 Subject: [PATCH 3/4] Fix variable assignments --- entrypoint.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 6b59027..49af028 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -12,14 +12,15 @@ fi [[ ! -z ${INPUT_PASSWORD} ]] && SONAR_PASSWORD="${INPUT_PASSWORD}" || SONAR_PASSWORD="" [[ -z ${INPUT_PROJECTKEY} ]] && SONAR_PROJECTKEY="${PWD##*/}" || SONAR_PROJECTKEY="${INPUT_PROJECTKEY}" -[[ -z ${INPUT_PROJECTNAME} ]] && SONAR_PROJECTNAME="${PWD##*/}" || SONAR_PROJECTKEY="${INPUT_PROJECTNAME}" -[[ -z ${INPUT_PROJECTVERSION} ]] && SONAR_PROJECTVERSION="${PWD##*/}" || SONAR_PROJECTKEY="${INPUT_PROJECTVERSION}" +[[ -z ${INPUT_PROJECTNAME} ]] && SONAR_PROJECTNAME="${PWD##*/}" || SONAR_PROJECTNAME="${INPUT_PROJECTNAME}" +[[ -z ${INPUT_PROJECTVERSION} ]] && SONAR_PROJECTVERSION="" || SONAR_PROJECTVERSION="${INPUT_PROJECTVERSION}" sonar-scanner \ -Dsonar.host.url=${INPUT_HOST} \ -Dsonar.projectKey=${SONAR_PROJECTKEY} \ -Dsonar.projectName=${SONAR_PROJECTNAME} \ + -Dsonar.projectVersion=${SONAR_PROJECTVERSION} \ -Dsonar.projectBaseDir=${INPUT_PROJECTBASEDIR} \ -Dsonar.login=${INPUT_LOGIN} \ -Dsonar.password=${INPUT_PASSWORD} \ From 9bdc677f66cf663c8d976f6c1aff8a6734fd79f5 Mon Sep 17 00:00:00 2001 From: Dariusz Dwornikowski Date: Thu, 16 Jul 2020 12:39:56 +0200 Subject: [PATCH 4/4] Add projectVersion to README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c952cb6..da8f170 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ with: projectBaseDir: my-custom-directory projectKey: my-custom-project projectName: "my-project-name" + projectVersion: "my-project-version" ``` ## Secrets