Skip to content

Commit 083f6ee

Browse files
Retrieve additional information about the scan and store results in S3
1 parent e1b9d20 commit 083f6ee

15 files changed

+1977
-85
lines changed

README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,31 @@ The following parameters can be set in config files or in env variables:
3535
- LOG_LEVEL: the log level
3636
- PORT: the server port
3737
- SUBMISSION_API_URL: Submission API URL
38+
39+
- SONARQUBE_HOST: SonarQube host. Default: http://localhost:9000
40+
- SONARQUBE_TOKEN: SonarQube access token. Optional parameter, must be set when ACL is configured for the project.
41+
More details about access tokens - https://docs.sonarqube.org/latest/user-guide/user-token/
42+
43+
- AWS_S3_BUCKET: AWS S3 Bucket name. Bucket must be already exist
44+
- AWS_S3_PREFIX: AWS S3 Key prefix. Optional parameter. Must end with slash
45+
3846
- All variables starting with prefix `AUTH0` corresponds to Auth0 related credentials
3947

48+
### AWS Credentials
49+
* Please refer to following [documentation](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/getting-your-credentials.html) in order to get AWS credentials.
50+
* Depending on your Operating System, create AWS credentials file in the path listed below
51+
```
52+
Linux, Unix, and macOS users: ~/.aws/credentials
53+
Windows users: C:\Users\USER_NAME\.aws\credentials
54+
```
55+
Credentials file should look like below
56+
```
57+
[default]
58+
aws_access_key_id = SOME_ACCESS_KEY_ID
59+
aws_secret_access_key = SOME_SECRET_ACCESS_KEY
60+
```
61+
* Credentials can be set in environment variables. [Documentation](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-environment.html)
62+
4063
## Local deployment
4164

4265
1. From the project root directory, run the following command to install the dependencies
@@ -75,6 +98,12 @@ To run unit tests
7598
npm run test
7699
```
77100

101+
## Code coverage
102+
103+
```
104+
npm run coverage
105+
```
106+
78107
## Local Deployment with Docker
79108

80109
To run the Submission quality processor using docker, follow the below steps
@@ -83,7 +112,7 @@ To run the Submission quality processor using docker, follow the below steps
83112

84113
2. Rename the file `sample.api.env` to `api.env`
85114

86-
3. Set the required Auth0 and Submission API URL in the file `api.env`
115+
3. Set the required Auth0, Submission API URL, SonarQube config and AWS S3 configuration in the file `api.env`
87116

88117
4. Once that is done, run the following command
89118

config/default.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@ module.exports = {
88

99
SUBMISSION_API_URL: process.env.SUBMISSION_API_URL || 'https://api.topcoder-dev.com/v5',
1010

11-
AUTH0_URL: process.env.AUTH0_URL, // Auth0 credentials for Leaderboard Service
11+
SONARQUBE_HOST: process.env.SONARQUBE_HOST || 'http://localhost:9000',
12+
SONARQUBE_TOKEN: process.env.SONARQUBE_TOKEN,
13+
14+
AWS_S3_BUCKET: process.env.AWS_S3_BUCKET,
15+
AWS_S3_PREFIX: process.env.AWS_S3_PREFIX || '',
16+
17+
AUTH0_URL: process.env.AUTH0_URL,
1218
AUTH0_AUDIENCE: process.env.AUTH0_AUDIENCE,
1319
TOKEN_CACHE_TIME: process.env.TOKEN_CACHE_TIME,
1420
AUTH0_CLIENT_ID: process.env.AUTH0_CLIENT_ID,

config/test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
*/
44

55
module.exports = {
6-
AUTH0_URL: 'http://test' // Since we use Nock, just dummy value stored
6+
AUTH0_URL: 'http://test', // Since we use Nock, just dummy value stored
7+
AWS_S3_BUCKET: 'dummy-bucket'
78
}

docker/sample.api.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ AUTH0_AUDIENCE=<Auth0 Audience>
33
AUTH0_CLIENT_ID=<Auth0 Client ID>
44
AUTH0_CLIENT_SECRET=<Auth0 Client Secret>
55
SUBMISSION_API_URL=<Submission API Endpoint>
6+
AWS_S3_BUCKET=<S3 bucket>
7+
SONARQUBE_HOST=<SonarQube Host>

0 commit comments

Comments
 (0)