Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: topcoder-platform/resources-api
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.2.5
Choose a base ref
...
head repository: topcoder-platform/resources-api
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
21 changes: 9 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -8,27 +8,23 @@ parameters:
type: boolean
defaults: &defaults
docker:
- image: cimg/python:3.11.0-browsers
- image: cimg/python:3.12.1-browsers
install_dependency: &install_dependency
name: Installation of build and deployment dependencies.
command: |
sudo apt update
sudo apt install jq
sudo apt install python3-pip
sudo pip3 install awscli --upgrade
sudo pip3 install docker-compose
pip3 install awscli --upgrade
install_deploysuite: &install_deploysuite
name: Installation of install_deploysuite.
command: |
git clone --branch v1.4.15 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
git clone --branch v1.4.17 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
cp ./../buildscript/master_deploy.sh .
cp ./../buildscript/buildenv.sh .
cp ./../buildscript/awsconfiguration.sh .
restore_cache_settings_for_build: &restore_cache_settings_for_build
key: docker-node-modules-{{ checksum "package-lock.json" }}
key: docker-node-modules-{{ checksum "yarn.lock" }}

save_cache_settings: &save_cache_settings
key: docker-node-modules-{{ checksum "package-lock.json" }}
key: docker-node-modules-{{ checksum "yarn.lock" }}
paths:
- node_modules

@@ -42,7 +38,7 @@ builddeploy_steps: &builddeploy_steps
- save_cache: *save_cache_settings
- deploy:
name: Running MasterScript.
command: "./awsconfiguration.sh $DEPLOY_ENV\nsource awsenvconf\n./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-deployvar\nsource buildenvvar\n./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${LOGICAL_ENV}-global-appvar,${LOGICAL_ENV}-${APPNAME}-appvar -i ${APPNAME}\n#testing code changes\nif [[ true ]]; then\n ./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-qa-v1-appvar\n source buildenvvar \n curl --request POST \\\n --url https://circleci.com/api/v2/project/github/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pipeline \\\n --header \"Circle-Token: ${QA_USER_TOKEN}\" \\\n --header 'content-type: application/json' \\\n --data '{\"branch\":\"'\"$CIRCLE_BRANCH\"'\",\"parameters\":{\"run_automatedtesting\":true , \"run_basedeployment\": false}}'\nfi \n #magic___^_^___line\n #magic___^_^___line\n"
command: "./awsconfiguration.sh $DEPLOY_ENV\nsource awsenvconf\n./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-deployvar\nsource buildenvvar\n./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${LOGICAL_ENV}-global-appvar,${LOGICAL_ENV}-${APPNAME}-appvar -i ${APPNAME} -p FARGATE\n#testing code changes\nif [[ true ]]; then\n ./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-qa-v1-appvar\n source buildenvvar \n curl --request POST \\\n --url https://circleci.com/api/v2/project/github/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pipeline \\\n --header \"Circle-Token: ${QA_USER_TOKEN}\" \\\n --header 'content-type: application/json' \\\n --data '{\"branch\":\"'\"$CIRCLE_BRANCH\"'\",\"parameters\":{\"run_automatedtesting\":true , \"run_basedeployment\": false}}'\nfi \n #magic___^_^___line\n #magic___^_^___line\n"
jobs:
# Build & Deploy against development backend
"build-dev":
@@ -107,15 +103,16 @@ workflows:
branches:
only:
- develop
- feature/scroll-search
- hotfix/deploy

# Production builds are exectuted only on tagged commits to the testing
# master branch.
- "build-prod":
context: org-global
filters:
branches:
only: master
only:
- master

testingflow:
when: << pipeline.parameters.run_automatedtesting >>
8 changes: 3 additions & 5 deletions ReadMe.md
Original file line number Diff line number Diff line change
@@ -59,11 +59,9 @@ The following parameters can be set in config files or in env variables:
- DYNAMODB.AWS_WRITE_UNITS: The DynamoDB table write unit configuration, default is 2
- DYNAMODB.TIMEOUT: The timeout setting used in health check
- SCOPES: The M2M scopes, refer `config/default.js` for more information
- ES.HOST: Elasticsearch host, default value is 'localhost:9200'
- ES.API_VERSION: Elasticsearch API version, default value is '6.8'
- ES.ES_INDEX: Elasticsearch index name for resources, default value is 'resources'
- ES.ES_TYPE: Elasticsearch index type for resources, default value is '_doc'
- ES.ES_REFRESH: Elasticsearch force refresh flag, default value is 'true'
- OS.HOST: Opensearch host, default value is 'localhost:9200'
- OS.OS_INDEX: Opensearch index name for resources, default value is 'resources'
- OS.OS_REFRESH: Opensearch force refresh flag, default value is 'true'
- BUSAPI_URL: the bus api, default value is 'https://api.topcoder-dev.com/v5'
- KAFKA_ERROR_TOPIC: Kafka error topic, default value is 'common.error.reporting',
- KAFKA_MESSAGE_ORIGINATOR: the Kafka message originator, default value is 'resources-api'
6 changes: 3 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
@@ -7,10 +7,10 @@ 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
mv yarn.lock old-yarn.lock
docker cp app:/$APP_NAME/yarn.lock yarn.lock
set +eo pipefail
UPDATE_CACHE=$(cmp package-lock.json old-package-lock.json)
UPDATE_CACHE=$(cmp yarn.lock old-yarn.lock)
set -eo pipefail
else
UPDATE_CACHE=1
15 changes: 7 additions & 8 deletions config/default.js
Original file line number Diff line number Diff line change
@@ -44,13 +44,11 @@ module.exports = {
TIMEOUT: process.env.DYNAMODB_TIMEOUT || 10000
},

ES: {
// above AWS_REGION is used if we use AWS ES
HOST: process.env.ES_HOST || 'localhost:9200',
API_VERSION: process.env.ES_API_VERSION || '6.8',
ES_INDEX: process.env.ES_INDEX || 'resources',
ES_TYPE: process.env.ES_TYPE || '_doc', // ES 6.x accepts only 1 Type per index and it's mandatory to define it
ES_REFRESH: process.env.ES_REFRESH || 'true'
OS: {
// above AWS_REGION is used if we use AWS OS
HOST: process.env.OS_HOST || 'localhost:9200',
OS_INDEX: process.env.OS_INDEX || 'resources',
OS_REFRESH: process.env.OS_REFRESH || 'true'
},

SCOPES: {
@@ -79,5 +77,6 @@ module.exports = {
SUPPORT_EMAIL: process.env.SUPPORT_EMAIL || 'support@topcoder.com'
},

AUTOMATED_TESTING_NAME_PREFIX: process.env.AUTOMATED_TESTING_NAME_PREFIX || 'POSTMANE2E-'
AUTOMATED_TESTING_NAME_PREFIX: process.env.AUTOMATED_TESTING_NAME_PREFIX || 'POSTMANE2E-',
TOPCROWD_CHALLENGE_TEMPLATE_ID: process.env.TOPCROWD_CHALLENGE_TEMPLATE_ID || '517e76b0-8824-4e72-9b48-a1ebde1793a8'
}
12 changes: 5 additions & 7 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Use the base image with Node.js
FROM node:latest
FROM node:14.21.3

# Copy the current directory into the Docker image
COPY . /resources-api
@@ -8,10 +8,8 @@ COPY . /resources-api
WORKDIR /resources-api

# Install the dependencies from package.json
RUN npm install
RUN npm run lint
RUN npm run lint:fix
#RUN npm run build
#RUN npm run test
RUN yarn install
RUN yarn lint
RUN yarn lint:fix

CMD npm start
CMD node app.js
Loading