Skip to content

Commit a83f54f

Browse files
authored
Merge pull request #835 from MetaCell/feature/CH-239
Improve distribution of helm chart
2 parents f5bd4ba + 4da5e4e commit a83f54f

22 files changed

Lines changed: 451 additions & 135 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Cloud Harness
2+
3+
Cloud Harness provides software infrastructure and tools for neuroscience data computing and analysis in a monorepo.
4+
5+
## General concepts
6+
7+
### Files content
8+
9+
- `applications`: Cloud Harness custom server applications go here
10+
- `client`: Cloud Harness generated client api
11+
- `deployment`: deployment related scripts and files
12+
- `deployment-configuration`: deployment customization files
13+
- `infrastructure`: infrastructure utilities
14+
- `libraries`: Cloud Harness shared libraries
15+
- `docs`: developers documentation files
16+
- `tools`: Cloud Harness CLI and other tools
17+
- `test`: Cloud Harness test utilities and test code
18+
19+
Verify which application/components is in scope and read specific prompt instruction before proceeding.
20+
21+
Check best practices in every instruction file in scope and docs and apply them when writing code or performing code reviews.
22+
Use reference for any questions regarding project structure, development workflow, and best practices.
23+
If you have any doubts about where to find information, ask for clarification before proceeding.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
applyTo: "test/e2e/*"
3+
---
4+
# Neuroglass Research E2E Tests
5+
6+
## End-to-end (E2E) Tests
7+
- **Location**: `test/e2e/*.spec.ts`
8+
- **Framework**: Jest + Puppeteer (see existing tests for patterns)
9+
10+
### Login Flow
11+
- Tests must handle the 2-step login redirect when `APP_URL` points to the accounts domain.
12+
- Use `USERNAME` and `PASSWORD` environment variables for credentials.
13+
- Follow the existing flow:
14+
- Navigate to `APP_URL` and detect redirect to accounts.
15+
- Enter username, submit, wait for password field, enter password, submit.
16+
- Wait for redirect back to the app and confirm route.
17+
18+
### Stability Requirements (Mandatory)
19+
- **Waiting**: Always use Puppeteer explicit waits (`waitForSelector`, `waitForFunction`, `waitForNavigation`) with timeouts.
20+
- **Selectors**: Rely on stable, custom selectors (see `test/e2e/selectors.ts`).
21+
- **Do not** depend on UI copy, text content, or fragile DOM structure.
22+
- **Avoid fixed sleeps** unless there is no deterministic signal; prefer state-based waits.
23+
- **Resilience**: When possible, guard against flaky overlays (cookie/announcement modals).
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
applyTo: "tools/deployment-cli-tools/*
3+
---
4+
# Neuroglass Project Developer Reference
5+
6+
## Environment Setup
7+
8+
### Required Environment
9+
- **Conda Environment Name**: `ch`
10+
- **Python Version**: 3.12+
11+
- **Activation Command**: `conda activate ch`
12+
13+
### Package Managers
14+
- **Frontend**: Yarn (NEVER use npm)
15+
- **Backend**: pip (within conda environment only)
16+
17+
### Pre-requisites Checklist
18+
- [ ] Conda environment `ch` is activated
19+
- [ ] Correct directory navigation completed
20+
- [ ] Appropriate package manager selected (yarn/pip)
21+
22+
## Development Workflow
23+
24+
### Mandatory Pre-Command Steps
25+
1. **ALWAYS** activate conda environment first: `conda activate ch`
26+
2. Navigate to the appropriate project directory
27+
3. Use yarn for frontend operations, pip for backend operations
28+
29+
## Project Structure
30+
31+
### Key Scripts
32+
- `harness-generate` - Generate code
33+
- `harness-deployment` - Generate deployment files: helm charts, ci/cd files, etc.
34+
- `harness-application` - Generate application code (e.g., Django apps)
35+
- `harness-migrate` - Migration helper tool
36+
- `ch_cli_tools` - Python package for deployment and other tools
37+
- `tests` - Unit test utilities and test code
38+
39+
40+
## Code Style and best practices
41+
42+
Take the following best practices into account when writing code for the project adn while performing code reviews:
43+
44+
- Keep architecture lean: avoid unnecessary layers and abstractions.
45+
- Use utils for stateless pure functions that don't hit external data sources nor the ORM. Utils are horizontal and can be used across the project.
46+
- Use helpers to organize pieces of business logic; keep them stateless when possible.
47+
- Use services for business workflows and cross-model coordination. Services are vertical on a single model or a group of related models
48+
- Keep model logic close to the model when it represents domain rules or invariants.
49+
- Handle exceptions only at the higher level; let lower layers raise. NEVER catch exceptions in helpers or services unless you are adding context and re-raising.
50+
- Cover critical logic with unit tests, especially in helpers and services. Use mocks to isolate units under test.
51+
- Prefer models classes for helpers and services to ensure data validation and clear interfaces. Use typed dicts for structured data that isn't covered by Schema classes. Use plain dicts only to represent real unstructured data. Avoid returning tuples.
52+
53+
54+
## Important Constraints
55+
56+
### File Creation Rules
57+
- **NEVER** create new README or documentation files unless explicitly requested
58+
- Follow existing documentation patterns when updates are needed
59+
60+
### Development Server Rules
61+
- **NEVER** run development servers
62+
- **ALWAYS** assume servers are running
63+
- **MUST** ask confirmation before opening browsers
64+
65+
### Package Management Rules
66+
- **Frontend**: ONLY use yarn, NEVER npm
67+
- **Backend**: ONLY use pip within conda environment
68+
- **ALWAYS** activate `ch` conda environment before any backend work
69+
70+
### CloudHarness Considerations
71+
- Dependencies may need special handling in development environment
72+
- Follow established patterns for CloudHarness integration
73+
74+
---

applications/samples/deploy/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
harness:
22
subdomain: samples
3+
image_name: sampleapp
34
secured: true
45
sentry: true
56
port: 80
@@ -50,6 +51,7 @@ harness:
5051
- workflows
5152
- events
5253
- accounts
54+
- cloudharness-base
5355
- common
5456
build:
5557
- cloudharness-flask

deployment-configuration/codefresh-template-dev.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ steps:
3434
working_directory: .
3535
commands:
3636
- bash cloud-harness/install.sh
37-
- harness-deployment $PATHS -d ${{DOMAIN}} -r ${{REGISTRY}} -rs '${{REGISTRY_SECRET}}' -n ${{NAMESPACE}} --write-env -e $ENV --cache-url '${{IMAGE_CACHE_URL}}' $PARAMS
37+
- export HELM_META_ARGS="$( [ -n "${{HARNESS_CHART_NAME}}" ] && printf -- "--name %s " "${{HARNESS_CHART_NAME}}"; [ -n "${{HARNESS_CHART_VERSION}}" ] && printf -- "--chart-version %s " "${{HARNESS_CHART_VERSION}}"; [ -n "${{HARNESS_APP_VERSION}}" ] && printf -- "--app-version %s" "${{HARNESS_APP_VERSION}}" )"
38+
- harness-deployment $PATHS -d ${{DOMAIN}} -r ${{REGISTRY}} -rs '${{REGISTRY_SECRET}}' -n ${{NAMESPACE}} --write-env -e $ENV --cache-url '${{IMAGE_CACHE_URL}}' $HELM_META_ARGS $PARAMS
3839
- cat deployment/.env >> ${{CF_VOLUME_PATH}}/env_vars_to_export
3940
- cat ${{CF_VOLUME_PATH}}/env_vars_to_export
4041
prepare_deployment_view:

deployment-configuration/codefresh-template-prod.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ steps:
3030
working_directory: .
3131
commands:
3232
- bash cloud-harness/install.sh
33-
- harness-deployment $PATHS -t ${{DEPLOYMENT_TAG}} -d ${{DOMAIN}} -r ${{REGISTRY}} -rs '${{REGISTRY_SECRET}}' -n ${{NAMESPACE}} -e $ENV --no-cd $PARAMS
33+
- export HELM_META_ARGS="$( [ -n "${{HARNESS_CHART_NAME}}" ] && printf -- "--name %s " "${{HARNESS_CHART_NAME}}"; [ -n "${{HARNESS_CHART_VERSION}}" ] && printf -- "--chart-version %s " "${{HARNESS_CHART_VERSION}}"; [ -n "${{HARNESS_APP_VERSION}}" ] && printf -- "--app-version %s" "${{HARNESS_APP_VERSION}}" )"
34+
- harness-deployment $PATHS -t ${{DEPLOYMENT_TAG}} -d ${{DOMAIN}} -r ${{REGISTRY}} -rs '${{REGISTRY_SECRET}}' -n ${{NAMESPACE}} -e $ENV --no-cd $HELM_META_ARGS $PARAMS
3435
prepare_deployment_view:
3536
commands:
3637
- "helm template ./deployment/helm --debug -n ${{NAMESPACE}}"

deployment-configuration/codefresh-template-stage.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ steps:
3333
working_directory: .
3434
commands:
3535
- bash cloud-harness/install.sh
36-
- harness-deployment $PATHS -t ${{DEPLOYMENT_TAG}} -d ${{DOMAIN}} -r ${{REGISTRY}} -rs ${{REGISTRY_SECRET}} -n ${{NAMESPACE}} -e $ENV --no-cd $PARAMS
36+
- export HELM_META_ARGS="$( [ -n "${{HARNESS_CHART_NAME}}" ] && printf -- "--name %s " "${{HARNESS_CHART_NAME}}"; [ -n "${{HARNESS_CHART_VERSION}}" ] && printf -- "--chart-version %s " "${{HARNESS_CHART_VERSION}}"; [ -n "${{HARNESS_APP_VERSION}}" ] && printf -- "--app-version %s" "${{HARNESS_APP_VERSION}}" )"
37+
- harness-deployment $PATHS -t ${{DEPLOYMENT_TAG}} -d ${{DOMAIN}} -r ${{REGISTRY}} -rs ${{REGISTRY_SECRET}} -n ${{NAMESPACE}} -e $ENV --no-cd $HELM_META_ARGS $PARAMS
3738
prepare_deployment_view:
3839
commands:
3940
- "helm template ./deployment/helm --debug -n ${{NAMESPACE}}"

deployment-configuration/codefresh-template-test.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ steps:
3333
working_directory: .
3434
commands:
3535
- bash cloud-harness/install.sh
36-
- harness-deployment $PATHS -n test-${{NAMESPACE_BASENAME}} -d ${{DOMAIN}} -r ${{REGISTRY}} -rs ${{REGISTRY_SECRET}} -e $ENV --write-env --cache-url '${{IMAGE_CACHE_URL}}' -N $PARAMS
36+
- export HELM_META_ARGS="$( [ -n "${{HARNESS_CHART_NAME}}" ] && printf -- "--name %s " "${{HARNESS_CHART_NAME}}"; [ -n "${{HARNESS_CHART_VERSION}}" ] && printf -- "--chart-version %s " "${{HARNESS_CHART_VERSION}}"; [ -n "${{HARNESS_APP_VERSION}}" ] && printf -- "--app-version %s" "${{HARNESS_APP_VERSION}}" )"
37+
- harness-deployment $PATHS -n test-${{NAMESPACE_BASENAME}} -d ${{DOMAIN}} -r ${{REGISTRY}} -rs ${{REGISTRY_SECRET}} -e $ENV --write-env --cache-url '${{IMAGE_CACHE_URL}}' -N $HELM_META_ARGS $PARAMS
3738
- cat deployment/.env >> ${{CF_VOLUME_PATH}}/env_vars_to_export
3839
- cat ${{CF_VOLUME_PATH}}/env_vars_to_export
3940
prepare_deployment_view:

0 commit comments

Comments
 (0)