26 Commits

Author SHA1 Message Date
Dwi Siswanto
10a365b29a Merge pull request #30 from leonardomerlin/patch-1
fix: use official sonnar scanner docker image
2021-10-22 05:33:28 +07:00
Leonardo Merlin
8c154cc36b fix: use official sonnar scanner docker image
the `newtmitch/docker-sonar-scanner` is not official and not up-to-date with the latest version of sonar.
2021-10-21 10:35:20 +02:00
Dwi Siswanto
c7058a020f Use stable release tag instead of master 2021-04-01 18:43:16 +07:00
dw1
9b52913486 Merge pull request #20 from jankal/master
Update docker base image & respect sonar-project.properties
2020-12-29 09:55:24 +07:00
Alexander Jank
532659cc88 fix(entrypoint): use bash condition correctly 2020-12-20 00:12:55 +01:00
Alexander Jank
c94954550f fix code-style & reference WORKSPACE dir for file detection 2020-12-18 08:48:17 +00:00
Alexander Jank
9b7b1d0336 update base image; respect sonar-project.properties 2020-12-17 23:23:49 +00:00
Dwi Siswanto
a40c5bc8f6 ✏️ Remove exit status if event action is push 2020-11-09 22:59:28 +07:00
Dwi Siswanto
7da9810073 🔨 Justify scripts 2020-10-11 19:11:26 +07:00
Dwi Siswanto
276b0c8370 Merge pull request #10 from kitabisa/development
🪲 Use GitHub environment instead of child workdir name as defa…
2020-07-26 06:08:30 +07:00
Dwi Siswanto
6c4cd0d6d9 🪲 Use GitHub environment instead of child workdir name as default value of project key & name 2020-07-26 03:20:28 +07:00
Dwi Siswanto
1c37e4588f 📘 Update usage docs 2020-07-17 09:30:15 +07:00
Dwi Siswanto
545a1a5fac Remove unused variable 2020-07-17 09:30:09 +07:00
Dwi Siswanto
63ca4c2787 Merge pull request #6 from nordcloud/master
Add project identity parameters
2020-07-16 23:36:50 +07:00
Dariusz Dwornikowski
9bdc677f66 Add projectVersion to README 2020-07-16 12:39:56 +02:00
Dariusz Dwornikowski
80213a727e Fix variable assignments 2020-07-16 12:38:54 +02:00
Dariusz Dwornikowski
5379cc65b4 Add setting of projectVersion 2020-07-14 09:45:39 +02:00
Dariusz Dwornikowski
accc346655 Add setting of projectName 2020-07-11 13:06:03 +02:00
dw1
50fbee7c7b ✏️ Fix can't formatting 2020-06-23 06:28:23 +07:00
dw1
d0028cf7df Merge branch 'master' of github.com:kitabisa/sonarqube-action 2020-06-23 06:21:17 +07:00
Dwi Siswanto
5cd2fa569f 📖 Update issue templates 2020-06-23 06:20:31 +07:00
Dwi Siswanto
7b0e7aa29e 📖 Update issue templates 2020-06-23 06:17:36 +07:00
dw1
a1521f09b4 📝 Update usage docs 2020-06-23 05:59:44 +07:00
dw1
c9f1220abc 📖 Add pull request template 2020-06-23 05:59:36 +07:00
dw1
ecb9a772a9 📖 Add issue template 2020-06-23 05:59:27 +07:00
dw1
bb543d0f7a 🪲 Add dynamic projectKey input. Fixes #5 2020-06-23 05:59:03 +07:00
6 changed files with 124 additions and 32 deletions

25
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,25 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: dwisiswant0
---
### Issue and Steps to Reproduce
<!-- Describe your issue and tell us how to reproduce it (include any useful information). -->
### Versions
### Screenshots
#### Expected
#### Actual
### Specifications
- Version:
- Platform:
- Subsystem:

View File

@@ -1,22 +1,24 @@
FROM newtmitch/sonar-scanner:4.0.0-alpine
FROM sonarsource/sonar-scanner-cli:4
LABEL "com.github.actions.name"="SonarQube Scan"
LABEL "com.github.actions.description"="Scan your code with SonarQube Scanner to detect bugs, vulnerabilities and code smells in more than 25 programming languages."
LABEL "com.github.actions.icon"="check"
LABEL "com.github.actions.color"="green"
LABEL version="0.0.1"
LABEL version="0.0.2"
LABEL repository="https://github.com/kitabisa/sonarqube-action"
LABEL homepage="https://kitabisa.github.io"
LABEL maintainer="dwisiswant0"
RUN npm config set unsafe-perm true && \
npm install --silent --save-dev -g typescript@3.5.2 && \
npm config set unsafe-perm false
npm config set unsafe-perm false && \
apk add --no-cache ca-certificates jq
ENV NODE_PATH "/usr/lib/node_modules/"
RUN apk add --no-cache ca-certificates jq
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

37
PULL_REQUEST_TEMPLATE.md Normal file
View File

@@ -0,0 +1,37 @@
THIS PROJECT IS IN MAINTENANCE MODE. We accept pull-requests for Bug Fixes **ONLY**. NO NEW FEATURES ACCEPTED!
---
<!--- Provide a general summary of your changes in the Title above -->
### Description
<!--- Describe your changes in detail -->
### Related Issue
Fixes #
<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps to reproduce -->
<!--- Please link to the issue here: -->
### Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->
### Types of Changes
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] ~New feature (non-breaking change which adds functionality)~
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] All new and existing tests passed.
### How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->
### Screenshots (if appropriate):

View File

@@ -24,18 +24,21 @@ jobs:
steps:
- uses: actions/checkout@master
- name: SonarQube Scan
uses: kitabisa/sonarqube-action@master
uses: kitabisa/sonarqube-action@v1.1.0
with:
host: ${{ secrets.SONARQUBE_HOST }}
login: ${{ secrets.SONARQUBE_TOKEN }}
```
You can change the analysis base directory by using the optional input `projectBaseDir` like this:
You can change the analysis base directory and/ project key _(allowed characters: letters, numbers, -, \_, . and :, with at least one non-digit.)_ by using the optional input like this:
```yaml
uses: kitabisa/sonarqube-action@master
with:
projectBaseDir: my-custom-directory
projectBaseDir: "/path/to/my-custom-project"
projectKey: "my-custom-project"
projectName: "my-custom-project-name"
projectVersion: "v0.0.1"
```
## Secrets

View File

@@ -1,23 +1,35 @@
name: 'SonarQube Scan'
description: 'Scan your code with SonarQube Scanner to detect bugs, vulnerabilities and code smells in more than 25 programming languages.'
author: 'Dwi Siswanto'
name: "SonarQube Scan"
description: "Scan your code with SonarQube Scanner to detect bugs, vulnerabilities and code smells in more than 25 programming languages."
author: "Dwi Siswanto"
branding:
icon: 'check'
color: 'green'
icon: "check"
color: "green"
runs:
using: 'docker'
image: 'Dockerfile'
using: "docker"
image: "Dockerfile"
inputs:
host:
description: 'SonarQube server URL'
description: "SonarQube server URL"
required: true
projectBaseDir:
description: 'Set the sonar.projectBaseDir analysis property'
projectKey:
description: "The project's unique key. Allowed characters are: letters, numbers, -, _, . and :, with at least one non-digit."
required: false
default: '.'
default: ""
projectName:
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:
description: "Set the sonar.projectBaseDir analysis property"
required: false
default: "."
login:
description: 'Login or authentication token of a SonarQube user'
description: "Login or authentication token of a SonarQube user"
required: true
password:
description: 'Password that goes with the sonar.login username. This should be left blank if an authentication token is being used.'
description: "Password that goes with the sonar.login username. This should be left blank if an authentication token is being used."
required: false

View File

@@ -6,19 +6,32 @@ if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
EVENT_ACTION=$(jq -r ".action" "${GITHUB_EVENT_PATH}")
if [[ "${EVENT_ACTION}" != "opened" ]]; then
echo "No need to run analysis. It is already triggered by the push event."
exit 78
exit
fi
fi
REPOSITORY_NAME=$(basename "${GITHUB_REPOSITORY}")
[[ ! -z ${INPUT_PASSWORD} ]] && SONAR_PASSWORD="${INPUT_PASSWORD}" || SONAR_PASSWORD=""
sonar-scanner \
-Dsonar.host.url=${INPUT_HOST} \
-Dsonar.projectKey=${PWD##*/} \
-Dsonar.projectBaseDir=${INPUT_PROJECTBASEDIR} \
-Dsonar.login=${INPUT_LOGIN} \
-Dsonar.password=${INPUT_PASSWORD} \
-Dsonar.sources=. \
-Dsonar.sourceEncoding=UTF-8 \
${SONAR_PASSWORD}
if [[ ! -f "${GITHUB_WORKSPACE}/sonar-project.properties" ]]; then
[[ -z ${INPUT_PROJECTKEY} ]] && SONAR_PROJECTKEY="${REPOSITORY_NAME}" || SONAR_PROJECTKEY="${INPUT_PROJECTKEY}"
[[ -z ${INPUT_PROJECTNAME} ]] && SONAR_PROJECTNAME="${REPOSITORY_NAME}" || 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=${SONAR_PASSWORD} \
-Dsonar.sources=. \
-Dsonar.sourceEncoding=UTF-8
else
sonar-scanner \
-Dsonar.host.url=${INPUT_HOST} \
-Dsonar.projectBaseDir=${INPUT_PROJECTBASEDIR} \
-Dsonar.login=${INPUT_LOGIN} \
-Dsonar.password=${SONAR_PASSWORD}
fi