Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
150 commits
Select commit Hold shift + click to select a range
a7c776a
Config update for v6
Gunasekar-K Jul 4, 2025
ef828a5
Updating docker compose
Gunasekar-K Jul 4, 2025
ffdc6ef
Updating docker compose
Gunasekar-K Jul 4, 2025
3dcb310
Updating docker file for build fix
Gunasekar-K Jul 4, 2025
fc0e045
Fixes for challenge status
jmgasper Jul 7, 2025
67f2fed
Merge branch 'v6' of github.com:topcoder-platform/work-manager into v6
jmgasper Jul 7, 2025
b8229b5
Tweak for status dropdown
jmgasper Jul 8, 2025
2a4abb9
Status dropdown fix
jmgasper Jul 8, 2025
66e70f5
Fix for cancel challenge status
jmgasper Jul 9, 2025
5791794
Point to v6 groups API
jmgasper Aug 7, 2025
299251c
Update react lib to v6 version
jmgasper Sep 4, 2025
2f7bad2
More v6 changes
jmgasper Sep 4, 2025
abdc179
Added reviewer section
rishabhtc Sep 4, 2025
114986d
Passed reviewer details
rishabhtc Sep 8, 2025
5f37507
Restructured the code: Moved the logic to services, actions and corre…
rishabhtc Sep 9, 2025
d56a1ce
Updated hostname in prod
rishabhtc Sep 9, 2025
866d9c8
Added reviewer total to challenge total
rishabhtc Sep 10, 2025
ca279a8
Show Reviewer section on Challenge view page
rishabhtc Sep 10, 2025
5fe8b9f
Revert status change
rishabhtc Sep 11, 2025
445377b
Updated reviewers to reviewer
rishabhtc Sep 11, 2025
2cf363f
Changed onUpdateOthers to onUpdateReviewers
rishabhtc Sep 11, 2025
e05594d
Renamed methods and props
rishabhtc Sep 11, 2025
9b17d61
Fixed metadata , phase issue, ConvertDollarToInteger
rishabhtc Sep 11, 2025
82aac16
Removed step
rishabhtc Sep 11, 2025
c0799c2
Fixed minor bugs
rishabhtc Sep 11, 2025
098c918
Merge pull request #1673 from topcoder-platform/feat/challenge-review…
rishabhtc Sep 12, 2025
aa2c591
Empty commit for CI/CD
jmgasper Sep 14, 2025
93d5eff
Fixed minor bugs
rishabhtc Sep 16, 2025
ccb69b8
PM-1349 Add CA challenge details link to WM
himaniraghav3 Sep 16, 2025
e6edb31
Merge branch 'develop' of github.com:topcoder-platform/work-manager i…
vas3a Sep 17, 2025
b04aa95
Merge pull request #1675 from topcoder-platform/PM-1349sa
jmgasper Sep 17, 2025
ac9299d
Merge pull request #1676 from topcoder-platform/v6-dev-sync
vas3a Sep 18, 2025
d494a46
Default reviewers call fix
jmgasper Sep 18, 2025
75248d3
Enum value changes to match expectations
jmgasper Sep 18, 2025
48494ed
PM-1939 Updated Review Configuration
rishabhtc Sep 18, 2025
469a67d
Merge pull request #1674 from topcoder-platform/fix-challenge-reviewe…
jmgasper Sep 18, 2025
2434bac
Fix enum values after merge from dev
jmgasper Sep 18, 2025
27a8d35
Merge branch 'v6' of github.com:topcoder-platform/work-manager into v6
jmgasper Sep 18, 2025
431c299
Remove legacy challenge block when launching challenges
jmgasper Sep 18, 2025
505201a
Changed type value and removed Review typeMap labels
rishabhtc Sep 22, 2025
63cb77b
removed extra ||
rishabhtc Sep 22, 2025
d73c557
Merge pull request #1677 from topcoder-platform/hotfix-pm-1939
rishabhtc Sep 22, 2025
4347f53
Replace space with underscore in track - Data science
rishabhtc Sep 23, 2025
93117e2
Merge pull request #1678 from topcoder-platform/pm-1833-data-science-…
rishabhtc Sep 23, 2025
f0b5e55
Endpoints for v6
jmgasper Sep 26, 2025
94620dd
Merge branch 'v6' of github.com:topcoder-platform/work-manager into v6
jmgasper Sep 26, 2025
1b3ffdc
Various small bugs fixes identified by QA
jmgasper Sep 26, 2025
9a3fd18
More fixes for CANCELLED statuses
jmgasper Sep 26, 2025
28704a6
Fixed error message and default phase selection
rishabhtc Sep 29, 2025
f0ad47d
Make sure registration is first before submission
jmgasper Sep 30, 2025
4b90526
Merge pull request #1681 from topcoder-platform/develop
jmgasper Sep 30, 2025
d6eb29c
Delete button to use new status values
jmgasper Sep 30, 2025
6fc88b1
Use new submission API response format when determining if there are …
jmgasper Sep 30, 2025
0d621d3
Fix default reviewer grab (PM-2102)
jmgasper Sep 30, 2025
e10dbc6
Only allow delete for NEW challenges, not DRAFT
jmgasper Sep 30, 2025
6d2c237
Clean up submissions tab (PM-2115)
jmgasper Sep 30, 2025
55723a4
Merge pull request #1680 from topcoder-platform/pm-1833-fix
kkartunov Oct 1, 2025
0b4f6cf
Validate reviewer errors on saving challenge
rishabhtc Oct 3, 2025
261533a
Optmized fetching scorecard on Challenge View page
rishabhtc Oct 3, 2025
2eccf36
minor code cleanups
rishabhtc Oct 3, 2025
c6b7f67
Merge pull request #1682 from topcoder-platform/pm-1833-validation-error
rishabhtc Oct 3, 2025
1eca2d3
Add link to review app to replace OR link (PM-2230)
jmgasper Oct 3, 2025
33aa667
git push origin Merge branch 'v6' of github.com:topcoder-platform/wor…
jmgasper Oct 3, 2025
2766d34
Fixes for submissions tab (PM-2115)
jmgasper Oct 5, 2025
e69b522
Better submission management to always show submissions tab (with 0 a…
jmgasper Oct 5, 2025
7803d87
Webpack and node version updates
jmgasper Oct 6, 2025
52316c6
Build fix
jmgasper Oct 6, 2025
4af15d8
Added v6 support for topcoder-react-lib
rishabhtc Oct 6, 2025
6a3e8c8
Corrected v6 API endpoint
rishabhtc Oct 6, 2025
7f3d972
Fixes for health check endpoint
jmgasper Oct 6, 2025
cb9214a
Add Review link to challenge view page (PM-2230)
jmgasper Oct 6, 2025
1348da3
Allow for cancellation during other phases than NEW
jmgasper Oct 7, 2025
7bd29dc
Removed specficScorecard logic
rishabhtc Oct 7, 2025
8fdd9bc
Removed extra calls for scorecard from parent component
rishabhtc Oct 7, 2025
90a8e6e
load scorecard only if either track or type present in challenge
rishabhtc Oct 7, 2025
61336b3
Merge pull request #1684 from topcoder-platform/PM-1833-fix-scorecard…
rishabhtc Oct 7, 2025
232eeb4
Updates to challenge API response for challenge type and track objects
jmgasper Oct 7, 2025
29b9492
Rename some fields to make them more consistent with other places in …
jmgasper Oct 7, 2025
c3edee5
Field updates to make them more consistent with other places in the p…
jmgasper Oct 7, 2025
1bfd21f
Merge pull request #1683 from topcoder-platform/pm-2311-ratings-issue
jmgasper Oct 7, 2025
a189372
Merge in scorecard filter for PM-2331, also handle TOpgear Task in th…
jmgasper Oct 7, 2025
73c7173
Merge branch 'v6' of github.com:topcoder-platform/work-manager into v6
jmgasper Oct 7, 2025
8065f03
Update for challenge track and type objects
jmgasper Oct 7, 2025
7b51f7a
Allow marathon matches to be created without specifying a review for …
jmgasper Oct 8, 2025
7ca953a
Better definitions for assigning reviewers and whether or not we want…
jmgasper Oct 9, 2025
f47ca8a
Fix ups for defining reviews
jmgasper Oct 10, 2025
3c84892
Remove idle timer
jmgasper Oct 10, 2025
0420c1d
fix: cannot delete drafts in work manager
hentrymartin Oct 10, 2025
156e400
fix: reset filter on viewing list view
hentrymartin Oct 10, 2025
ffe2aa6
Fixes for default reviewer setup
jmgasper Oct 11, 2025
0ade63d
Don't require a reviewer configuration for Tasks
jmgasper Oct 12, 2025
eb25aea
Added Delete Reviewer Functionality
rishabhtc Oct 13, 2025
43137fb
Merge pull request #1687 from topcoder-platform/pm-2364
hentrymartin Oct 13, 2025
0d9ea23
Merge pull request #1688 from topcoder-platform/pm-2353
hentrymartin Oct 13, 2025
9aeb827
Added Post-Mortem Reviewer role
rishabhtc Oct 14, 2025
28d474e
Removed flickering and protect all reviewers as safe fallback
rishabhtc Oct 14, 2025
2fcfd15
Added loader
rishabhtc Oct 14, 2025
b3febaa
Merge pull request #1689 from topcoder-platform/PM-2328-remove-review…
rishabhtc Oct 14, 2025
298ffc7
Removed trailling space
rishabhtc Oct 14, 2025
ce8e856
Merge pull request #1691 from topcoder-platform/PM-23280-remove-trail…
rishabhtc Oct 14, 2025
5752cdd
Merge pull request #1690 from topcoder-platform/PM-2396
rishabhtc Oct 14, 2025
458fed1
Use "Screener", not "Primary Screener" to match review API and autopi…
jmgasper Oct 15, 2025
fb0bfd1
Use "Screener" instead of "Primary Screener" in adding resource roles
jmgasper Oct 15, 2025
d5e490f
Update reviewers form
vas3a Oct 15, 2025
0376535
Merge pull request #1692 from topcoder-platform/update-reviewers-form
jmgasper Oct 15, 2025
ab56ef2
Round the estimated cost to 2 decimals.
jmgasper Oct 19, 2025
3dbab05
fix: updated assigned members
hentrymartin Oct 21, 2025
b49c684
fix: updating assigned reviewers
hentrymartin Oct 22, 2025
4b3b2a8
fix: lint
hentrymartin Oct 22, 2025
f02cc59
fix: lint
hentrymartin Oct 22, 2025
12d46df
debug logs
hentrymartin Oct 22, 2025
f40c129
fix: added iterative reviewer as role name
hentrymartin Oct 22, 2025
93f960a
Merge pull request #1693 from topcoder-platform/pm-2456
hentrymartin Oct 22, 2025
2bf7c3a
When adding/editing reviewers, re-assign the payment coefficients bas…
vas3a Oct 23, 2025
ade1e0f
fix ai review check
vas3a Oct 23, 2025
4dbe5e9
fix: added mapping to checkout phases
hentrymartin Oct 23, 2025
849cc5a
Merge pull request #1695 from topcoder-platform/handle-reviewer-payme…
vas3a Oct 23, 2025
3cb58bd
fix: improved index logic
hentrymartin Oct 23, 2025
b431ddc
lint fix
vas3a Oct 23, 2025
422201e
fix: update assigned reviewers only when reviewers are changed
hentrymartin Oct 23, 2025
8d3bd42
removed console.log
hentrymartin Oct 23, 2025
a23b3cb
Ensure we can select Topgear Task when launching
jmgasper Oct 23, 2025
7696d7b
Merge branch 'v6' of github.com:topcoder-platform/work-manager into v6
jmgasper Oct 23, 2025
574a7d0
Deploy develop branch
jmgasper Oct 23, 2025
a0dafc0
Fix nvmrc
jmgasper Oct 23, 2025
8d10db5
Fix up reviewer payment estimate
jmgasper Oct 24, 2025
fd88e8c
Merge pull request #1696 from topcoder-platform/pm-2456_1
hentrymartin Oct 24, 2025
9d79455
added Trivy action
kkartunov Oct 27, 2025
6826244
fix: avoid consecutive patch calls
hentrymartin Oct 27, 2025
b115531
fix: avoid consecutive patch calls
hentrymartin Oct 27, 2025
008abb9
fix: avoid consecutive patch calls
hentrymartin Oct 27, 2025
7ead801
Merge pull request #1697 from topcoder-platform/pm-2531
kkartunov Oct 28, 2025
03dabbe
from v6 to dev env
kkartunov Oct 28, 2025
2c19018
Update docker-compose.yml
Gunasekar-K Oct 28, 2025
0b5f7d7
fix docker file for v6
kkartunov Oct 28, 2025
779b85b
Merge pull request #1694 from topcoder-platform/v6
kkartunov Oct 28, 2025
26a5672
ci clean up
kkartunov Oct 28, 2025
ca1679c
-v6 clean up
kkartunov Oct 28, 2025
3323a7a
fix: show respective scorecard types for respective review type
hentrymartin Oct 28, 2025
94fc1c6
Merge pull request #1698 from topcoder-platform/pm-2609
jmgasper Oct 28, 2025
5b8e70f
fix: lint
hentrymartin Oct 28, 2025
97d7e07
Merge pull request #1699 from topcoder-platform/pm-2609_1
hentrymartin Oct 28, 2025
ddf4170
Better matching for "Checkpoint Screening" "Iterative Review", "Check…
jmgasper Oct 29, 2025
fd61d4c
fix: copilot url
hentrymartin Oct 29, 2025
cd918f5
fix: copilot url
hentrymartin Oct 29, 2025
6a7f36f
fix: copilot url
hentrymartin Oct 29, 2025
af17216
fix: get only active scorecards
hentrymartin Oct 29, 2025
db32357
fix: increase per page count to 200
hentrymartin Oct 29, 2025
98ac8ca
Merge pull request #1701 from topcoder-platform/pm-2609_2
hentrymartin Oct 29, 2025
473d443
Merge pull request #1700 from topcoder-platform/pm-2640
hentrymartin Oct 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ install_test_dependency: &install_test_dependency
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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
The branch version for tc-deploy-scripts has been updated from v1.4.15 to v1.4.17. Ensure that this new version is compatible with the rest of the deployment scripts and does not introduce breaking changes.

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-28-10-2020-{{ checksum "package-lock.json" }}
Expand All @@ -59,22 +60,27 @@ builddeploy_steps: &builddeploy_steps
name: "configuring environment"
command: |
./awsconfiguration.sh $DEPLOY_ENV
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-buildvar
#./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-buildvar
source awsenvconf
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
The buildenv.sh script has been commented out and replaced with psvar-processor.sh. Verify that psvar-processor.sh provides all necessary environment configurations previously handled by buildenv.sh to avoid missing configurations.

./psvar-processor.sh -t appenv -p /config/${APPNAME}/buildvar
echo awsenvconf >.dockerignore
echo buildenvvar >>.dockerignore
echo buildvar_env >>.dockerignore
- run:
name: "building image"
command: |
source buildenvvar
source buildvar_env
./build.sh ${APPNAME}
- deploy:
name: Running MasterScript.
command: |
#./awsconfiguration.sh $DEPLOY_ENV
source awsenvconf
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-deployvar
source buildenvvar
./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${LOGICAL_ENV}-global-appvar,${LOGICAL_ENV}-${APPNAME}-appvar -i ${APPNAME} -p FARGATE
#./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-deployvar
#source buildenvvar
./psvar-processor.sh -t appenv -p /config/${APPNAME}/deployvar
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
The buildenv.sh script has been commented out and replaced with psvar-processor.sh. Ensure that psvar-processor.sh correctly sets up the environment variables needed for deployment, as this change could affect the deployment process.

source deployvar_env
#./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${LOGICAL_ENV}-global-appvar,${LOGICAL_ENV}-${APPNAME}-appvar -i ${APPNAME} -p FARGATE
./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -j /config/common/global-appvar,/config/${APPNAME}/appvar -i ${APPNAME} -p FARGATE
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
The master_deploy.sh command now uses a different set of parameters for the -j option. Confirm that the new paths /config/common/global-appvar,/config/${APPNAME}/appvar are correct and accessible during deployment.

#curl --request POST \
#--url https://circleci.com/api/v2/project/github/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pipeline \
#--header "Circle-Token: ${CIRCLE_TOKEN}" \
Expand All @@ -93,13 +99,15 @@ smoke_testing: &smoke_testing # Initialization.
name: "configuring environment"
command: |
./awsconfiguration.sh $DEPLOY_ENV
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-buildvar
#./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-buildvar
./psvar-processor.sh -t appenv -p /config/${APPNAME}/buildvar
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
The buildenv.sh script has been commented out in the smoke testing configuration. Ensure that psvar-processor.sh provides all necessary environment configurations previously handled by buildenv.sh to avoid missing configurations during smoke tests.

- run:
name: "Run automation"
no_output_timeout: 20m
command: |
source awsenvconf
source buildenvvar
#source buildenvvar
source buildvar_env
./test-automation/smoketest.sh
- store_artifacts:
path: ./test-automation/test-results
Expand Down Expand Up @@ -152,7 +160,7 @@ workflows:
context: org-global
filters: &filters-dev
branches:
only: ["develop", "PM-803_wm-regression-fixes", "PM-902_show-all-projects-on-challenge-page", "pm-1365"]
only: ["develop"]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ maintainability]
The branch filter for development builds has been changed to only include the develop branch. Ensure this aligns with the intended workflow and that no other branches should trigger development builds.


# Production builds are exectuted only on tagged commits to the
# master branch.
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/trivy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Trivy Scanner

permissions:
contents: read
security-events: write
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ security]
The security-events: write permission is quite broad. Ensure that this level of access is necessary, as it could pose a security risk if not properly justified.

on:
push:
branches:
- main
- dev
pull_request:
jobs:
trivy-scan:
name: Use Trivy
runs-on: ubuntu-24.04
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ maintainability]
Consider using a stable or LTS version of Ubuntu (e.g., ubuntu-latest or ubuntu-22.04) to ensure long-term support and stability for the workflow.

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Run Trivy scanner in repo mode
uses: aquasecurity/trivy-action@0.33.1
with:
scan-type: "fs"
ignore-unfixed: true
format: "sarif"
output: "trivy-results.sarif"
severity: "CRITICAL,HIGH,UNKNOWN"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ correctness]
The severity levels include UNKNOWN, which might lead to unexpected results. Ensure this is intentional and aligns with your security policy.

scanners: vuln,secret,misconfig,license
github-pat: ${{ secrets.GITHUB_TOKEN }}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ security]
Ensure that the GITHUB_TOKEN has the necessary permissions and is securely managed, as it is used to authenticate the Trivy scanner.


- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: "trivy-results.sarif"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ yarn-error.log*
*.env
*.pem
*.vscode
*.pem
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[💡 maintainability]
The entry *.pem is duplicated. Consider removing the duplicate to maintain clarity and avoid confusion.

*.vscode
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[💡 maintainability]
The entry *.vscode is duplicated. Consider removing the duplicate to maintain clarity and avoid confusion.


# e2e test case
test-automation/temp
Expand Down
1 change: 1 addition & 0 deletions .local-ssl-proxy.pid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
321029
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12.17.0
22.19.0
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This is the frontend application for creating and managing challenges.
- [Resource ES Processor](https://github.com/topcoder-platform/resource-processor-es) - Updates resource data in Elasticsearch

## Prerequisites
- [NodeJS](https://nodejs.org/en/) (v10.15+)
- [NodeJS](https://nodejs.org/en/) (v22+)
- [Docker](https://www.docker.com/)
- [Docker Compose](https://docs.docker.com/compose/)

Expand All @@ -31,10 +31,10 @@ Development configuration is in `config/constants/development.js`

## Local Deployment Instructions

1. First install dependancies
1. First install dependencies

```bash
npm install
pnpm install
```

1. copy the environment file in docs/dev.env to /.env
Expand All @@ -45,10 +45,10 @@ npm install
1. Run the app in development mode

```bash
npm run dev
pnpm run start:dev
```

You can access the app from [http://localhost:3000/](http://localhost:3000/)
You can access the app from [http://localhost:5000/](http://localhost:5000/)

The page will reload if you make edits.

Expand All @@ -59,7 +59,7 @@ You will also see any lint errors in the console.
To test the app for lint errors

```bash
npm run lint
pnpm run lint
```

*Use the `--fix` flag to automatically fix errors.*
Expand All @@ -69,7 +69,7 @@ npm run lint
To build the app for production

```bash
npm run build
pnpm run build
```

Builds the app for production to the `build` folder.
Expand Down
55 changes: 40 additions & 15 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,49 @@
#!/bin/bash
set -eo pipefail

APP_NAME=$1
UPDATE_CACHE=""
LOCK_FILE_LOCAL=""
LOCK_FILE_NAME=""
UPDATE_CACHE=0

echo "NODE ENV: $NODE_ENV"
echo "BABEL ENV: $BABEL_ENV"
docker compose -f docker/docker-compose.yml build --build-arg NODE_ENV=$NODE_ENV --build-arg BABEL_ENV=$BABEL_ENV --build-arg FILE_PICKER_API_KEY=$FILE_PICKER_API_KEY --build-arg FORCE_DEV=$FORCE_DEV $APP_NAME
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)
set -eo pipefail
else
# Build the container image
docker compose -f docker/docker-compose.yml build \
--build-arg NODE_ENV=$NODE_ENV \
--build-arg BABEL_ENV=$BABEL_ENV \
--build-arg FILE_PICKER_API_KEY=$FILE_PICKER_API_KEY \
--build-arg FORCE_DEV=$FORCE_DEV \
$APP_NAME

# Create a throwaway container for copying artifacts
docker create --name app $APP_NAME:latest >/dev/null

# Determine which lockfile to compare (pnpm preferred, fallback to npm)
if [ -f pnpm-lock.yaml ]; then
LOCK_FILE_NAME="pnpm-lock.yaml"
elif [ -f package-lock.json ]; then
LOCK_FILE_NAME="package-lock.json"
fi

if [ -z "$LOCK_FILE_NAME" ] || [ ! -d node_modules ]; then
UPDATE_CACHE=1
else
# Compare lockfile from container with local copy
cp "$LOCK_FILE_NAME" ".old-$LOCK_FILE_NAME"
docker cp "app:/$APP_NAME/$LOCK_FILE_NAME" "$LOCK_FILE_NAME"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ correctness]
Consider checking the exit status of docker cp to ensure the lockfile is copied successfully. This will help avoid silent failures if the copy operation fails.

set +e
cmp "$LOCK_FILE_NAME" ".old-$LOCK_FILE_NAME" >/dev/null 2>&1
CMP_STATUS=$?
set -e
if [ $CMP_STATUS -ne 0 ]; then
UPDATE_CACHE=1
fi
fi

if [ "$UPDATE_CACHE" == 1 ]
then
docker cp app:/$APP_NAME/node_modules .
fi
if [ "$UPDATE_CACHE" -eq 1 ]; then
echo "Lockfile changed or node_modules missing; refreshing local node_modules from container..."
rm -rf node_modules
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ security]
The use of rm -rf node_modules is potentially dangerous as it will forcefully remove the directory without confirmation. Ensure that this is the intended behavior and that there are no unintended side effects.

docker cp "app:/$APP_NAME/node_modules" .
fi
36 changes: 20 additions & 16 deletions config/constants/development.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,43 @@ const DOMAIN = 'topcoder-dev.com'
const DEV_API_HOSTNAME = `https://api.${DOMAIN}`

const API_V5 = `${DEV_API_HOSTNAME}/v5`
const API_V6 = `${DEV_API_HOSTNAME}/v6`

module.exports = {
API_V2: `${DEV_API_HOSTNAME}/v2`,
API_V3: `${DEV_API_HOSTNAME}/v3`,
API_V4: `${DEV_API_HOSTNAME}/v4`,
API_V5,
API_V6,
ACCOUNTS_APP_CONNECTOR_URL: `https://accounts-auth0.${DOMAIN}`,
ACCOUNTS_APP_LOGIN_URL: `https://accounts-auth0.${DOMAIN}`,
COMMUNITY_APP_URL: `https://www.${DOMAIN}`,
MEMBER_API_URL: `${DEV_API_HOSTNAME}/v5/members`,
CHALLENGE_API_URL: `${DEV_API_HOSTNAME}/v5/challenges`,
MEMBER_API_URL: `${DEV_API_HOSTNAME}/v6/members`,
CHALLENGE_API_URL: `${DEV_API_HOSTNAME}/v6/challenges`,
CHALLENGE_DEFAULT_REVIEWERS_URL: `${DEV_API_HOSTNAME}/v6/challenge/default-reviewers`,
CHALLENGE_API_VERSION: '1.1.0',
CHALLENGE_TIMELINE_TEMPLATES_URL: `${DEV_API_HOSTNAME}/v5/timeline-templates`,
CHALLENGE_TYPES_URL: `${DEV_API_HOSTNAME}/v5/challenge-types`,
CHALLENGE_TRACKS_URL: `${DEV_API_HOSTNAME}/v5/challenge-tracks`,
CHALLENGE_PHASES_URL: `${DEV_API_HOSTNAME}/v5/challenge-phases`,
CHALLENGE_TIMELINES_URL: `${DEV_API_HOSTNAME}/v5/challenge-timelines`,
CHALLENGE_TIMELINE_TEMPLATES_URL: `${DEV_API_HOSTNAME}/v6/timeline-templates`,
CHALLENGE_TYPES_URL: `${DEV_API_HOSTNAME}/v6/challenge-types`,
CHALLENGE_TRACKS_URL: `${DEV_API_HOSTNAME}/v6/challenge-tracks`,
CHALLENGE_PHASES_URL: `${DEV_API_HOSTNAME}/v6/challenge-phases`,
CHALLENGE_TIMELINES_URL: `${DEV_API_HOSTNAME}/v6/challenge-timelines`,
COPILOTS_URL: 'https://copilots.topcoder-dev.com',
PROJECT_API_URL: `${DEV_API_HOSTNAME}/v5/projects`,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ correctness]
The PROJECT_API_URL is still using the /v5 endpoint, while other similar URLs have been updated to /v6. Verify if this is intentional or if it should be updated to maintain consistency.

GROUPS_API_URL: `${DEV_API_HOSTNAME}/v5/groups`,
GROUPS_API_URL: `${DEV_API_HOSTNAME}/v6/groups`,
TERMS_API_URL: `${DEV_API_HOSTNAME}/v5/terms`,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ correctness]
The TERMS_API_URL is still using the /v5 endpoint, while other similar URLs have been updated to /v6. Verify if this is intentional or if it should be updated to maintain consistency.

RESOURCES_API_URL: `${DEV_API_HOSTNAME}/v5/resources`,
RESOURCE_ROLES_API_URL: `${DEV_API_HOSTNAME}/v5/resource-roles`,
SUBMISSIONS_API_URL: `${DEV_API_HOSTNAME}/v5/submissions`,
REVIEW_TYPE_API_URL: `${DEV_API_HOSTNAME}/v5/reviewTypes`,
RESOURCES_API_URL: `${DEV_API_HOSTNAME}/v6/resources`,
RESOURCE_ROLES_API_URL: `${DEV_API_HOSTNAME}/v6/resource-roles`,
SUBMISSIONS_API_URL: `${DEV_API_HOSTNAME}/v6/submissions`,
REVIEW_TYPE_API_URL: `${DEV_API_HOSTNAME}/v6/reviewTypes`,
REVIEWS_API_URL: `${DEV_API_HOSTNAME}/v6/reviews`,
SCORECARDS_API_URL: `${DEV_API_HOSTNAME}/v6/scorecards`,
WORKFLOWS_API_URL: `${DEV_API_HOSTNAME}/v6/workflows`,
SUBMISSION_REVIEW_APP_URL: `https://submission-review.${DOMAIN}/challenges`,
STUDIO_URL: `https://studio.${DOMAIN}`,
CONNECT_APP_URL: `https://connect.${DOMAIN}`,
DIRECT_PROJECT_URL: `https://www.${DOMAIN}/direct`,
ONLINE_REVIEW_URL: `https://software.${DOMAIN}`,
REVIEW_APP_URL: `https://review.${DOMAIN}`,
DEFAULT_TERM_UUID: '317cd8f9-d66c-4f2a-8774-63c612d99cd4', // Terms & Conditions of Use at TopCoder
DEFAULT_NDA_UUID: 'e5811a7b-43d1-407a-a064-69e5015b4900', // NDA v3.0
SUBMITTER_ROLE_UUID: '732339e7-8e30-49d7-9198-cccf9451e221',
Expand All @@ -49,10 +57,6 @@ module.exports = {
FILE_PICKER_REGION: 'us-east-1',
FILE_PICKER_CNAME: 'fs.topcoder.com',
FILE_PICKER_LOCATION: 's3',
// if idle for this many minutes, show user a prompt saying they'll be logged out
IDLE_TIMEOUT_MINUTES: 10,
// duration to show the prompt saying user will be logged out, before actually logging out the user
IDLE_TIMEOUT_GRACE_MINUTES: 5,
MULTI_ROUND_CHALLENGE_TEMPLATE_ID: 'd4201ca4-8437-4d63-9957-3f7708184b07',
UNIVERSAL_NAV_URL: 'https://uni-nav.topcoder-dev.com/v1/tc-universal-nav.js',
HEADER_AUTH_URLS_HREF: `https://accounts-auth0.${DOMAIN}?utm_source=community-app-main`,
Expand Down
10 changes: 9 additions & 1 deletion config/constants/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
module.exports = (() => {
let env = process.env.NODE_ENV || 'development'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[💡 maintainability]
Consider using const instead of let for env since its value is not reassigned after initialization. This can prevent accidental reassignment and improve code clarity.

if (process.env.FORCE_DEV) env = 'development'
// for security reason don't let to require any arbitrary file defined in process.env

// Only allow specific files to be required for security reasons
if (env === 'production') {
return require('./production')
}

// Support explicit local environment (mirrors platform-ui local setup)
const hostEnv = process.env.HOST_ENV
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[💡 maintainability]
Consider using const instead of let for hostEnv since its value is not reassigned after initialization. This can prevent accidental reassignment and improve code clarity.

if (env === 'local' || hostEnv === 'local') {
return require('./local')
}

// Default to development
return require('./development')
})()
Loading