Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(devops): set up testing, CI, SonarQube
- Loading branch information
0 parents
commit 8d15159
Showing
14 changed files
with
430 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"presets": [ | ||
"stage-2", | ||
[ | ||
"env", | ||
{ | ||
"targets": { | ||
"node": "current" | ||
} | ||
} | ||
] | ||
], | ||
"plugins": ["babel-plugin-inline-import"], | ||
"ignore": ["node_modules/**"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# EditorConfig is awesome: http://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
#indentation | ||
indent_style = space | ||
indent_size = 2 | ||
#line breaks | ||
end_of_line = lf | ||
#whitespace | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
indent_size = 4 | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"parser": "babel-eslint", | ||
"parserOptions": { | ||
"ecmaVersion": 2016, | ||
"sourceType": "module" | ||
}, | ||
"plugins": ["prettier"], | ||
"env": { | ||
"es6": true, | ||
"node": true | ||
}, | ||
"rules": { | ||
"prettier/prettier": [ | ||
"error", | ||
{ | ||
"bracketSpacing": true, | ||
"trailingComma": "all", | ||
"singleQuote": true | ||
} | ||
] | ||
}, | ||
"extends": ["airbnb-base", "prettier"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.DS* | ||
node_modules | ||
*.log | ||
.vscode | ||
|
||
# Don’t include the built module; npm will do that for us | ||
dist | ||
|
||
# Don’t include sensitive data | ||
config/app_env_private.json | ||
|
||
# Testing directories | ||
coverage | ||
.nyc_output | ||
sonarlint.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package-lock=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
group: bluezone | ||
dist: trusty | ||
sudo: false | ||
language: node_js | ||
node_js: | ||
- 6.9.0 | ||
addons: | ||
sonarqube: true | ||
before_install: | ||
- echo "@console:registry=https://dev-console-npm.stage1.ng.bluemix.net/" > ~/.npmrc | ||
- echo -e "//dev-console-npm.stage1.ng.bluemix.net/:_authToken=${NPM_TOKEN}" >> ~/.npmrc | ||
install: | ||
- npm i -g npm@3 | ||
- npm install | ||
script: | ||
- npm test | ||
- sonar-scanner -D sonar.host.url=$SONAR_HOST_URL -D sonar.github.endpoint=$GH_API_URL | ||
-D sonar.github.oauth=$SONAR_GITHUB_TOKEN | ||
after_success: | ||
- npm run build | ||
- npm run semantic-release | ||
cache: | ||
directories: | ||
- node_modules | ||
- "$HOME/.sonar/cache" | ||
branches: | ||
only: | ||
- master | ||
# | ||
# Add secure environment variables using the following command: | ||
# travis encrypt YOUR_ENV_VAR=[value] --add env.global | ||
# | ||
# Required env vars: | ||
# - GH_TOKEN | ||
# - NPM_TOKEN | ||
# - SONAR_TOKEN | ||
# - SONAR_GITHUB_TOKEN | ||
# | ||
# See https://ibm.biz/graphql-data-source-travis for details. | ||
# | ||
env: | ||
global: | ||
- SONAR_HOST_URL=http://ux-dev-sonar.rtp.raleigh.ibm.com:9000/ | ||
- GH_API_URL=https://github.ibm.com/api/v3 | ||
# | ||
# Optional: send Slack notifications. | ||
# See https://docs.travis-ci.com/user/notifications/#Configuring-slack-notifications | ||
# | ||
# notifications: | ||
# slack: | ||
# rooms: "<account>:<token>#room" | ||
# on_success: change | ||
# on_failure: change | ||
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
group: bluezone | ||
dist: trusty | ||
sudo: false | ||
language: node_js | ||
node_js: | ||
- 6.9.0 | ||
addons: | ||
sonarqube: true | ||
before_install: | ||
- echo "@console:registry=https://dev-console-npm.stage1.ng.bluemix.net/" > ~/.npmrc | ||
- echo -e "//dev-console-npm.stage1.ng.bluemix.net/:_authToken=${NPM_TOKEN}" >> ~/.npmrc | ||
install: | ||
- npm i -g npm@3 | ||
- npm install | ||
script: | ||
- npm test | ||
- sonar-scanner -D sonar.host.url=$SONAR_HOST_URL -D sonar.github.endpoint=$GH_API_URL | ||
-D sonar.github.oauth=$SONAR_GITHUB_TOKEN | ||
after_success: | ||
- npm run build | ||
- npm run semantic-release | ||
cache: | ||
directories: | ||
- node_modules | ||
- "$HOME/.sonar/cache" | ||
branches: | ||
only: | ||
- master | ||
env: | ||
global: | ||
- SONAR_HOST_URL=http://ux-dev-sonar.rtp.raleigh.ibm.com:9000/ | ||
- GH_API_URL=https://github.ibm.com/api/v3 | ||
- secure: BDYyYIwPsSHnEU/pnX33ZzwtU4hujmvwc15ilM/JPHIB5fKQWolokNiBGXG5nB/LYRxgB6GUm56A1Q9PNmmDUNeD1vL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3bMnfML/8+nFJZ7pmfK27Kt3HGUJVAvMehAvwYWK2FHPkjhwgzlp9jcjf9n7Pais+Zt+6RZK9nDO0fkThkZPvMzppYqmH1E2SO3lY3OMmBEVOrPHKF8= | ||
on_success: change | ||
on_failure: change |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Bluemix GraphQL Data Source: CloudFoundryApp | ||
|
||
This data source exposes parts of the [Cloud Foundry API](https://apidocs.cloudfoundry.org/253/) via the [Bluemix GraphQL](https://github.ibm.com/bluemix/graphql) µ-service. | ||
|
||
For more information about what data sources are and how they work, see https://ibm.biz/graphql-data-source | ||
|
||
## Development | ||
|
||
First, clone the repository and install dependencies: | ||
|
||
```sh | ||
# Clone the repo and move into the directory folder | ||
git clone git@github.ibm.com:bluemix/graphql-data-source-cloudfoundryapp.git | ||
cd graphql-data-source-cloudfoundryapp/ | ||
|
||
# Install dependencies | ||
npm install | ||
``` | ||
|
||
### To Develop In Local Mode | ||
|
||
Start the app with the following command: | ||
|
||
```sh | ||
# Run in local mode with mock data | ||
npm run local | ||
``` | ||
|
||
### To Develop in Atlas Mode | ||
|
||
Create `config/app_env_private.json` by duplicating `config/app_env_private.TEMPLATE.json`. Inside, add the required private environment variables. | ||
|
||
> **NOTE:** Information on where to get the required environment variables can | ||
> be found in the "How do I configure my application to use Bluemix?" section | ||
> of [this FAQ](https://ibm.biz/BdjXjr). | ||
Next, start the app in Atlas mode: | ||
|
||
```sh | ||
# Run in Atlas mode with live data | ||
npm run atlas | ||
``` | ||
|
||
### Notes for Developers | ||
|
||
Currently, there is no watch capability (PRs welcome!), so the service needs to be stopped (`control` + `C`) and restarted (`npm run [local|atlas]`) to reflect new changes to the data source. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"atlas": { | ||
"sessionKey": "", | ||
"sessionSecret": "", | ||
"uaaClientId": "", | ||
"uaaClientSecret": "" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
{ | ||
"defaults": { | ||
"target": "/", | ||
"useReferer": false, | ||
"error": { | ||
"target": "/maintenance", | ||
"path": "" | ||
} | ||
}, | ||
"services": { | ||
"graphql": { | ||
"url": "http://localhost:39051", | ||
"routes": { | ||
"/": "/" | ||
} | ||
}, | ||
"authentication": { | ||
"host": "opsconsole-authentication-opsconsoledev", | ||
"routes": { | ||
"/token": "/auth/token", | ||
"/login": "/login", | ||
"/logout": "/logout" | ||
}, | ||
"domain": "stage1.ng.bluemix.net", | ||
"url": "https://opsconsole-authentication-opsconsoledev.stage1.ng.bluemix.net" | ||
}, | ||
"common": { | ||
"host": "ace-common-opsconsoledev", | ||
"routes": { | ||
"/api": "/api", | ||
"/favicon.ico": "/favicon.ico", | ||
"/cache": "/cache", | ||
"/": "/common" | ||
}, | ||
"domain": "stage1.ng.bluemix.net", | ||
"url": "https://ace-common-opsconsoledev.stage1.ng.bluemix.net" | ||
}, | ||
"ops_admin": {}, | ||
"ops_boilerplate": { | ||
"url": "http://localhost:3900" | ||
}, | ||
"ops_catalog": {}, | ||
"ops_catalogservice": {}, | ||
"ops_check": {}, | ||
"ops_codi": {}, | ||
"ops_landingpage": {}, | ||
"ops_org": {}, | ||
"ops_organizations": {}, | ||
"ops_security": {}, | ||
"ops_status": {}, | ||
"ops_user": {}, | ||
"ops_usermanagement": {}, | ||
"events": { | ||
"host": "ace-events-opsconsoledev", | ||
"routes": { | ||
"/events": "/events" | ||
}, | ||
"domain": "stage1.ng.bluemix.net", | ||
"url": "https://ace-events-opsconsoledev.stage1.ng.bluemix.net" | ||
}, | ||
"ace_dashboard": { | ||
"host": "ace-dashboard-opsconsoledev", | ||
"routes": { | ||
"/dashboard/oauth2_proxy": "/oauth2_proxy", | ||
"/dashboard/home/onboard": "/dashboard/onboard", | ||
"/dashboard/slonboard": "/slonboard", | ||
"/dashboard": "/dashboard", | ||
"/dashboard/images": "/images", | ||
"/dashboard/home": "/home", | ||
"/dashboard/rest": "/rest", | ||
"/dashboard/lib": "/lib", | ||
"/robots.txt": "/robots.txt", | ||
"/sitemap.xml": "/sitemap.xml" | ||
}, | ||
"domain": "stage1.ng.bluemix.net", | ||
"url": "https://ace-dashboard-opsconsoledev.stage1.ng.bluemix.net" | ||
}, | ||
"maintenance": { | ||
"host": "ace-maintenance-opsconsoledev", | ||
"routes": { | ||
"/": "/maintenance" | ||
}, | ||
"domain": "stage1.ng.bluemix.net", | ||
"url": "https://ace-maintenance-opsconsoledev.stage1.ng.bluemix.net" | ||
} | ||
} | ||
} |
Oops, something went wrong.