Compare commits
19 Commits
v0.0.1
...
developmen
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c4cd0d6d9 | ||
|
|
1c37e4588f | ||
|
|
545a1a5fac | ||
|
|
63ca4c2787 | ||
|
|
9bdc677f66 | ||
|
|
80213a727e | ||
|
|
5379cc65b4 | ||
|
|
accc346655 | ||
|
|
50fbee7c7b | ||
|
|
d0028cf7df | ||
|
|
5cd2fa569f | ||
|
|
7b0e7aa29e | ||
|
|
a1521f09b4 | ||
|
|
c9f1220abc | ||
|
|
ecb9a772a9 | ||
|
|
bb543d0f7a | ||
|
|
abc24397e0 | ||
|
|
07b55c6b20 | ||
|
|
3d458002e9 |
25
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
25
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal 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:
|
||||||
@@ -15,6 +15,8 @@ RUN npm config set unsafe-perm true && \
|
|||||||
npm config set unsafe-perm false
|
npm config set unsafe-perm false
|
||||||
ENV NODE_PATH "/usr/lib/node_modules/"
|
ENV NODE_PATH "/usr/lib/node_modules/"
|
||||||
|
|
||||||
|
RUN apk add --no-cache ca-certificates jq
|
||||||
|
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
RUN chmod +x /entrypoint.sh
|
RUN chmod +x /entrypoint.sh
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|||||||
37
PULL_REQUEST_TEMPLATE.md
Normal file
37
PULL_REQUEST_TEMPLATE.md
Normal 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):
|
||||||
58
README.md
58
README.md
@@ -1,2 +1,56 @@
|
|||||||
# sonarqube-action
|
# SonarQube GitHub Action
|
||||||
Integrate SonarQube scanner to GitHub Actions
|
|
||||||
|
Using this GitHub Action, scan your code with SonarQube scanner to detects bugs, vulnerabilities and code smells in more than 20 programming languages!
|
||||||
|
|
||||||
|
<img src="https://www.sonarqube.org/assets/logo-31ad3115b1b4b120f3d1efd63e6b13ac9f1f89437f0cf6881cc4d8b5603a52b4.svg" width="320px">
|
||||||
|
|
||||||
|
SonarQube is an open-source platform developed by SonarSource for continuous inspection of code quality to perform automatic reviews with static analysis of code to detect bugs, code smells, and security vulnerabilities on 20+ programming languages.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
* Have SonarQube on server. [Install now](https://docs.sonarqube.org/latest/setup/install-server/) if it's not already the case!
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
The workflow, usually declared in `.github/workflows/build.yml`, looks like:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
on: push
|
||||||
|
name: Main Workflow
|
||||||
|
jobs:
|
||||||
|
sonarQubeTrigger:
|
||||||
|
name: SonarQube Trigger
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@master
|
||||||
|
- name: SonarQube Scan
|
||||||
|
uses: kitabisa/sonarqube-action@master
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.SONARQUBE_HOST }}
|
||||||
|
login: ${{ secrets.SONARQUBE_TOKEN }}
|
||||||
|
```
|
||||||
|
|
||||||
|
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: "/path/to/my-custom-project"
|
||||||
|
projectKey: "my-custom-project"
|
||||||
|
projectName: "my-custom-project-name"
|
||||||
|
projectVersion: "v0.0.1"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Secrets
|
||||||
|
|
||||||
|
- `host` - **_(Required)_** this is the SonarQube server URL.
|
||||||
|
- `login` - **_(Required)_** the login or authentication token of a SonarQube user with Execute Analysis permission on the project. See [how to generate SonarQube token](https://docs.sonarqube.org/latest/user-guide/user-token/).
|
||||||
|
- `password` - The password that goes with the `login` username. This should be left blank if an `login` are authentication token.
|
||||||
|
|
||||||
|
You can set all variable in the "Secrets" settings page of your repository.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
The Dockerfile and associated scripts and documentation in this project are released under the MIT License.
|
||||||
|
|
||||||
|
Container images built with this project include third party materials.
|
||||||
38
action.yaml
38
action.yaml
@@ -1,23 +1,35 @@
|
|||||||
name: 'SonarQube Scan'
|
name: "SonarQube Scan"
|
||||||
description: 'Scan your code with SonarQube Scanner to detect bugs, vulnerabilities and code smells in more than 25 programming languages.'
|
description: "Scan your code with SonarQube Scanner to detect bugs, vulnerabilities and code smells in more than 25 programming languages."
|
||||||
author: 'Dwi Siswanto'
|
author: "Dwi Siswanto"
|
||||||
branding:
|
branding:
|
||||||
icon: 'check'
|
icon: "check"
|
||||||
color: 'green'
|
color: "green"
|
||||||
runs:
|
runs:
|
||||||
using: 'docker'
|
using: "docker"
|
||||||
image: 'Dockerfile'
|
image: "Dockerfile"
|
||||||
inputs:
|
inputs:
|
||||||
host:
|
host:
|
||||||
description: 'SonarQube server URL'
|
description: "SonarQube server URL"
|
||||||
required: true
|
required: true
|
||||||
projectBaseDir:
|
projectKey:
|
||||||
description: 'Set the sonar.projectBaseDir analysis property'
|
description: "The project's unique key. Allowed characters are: letters, numbers, -, _, . and :, with at least one non-digit."
|
||||||
required: false
|
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:
|
login:
|
||||||
description: 'Login or authentication token of a SonarQube user'
|
description: "Login or authentication token of a SonarQube user"
|
||||||
required: true
|
required: true
|
||||||
password:
|
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
|
required: false
|
||||||
@@ -10,19 +10,20 @@ if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${INPUT_PASSWORD}" ]]; then
|
REPOSITORY_NAME=$(basename "${GITHUB_REPOSITORY}")
|
||||||
SONAR_PASSWORD="&& true"
|
|
||||||
else
|
[[ ! -z ${INPUT_PASSWORD} ]] && SONAR_PASSWORD="${INPUT_PASSWORD}" || SONAR_PASSWORD=""
|
||||||
SONAR_PASSWORD="${INPUT_PASSWORD}"
|
[[ -z ${INPUT_PROJECTKEY} ]] && SONAR_PROJECTKEY="${REPOSITORY_NAME}" || SONAR_PROJECTKEY="${INPUT_PROJECTKEY}"
|
||||||
fi
|
[[ -z ${INPUT_PROJECTNAME} ]] && SONAR_PROJECTNAME="${REPOSITORY_NAME}" || SONAR_PROJECTNAME="${INPUT_PROJECTNAME}"
|
||||||
|
[[ -z ${INPUT_PROJECTVERSION} ]] && SONAR_PROJECTVERSION="" || SONAR_PROJECTVERSION="${INPUT_PROJECTVERSION}"
|
||||||
|
|
||||||
sonar-scanner \
|
sonar-scanner \
|
||||||
-Dsonar.host.url=${INPUT_HOST} \
|
-Dsonar.host.url=${INPUT_HOST} \
|
||||||
-Dsonar.projectKey=${PWD##*/} \
|
-Dsonar.projectKey=${SONAR_PROJECTKEY} \
|
||||||
|
-Dsonar.projectName=${SONAR_PROJECTNAME} \
|
||||||
|
-Dsonar.projectVersion=${SONAR_PROJECTVERSION} \
|
||||||
-Dsonar.projectBaseDir=${INPUT_PROJECTBASEDIR} \
|
-Dsonar.projectBaseDir=${INPUT_PROJECTBASEDIR} \
|
||||||
-Dsonar.login=${INPUT_LOGIN} \
|
-Dsonar.login=${INPUT_LOGIN} \
|
||||||
-Dsonar.password=${INPUT_PASSWORD} \
|
-Dsonar.password=${INPUT_PASSWORD} \
|
||||||
-Dsonar.sources=. \
|
-Dsonar.sources=. \
|
||||||
-Dsonar.sourceEncoding=UTF-8 \
|
-Dsonar.sourceEncoding=UTF-8
|
||||||
${SONAR_PASSWORD}
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user