-
Notifications
You must be signed in to change notification settings - Fork 3
dev to master #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dev to master #10
Changes from all commits
b69b341
b10735e
632531c
0cdbfd6
94dfc80
ecc2bc7
36ed70c
e70c080
1939008
5d77a1e
68cb0c7
62949da
428580f
3b0f267
5c82c28
c533f3f
3aea18b
42da375
a187616
12c8a90
235231d
b300d5a
e3aa240
3e3c62f
0752f4a
ea8cc3b
dc84442
efc8765
0bfb541
f5bc335
7a76ceb
22029cd
7dee263
29feca5
153d68d
4ae3029
b59b0c5
ab15e40
5d613b2
f288fdd
acc5c04
186cb3b
2458186
941ad70
7073bb4
d1e46cd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| version: 2 | ||
| defaults: &defaults | ||
| docker: | ||
| - image: cimg/python:3.12.1-browsers | ||
| install_dependency: &install_dependency | ||
| name: Installation of build and deployment dependencies. | ||
| command: | | ||
| pip3 install awscli --upgrade | ||
| install_deploysuite: &install_deploysuite | ||
| name: Installation of install_deploysuite. | ||
| command: | | ||
| git clone --branch v1.4.19 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript | ||
| cp ./../buildscript/master_deploy.sh . | ||
| cp ./../buildscript/buildenv.sh . | ||
| cp ./../buildscript/awsconfiguration.sh . | ||
| cp ./../buildscript/psvar-processor.sh . | ||
| restore_cache_settings_for_build: &restore_cache_settings_for_build | ||
| key: docker-node-modules-v6-{{ checksum "yarn.lock" }} | ||
|
|
||
| save_cache_settings: &save_cache_settings | ||
| key: docker-node-modules-v6-{{ checksum "yarn.lock" }} | ||
| paths: | ||
| - node_modules | ||
|
|
||
| builddeploy_steps: &builddeploy_steps | ||
| - checkout | ||
| - setup_remote_docker | ||
| - run: *install_dependency | ||
| - run: *install_deploysuite | ||
| - run: ./build.sh ${APPNAME} | ||
| - run: | ||
| name: Running MasterScript. | ||
| command: | | ||
| ./awsconfiguration.sh $DEPLOY_ENV | ||
| source awsenvconf | ||
| ./psvar-processor.sh -t appenv -p /config/${APPNAME}/deployvar | ||
| source deployvar_env | ||
| ./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -j /config/${APPNAME}/appvar,/config/common/global-appvar -i ${APPNAME} -p FARGATE | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| jobs: | ||
| # Build & Deploy against development backend | ||
| "build-dev": | ||
| !!merge <<: *defaults | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| environment: | ||
| DEPLOY_ENV: "DEV" | ||
| LOGICAL_ENV: "dev" | ||
| APPNAME: "member-api-v6" | ||
| steps: *builddeploy_steps | ||
|
|
||
| "build-prod": | ||
| !!merge <<: *defaults | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| environment: | ||
| DEPLOY_ENV: "PROD" | ||
| LOGICAL_ENV: "prod" | ||
| APPNAME: "member-api-v6" | ||
| steps: *builddeploy_steps | ||
|
|
||
| workflows: | ||
| version: 2 | ||
| build: | ||
| jobs: | ||
| # Development builds are executed on "develop" branch only. | ||
| - "build-dev": | ||
| context: org-global | ||
| filters: | ||
| branches: | ||
| only: | ||
| - develop | ||
|
|
||
| # Production builds are exectuted only on tagged commits to the | ||
| # master branch. | ||
| - "build-prod": | ||
| context: org-global | ||
| filters: | ||
| branches: | ||
| only: | ||
| - master | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| name: AI PR Reviewer | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: | ||
| - opened | ||
| - synchronize | ||
| permissions: | ||
| pull-requests: write | ||
| jobs: | ||
| tc-ai-pr-review: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Repo | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: TC AI PR Reviewer | ||
| uses: topcoder-platform/tc-ai-pr-reviewer@master | ||
| with: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # The GITHUB_TOKEN is there by default so you just need to keep it like it is and not necessarily need to add it as secret as it will throw an error. [More Details](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret) | ||
| LAB45_API_KEY: ${{ secrets.LAB45_API_KEY }} | ||
| exclude: '**/*.json, **/*.md, **/*.jpg, **/*.png, **/*.jpeg, **/*.bmp, **/*.webp' # Optional: exclude patterns separated by commas | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [💡 |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # can be used locally to config some env variables and after apply them using `source .env` | ||
| .env | ||
| ### Node ### | ||
| # Logs | ||
| logs | ||
| *.log | ||
| npm-debug.log* | ||
| .DS_Store | ||
| .tern-port | ||
| *# | ||
|
|
||
| dist/ | ||
|
|
||
| # Runtime data | ||
| pids | ||
| *.pid | ||
| *.seed | ||
| AGENTS.md | ||
|
|
||
| # Directory for instrumented libs generated by jscoverage/JSCover | ||
| lib-cov | ||
|
|
||
| # Coverage directory used by tools like istanbul | ||
| coverage | ||
|
|
||
| # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
| .grunt | ||
|
|
||
| # node-waf configuration | ||
| .lock-wscript | ||
|
|
||
| # Compiled binary addons (http://nodejs.org/api/addons.html) | ||
| build/Release | ||
|
|
||
| # Dependency directories | ||
| node_modules | ||
| jspm_packages | ||
|
|
||
| # Optional npm cache directory | ||
| .npm | ||
|
|
||
|
|
||
| .DS_Store | ||
| .idea | ||
| .vscode/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 21.6 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [💡 |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,3 +8,4 @@ Joi.page = () => Joi.number().integer().min(1).default(1) | |
| Joi.perPage = () => Joi.number().integer().min(1).max(100).default(50) | ||
| Joi.size = () => Joi.number().integer().min(1).max(1000).default(500) | ||
| Joi.sort = () => Joi.string().default('asc') | ||
| Joi.positive = () => Joi.number().integer().min(0) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [💡 |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,9 @@ const HttpStatus = require('http-status-codes') | |
| const logger = require('./src/common/logger') | ||
| const interceptor = require('express-interceptor') | ||
| const fileUpload = require('express-fileupload') | ||
| const path = require('path') | ||
| const swaggerUi = require('swagger-ui-express') | ||
| const YAML = require('yamljs') | ||
|
|
||
| // setup express app | ||
| const app = express() | ||
|
|
@@ -35,6 +38,18 @@ app.use(bodyParser.json()) | |
| app.use(bodyParser.urlencoded({ extended: true })) | ||
| app.set('port', config.PORT) | ||
|
|
||
| // Swagger / OpenAPI documentation | ||
| const swaggerDocument = YAML.load(path.join(__dirname, 'docs', 'swagger.yaml')) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| swaggerDocument.basePath = `/${config.API_VERSION}` | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| const docsRoute = `/${config.API_VERSION}/members/api-docs` | ||
| app.use(docsRoute, swaggerUi.serve, swaggerUi.setup(swaggerDocument, { | ||
| swaggerOptions: { docExpansion: 'list' }, | ||
| customSiteTitle: 'Topcoder Member API v6 Documentation' | ||
| })) | ||
| app.get(`${docsRoute}.json`, (req, res) => { | ||
| res.json(swaggerDocument) | ||
| }) | ||
|
|
||
| // intercept the response body from jwtAuthenticator | ||
| app.use(interceptor((req, res) => { | ||
| return { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #!/bin/bash | ||
| set -eo pipefail | ||
| APP_NAME=$1 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| UPDATE_CACHE="" | ||
| #docker-compose -f docker/docker-compose.yml build $APP_NAME | ||
| docker build -f docker/Dockerfile -t $APP_NAME:latest . | ||
| docker create --name app $APP_NAME:latest | ||
|
|
||
| if [ -d node_modules ] | ||
| then | ||
| mv package-lock.json old-package-lock.json | ||
| docker cp app:/$APP_NAME/package-lock.json package-lock.json | ||
| set +eo pipefail | ||
| UPDATE_CACHE=$(cmp package-lock.json old-package-lock.json) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| set -eo pipefail | ||
| else | ||
| UPDATE_CACHE=1 | ||
| fi | ||
|
|
||
| if [ "$UPDATE_CACHE" == 1 ] | ||
| then | ||
| docker cp app:/$APP_NAME/node_modules . | ||
| fi | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [💡 |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,7 +70,6 @@ module.exports = { | |
| } | ||
| }, | ||
|
|
||
|
|
||
| // Member identifiable info fields, copilots, admins, or M2M can get these fields | ||
| // Anyone in the constants.AUTOCOMPLETE_ROLES will have access to these fields | ||
| COMMUNICATION_SECURE_FIELDS: process.env.COMMUNICATION_SECURE_FIELDS | ||
|
|
@@ -120,20 +119,7 @@ module.exports = { | |
| MAMBO_DOMAIN_URL: process.env.MAMBO_DOMAIN_URL, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| MAMBO_DEFAULT_SITE: process.env.MAMBO_DEFAULT_SITE, | ||
|
|
||
| // Looker API access config | ||
| LOOKER: { | ||
| API_BASE_URL: process.env.LOOKER_API_BASE_URL, | ||
| API_CLIENT_ID: process.env.LOOKER_API_CLIENT_ID, | ||
| API_CLIENT_SECRET: process.env.LOOKER_API_CLIENT_SECRET, | ||
| EMBED_KEY: process.env.LOOKER_EMBED_KEY, | ||
| HOST: process.env.LOOKER_HOST, | ||
| SESSION_LENGTH: 1800, | ||
| TOKEN: process.env.LOOKER_API_TOKEN || 'TOKEN', | ||
| //24 hours, in milliseconds | ||
| CACHE_DURATION: 1000 * 60 * 60 * 24 | ||
| }, | ||
|
|
||
| HASHING_KEYS: { | ||
| USERFLOW: process.env.USERFLOW_PRIVATE_KEY, | ||
| USERFLOW: process.env.USERFLOW_PRIVATE_KEY | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # Use the base image with Node.js | ||
| FROM node:21.6.0 | ||
|
|
||
| # Copy the current directory into the Docker image | ||
| COPY . /member-api-v6 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
|
|
||
| # Set working directory for future use | ||
| WORKDIR /member-api-v6 | ||
|
|
||
| # Install the dependencies from package.json | ||
| RUN yarn | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
|
|
||
| CMD node app.js | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [💡 |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[❗❗
security]Cloning a specific branch from a public GitHub repository without verifying the integrity of the scripts can introduce security risks. Consider verifying the integrity of the scripts, for example, by checking a hash or using a trusted source.