Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
add in github workflows
Hutchec3653240eb3
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERSnew file mode 100644index 0000000000..9196f53653--- /dev/null+++ b/.github/CODEOWNERS@@ -0,0 +1,28 @@+/rust/cloud-storage/infra/ @whutchinson98+/rust/cloud-storage/authentication_service/ @whutchinson98+/rust/cloud-storage/notification_service/ @whutchinson98+/rust/cloud-storage/notification_db_client/ @whutchinson98+/rust/cloud-storage/macro_notify/ @whutchinson98+/rust/cloud-storage/sqs_client/ @whutchinson98+/rust/cloud-storage/ses_client/ @whutchinson98+/rust/cloud-storage/sns_client/ @whutchinson98+/rust/cloud-storage/secretsmanager_client/ @whutchinson98+/rust/cloud-storage/opensearch_client/ @whutchinson98+/rust/cloud-storage/search_processing_service/ @whutchinson98+/rust/cloud-storage/search_service/ @whutchinson98+/rust/cloud-storage/models_search/ @whutchinson98+/rust/cloud-storage/models_notification/ @whutchinson98+/rust/cloud-storage/macro_db_client/ @whutchinson98+/infra/ @whutchinson98++/rust/cloud-storage/email_db_client @evanhutnik+/rust/cloud-storage/email_service @evanhutnik+/rust/cloud-storage/gmail_client @evanhutnik+/rust/cloud-storage/model/src/gmail @evanhutnik+/rust/cloud-storage/model/src/email @evanhutnik++/rust/cloud-storage/models_properties @danielkweon+/rust/cloud-storage/properties_db_client @danielkweon+/rust/cloud-storage/properties_service @danielkweon++/rust/cloud-storage/frecency @seanayediff --git a/.github/actions/deploy-cloud-storage-pulumi/action.yml b/.github/actions/deploy-cloud-storage-pulumi/action.ymlnew file mode 100644index 0000000000..898c21e590--- /dev/null+++ b/.github/actions/deploy-cloud-storage-pulumi/action.yml@@ -0,0 +1,92 @@+name: Deploy cloud storage pulumi stack+description: Deploy a pulumi stack from cloud-storage pulumi++inputs:+ use-docker:+ description: 'Whether to setup docker'+ required: false+ default: 'true'+ use-lfs:+ description: 'Whether to checkout LFS content'+ required: false+ default: 'false'+ environment:+ description: 'Environment to deploy to'+ required: false+ default: 'dev'+ aws-access-key:+ description: 'AWS access key'+ required: true+ aws-secret-key:+ description: 'AWS secret key'+ required: true+ aws-region:+ description: 'AWS region'+ required: false+ default: 'us-east-1'+ pulumi-access-token:+ description: 'The access token for pulumi'+ required: true+ pulumi-service-name:+ description: 'The name of the pulumi service to deploy. This will be the exact name of the folder containing your stacks.'+ required: true+ dd-app-key:+ description: 'Datadog app key'+ required: true+ dd-api-key:+ description: 'Datadog api key'+ required: true+ dd-host:+ description: 'Datadog host'+ required: false+ default: 'https://api.us5.datadoghq.com/'++runs:+ using: composite+ steps:+ # checkout the repo+ - uses: actions/checkout@v4+ with:+ lfs: ${{ inputs.use-lfs }}++ # setup docker+ - uses: docker/setup-buildx-action@v3+ if: ${{ inputs.use-docker == 'true' }}++ # install bun+ - uses: oven-sh/setup-bun@v2+ with:+ bun-version: 1.2.0++ # install dependencies in infra folder+ # TODO: setup cache for bun+ - name: install infra dependencies+ shell: bash+ run: |+ cd infra+ bun install++ # configure aws credentials+ - uses: aws-actions/configure-aws-credentials@v4+ with:+ aws-access-key-id: ${{ inputs.aws-access-key }}+ aws-secret-access-key: ${{ inputs.aws-secret-key }}+ aws-region: ${{ inputs.aws-region }}++ # login to ecr to allow pulumi to pull down services for caching+ - name: login to ecr+ shell: bash+ run: |+ aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 569036502058.dkr.ecr.us-east-1.amazonaws.com++ # deploy+ - uses: pulumi/actions@v5+ with:+ command: up+ stack-name: macro-inc/${{ inputs.environment }}+ work-dir: ./infra/stacks/${{ inputs.pulumi-service-name }}+ env:+ PULUMI_ACCESS_TOKEN: ${{ inputs.pulumi-access-token }}+ DD_APP_KEY: ${{ inputs.dd-app-key }}+ DD_API_KEY: ${{ inputs.dd-api-key }}+ DD_HOST: ${{ inputs.dd-host }}diff --git a/.github/actions/get-project-name/action.yml b/.github/actions/get-project-name/action.ymlnew file mode 100644index 0000000000..4964685e51--- /dev/null+++ b/.github/actions/get-project-name/action.yml@@ -0,0 +1,23 @@+name: Get Project Name+description: Get the Pulumi project name for a service from services-config.json++inputs:+ service-name:+ description: 'The service name to look up'+ required: true++outputs:+ project-name:+ description: 'The Pulumi project directory name'+ value: ${{ steps.get-project.outputs.project_name }}++runs:+ using: composite+ steps:+ - name: Get project path for ${{ inputs.service-name }}+ id: get-project+ shell: bash+ run: |+ PROJECT_NAME=$(.github/actions/get-project-name/get-project-name.sh "${{ inputs.service-name }}")+ echo "project_name=$PROJECT_NAME" >> $GITHUB_OUTPUT+ echo "Using project: $PROJECT_NAME for service: ${{ inputs.service-name }}"diff --git a/.github/actions/get-project-name/get-project-name.sh b/.github/actions/get-project-name/get-project-name.shnew file mode 100755index 0000000000..f0a5516955--- /dev/null+++ b/.github/actions/get-project-name/get-project-name.sh@@ -0,0 +1,26 @@+#!/bin/bash+set -e++# Get project name from service name using services-config.json+# Usage: ./get-project-name.sh <service-name>++if [ -z "$1" ]; then+ echo "Error: service-name is required" >&2+ echo "Usage: $0 <service-name>" >&2+ exit 1+fi++SERVICE_NAME="$1"++STACK_PATH=$(jq -r --arg svc "$SERVICE_NAME" '.services[$svc].stack_path // "null"' .github/services-config.json)++if [ "$STACK_PATH" == "null" ]; then+ echo "Error: Service '$SERVICE_NAME' not found in services-config.json" >&2+ exit 1+fi++# Remove /** suffix if present+STACK_PATH_CLEAN="${STACK_PATH%/**}"+PROJECT_NAME=$(basename "$STACK_PATH_CLEAN")++echo "$PROJECT_NAME"diff --git a/.github/actions/get-project-name/test.sh b/.github/actions/get-project-name/test.shnew file mode 100755index 0000000000..5409216194--- /dev/null+++ b/.github/actions/get-project-name/test.sh@@ -0,0 +1,49 @@+#!/bin/bash+set -e++# Test script for get-project-name action+# Run from repo root: .github/actions/get-project-name/test.sh++echo "Testing get-project-name action..."+echo ""++# Array of test cases: service-name:expected-project-name+TEST_CASES=(+ "document-storage-service:cloud-storage-service"+ "document-storage:document-storage"+ "authentication-service:authentication-service"+ "comms-service:comms-service"+ "search-service:search-service"+ "opensearch:opensearch"+)++FAILED=0+PASSED=0++for test_case in "${TEST_CASES[@]}"; do+ SERVICE_NAME="${test_case%%:*}"+ EXPECTED="${test_case##*:}"++ # Use the actual script+ if PROJECT_NAME=$(.github/actions/get-project-name/get-project-name.sh "$SERVICE_NAME" 2>&1); then+ if [ "$PROJECT_NAME" == "$EXPECTED" ]; then+ echo "✅ PASS: $SERVICE_NAME -> $PROJECT_NAME"+ ((PASSED++))+ else+ echo "❌ FAIL: $SERVICE_NAME -> Expected: '$EXPECTED', Got: '$PROJECT_NAME'"+ ((FAILED++))+ fi+ else+ echo "❌ FAIL: Service '$SERVICE_NAME' error: $PROJECT_NAME"+ ((FAILED++))+ fi+done++echo ""+echo "Results: $PASSED passed, $FAILED failed"++if [ $FAILED -gt 0 ]; then+ exit 1+fi++echo "All tests passed! ✅"diff --git a/.github/actions/preview-cloud-storage-pulumi/action.yml b/.github/actions/preview-cloud-storage-pulumi/action.ymlnew file mode 100644index 0000000000..fc55b6b277--- /dev/null+++ b/.github/actions/preview-cloud-storage-pulumi/action.yml@@ -0,0 +1,97 @@+name: Preview cloud storage pulumi stack+description: Run pulumi preview (dry run) for a pulumi stack from cloud-storage++inputs:+ use-docker:+ description: 'Whether to setup docker'+ required: false+ default: 'true'+ use-lfs:+ description: 'Whether to checkout LFS content'+ required: false+ default: 'false'+ environment:+ description: 'Environment to preview'+ required: false+ default: 'dev'+ aws-access-key:+ description: 'AWS access key'+ required: true+ aws-secret-key:+ description: 'AWS secret key'+ required: true+ aws-region:+ description: 'AWS region'+ required: false+ default: 'us-east-1'+ pulumi-access-token:+ description: 'The access token for pulumi'+ required: true+ pulumi-service-name:+ description: 'The name of the pulumi service to preview. This will be the exact name of the folder containing your stacks.'+ required: true+ dd-app-key:+ description: 'Datadog app key'+ required: true+ dd-api-key:+ description: 'Datadog api key'+ required: true+ dd-host:+ description: 'Datadog host'+ required: false+ default: 'https://api.us5.datadoghq.com/'+ github-token:+ description: 'GitHub token for PR comments'+ required: false+ default: ''++runs:+ using: composite+ steps:+ # checkout the repo+ - uses: actions/checkout@v4+ with:+ lfs: ${{ inputs.use-lfs }}++ # setup docker+ - uses: docker/setup-buildx-action@v3+ if: ${{ inputs.use-docker == 'true' }}++ # install bun+ - uses: oven-sh/setup-bun@v2+ with:+ bun-version: 1.2.0++ # install dependencies in infra folder+ - name: install infra dependencies+ shell: bash+ run: |+ cd infra+ bun install++ # configure aws credentials+ - uses: aws-actions/configure-aws-credentials@v4+ with:+ aws-access-key-id: ${{ inputs.aws-access-key }}+ aws-secret-access-key: ${{ inputs.aws-secret-key }}+ aws-region: ${{ inputs.aws-region }}++ # login to ecr to allow pulumi to pull down services for caching+ - name: login to ecr+ shell: bash+ run: |+ aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 569036502058.dkr.ecr.us-east-1.amazonaws.com++ # preview changes+ - uses: pulumi/actions@v5+ with:+ command: preview+ stack-name: macro-inc/${{ inputs.environment }}+ work-dir: ./infra/stacks/${{ inputs.pulumi-service-name }}+ comment-on-pr: ${{ inputs.github-token != '' }}+ github-token: ${{ inputs.github-token }}+ env:+ PULUMI_ACCESS_TOKEN: ${{ inputs.pulumi-access-token }}+ DD_APP_KEY: ${{ inputs.dd-app-key }}+ DD_API_KEY: ${{ inputs.dd-api-key }}+ DD_HOST: ${{ inputs.dd-host }}diff --git a/.github/actions/setup-rust/action.yml b/.github/actions/setup-rust/action.ymlnew file mode 100644index 0000000000..430b964d80--- /dev/null+++ b/.github/actions/setup-rust/action.yml@@ -0,0 +1,18 @@+name: Setup Rust+description: Installs rust++runs:+ using: composite+ steps:+ - uses: actions-rs/toolchain@v1+ with:+ toolchain: stable+ - name: setup rust version+ shell: bash+ run: rustup update stable && rustup default stable+ - name: setup rust caching+ uses: Swatinem/rust-cache@v2+ with:+ shared-key: cloud-storage+ cache-all-crates: true+ workspaces: "cloud-storage"diff --git a/.github/pull_request_template.md b/.github/pull_request_template.mdnew file mode 100644index 0000000000..686d243ae1--- /dev/null+++ b/.github/pull_request_template.md@@ -0,0 +1,9 @@+## Summary+<!--+A good summary consists of a two sentence overview followed by bullet points (or checklist items for WIP).+-->++## Screenshots, GIFs, and Videos+<!--+Include visual representations of your changes, including GIFs/videos. Screencaptures should fully illustrate sample user behavior.+-->diff --git a/.github/scripts/detect-affected-services.sh b/.github/scripts/detect-affected-services.shnew file mode 100755index 0000000000..c5a489990e--- /dev/null+++ b/.github/scripts/detect-affected-services.sh@@ -0,0 +1,133 @@+#!/bin/bash+set -e++# This script detects which services are affected by changes in the cloud-storage workspace+# It uses cargo metadata to build a proper dependency graph++# Get changed files from git+CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD | grep "^cloud-storage/" || true)++if [ -z "$CHANGED_FILES" ]; then+ echo "No cloud-storage files changed"+ echo "services=[]"+ echo "has_changes=false"+ exit 0+fi++echo "Changed files:" >&2+echo "$CHANGED_FILES" >&2++# Change to cloud-storage directory+cd cloud-storage++# Get cargo metadata for the entire workspace with dependencies+METADATA=$(cargo metadata --format-version 1 --no-deps)++# Extract changed packages from the changed files+CHANGED_PACKAGES=()+while IFS= read -r file; do+ # Extract package directory from file path (e.g., cloud-storage/models_bulk_upload/src/lib.rs -> models_bulk_upload)+ if [[ "$file" =~ ^cloud-storage/([^/]+)/ ]]; then+ PKG_NAME="${BASH_REMATCH[1]}"+ # Check if this is actually a package in our workspace+ if echo "$METADATA" | jq -r --arg name "$PKG_NAME" '.packages[] | select(.name == $name) | .name' | grep -q "$PKG_NAME"; then+ # Avoid duplicates+ if [[ ! " ${CHANGED_PACKAGES[@]} " =~ " ${PKG_NAME} " ]]; then+ CHANGED_PACKAGES+=("$PKG_NAME")+ echo "Package $PKG_NAME has direct changes" >&2+ fi+ fi+ fi+done <<< "$CHANGED_FILES"++# Now find all services that are affected+AFFECTED_SERVICES=()++# Get services from the config file+SERVICES=$(jq -r '.services | keys[]' ../.github/services-config.json)++for service in $SERVICES; do+ SERVICE_AFFECTED=false++ # Get the source paths for this service from config+ SOURCE_PATHS=$(jq -r --arg svc "$service" '.services[$svc].source_paths[]? // empty' ../.github/services-config.json)++ # Check stack path changes+ STACK_PATH=$(jq -r --arg svc "$service" '.services[$svc].stack_path // empty' ../.github/services-config.json)+ if [ -n "$STACK_PATH" ]; then+ STACK_PATH_PATTERN="${STACK_PATH%/**}"+ if echo "$CHANGED_FILES" | grep -q "^$STACK_PATH_PATTERN"; then+ SERVICE_AFFECTED=true+ echo "Service $service affected by stack changes" >&2+ fi+ fi++ # If no source paths, check if already affected by stack+ if [ -z "$SOURCE_PATHS" ]; then+ if [ "$SERVICE_AFFECTED" = true ]; then+ AFFECTED_SERVICES+=("$service")+ fi+ continue+ fi++ # Check if any source path has direct changes+ while IFS= read -r source_path; do+ if [ -n "$source_path" ]; then+ SOURCE_PATH_PATTERN="${source_path%/**}"+ if echo "$CHANGED_FILES" | grep -q "^$SOURCE_PATH_PATTERN"; then+ SERVICE_AFFECTED=true+ echo "Service $service has direct source changes in $source_path" >&2+ break+ fi+ fi+ done <<< "$SOURCE_PATHS"++ # Check if any of the service's packages depend on changed packages+ if [ "$SERVICE_AFFECTED" = false ] && [ ${#CHANGED_PACKAGES[@]} -gt 0 ]; then+ echo "Checking dependencies for service $service..." >&2++ # For each source path of the service, extract the package name and check its dependencies+ while IFS= read -r source_path; do+ if [ -n "$source_path" ]; then+ # Extract package name from source path (remove /** suffix if present and get basename)+ SOURCE_PATH_CLEAN="${source_path%/**}"+ SOURCE_PKG_NAME=$(basename "$SOURCE_PATH_CLEAN")+ echo " Checking if $SOURCE_PKG_NAME depends on changed packages..." >&2++ # Get all dependencies of this package+ DEPS=$(echo "$METADATA" | jq -r --arg name "$SOURCE_PKG_NAME" '+ .packages[] |+ select(.name == $name) |+ .dependencies[] |+ .name+ ' | sort -u)++ # Check if any changed package is in the dependencies+ for changed_pkg in "${CHANGED_PACKAGES[@]}"; do+ if echo "$DEPS" | grep -q "^$changed_pkg$"; then+ SERVICE_AFFECTED=true+ echo " ✓ Service $service (via $SOURCE_PKG_NAME) depends on changed package: $changed_pkg" >&2+ break 2 # Break both loops+ fi+ done+ fi+ done <<< "$SOURCE_PATHS"+ fi++ if [ "$SERVICE_AFFECTED" = true ]; then+ AFFECTED_SERVICES+=("$service")+ fi+done++# Output results+if [ ${#AFFECTED_SERVICES[@]} -gt 0 ]; then+ # Create JSON array+ SERVICES_JSON=$(printf '%s\n' "${AFFECTED_SERVICES[@]}" | jq -R . | jq -s . | jq -c .)+ echo "services=$SERVICES_JSON"+ echo "has_changes=true"+ echo "Affected services: ${AFFECTED_SERVICES[@]}" >&2+else+ echo "services=[]"+ echo "has_changes=false"+ echo "No services affected by changes" >&2+fi\ No newline at end of filediff --git a/.github/services-config.json b/.github/services-config.jsonnew file mode 100644index 0000000000..781926e63d--- /dev/null+++ b/.github/services-config.json@@ -0,0 +1,200 @@+{+ "services": {+ "authentication-service": {+ "source_paths": [+ "rust/cloud-storage/authentication_service/**"+ ],+ "stack_path": "infra/stacks/authentication-service/**"+ },+ "bulk-upload": {+ "source_paths": [+ "rust/cloud-storage/upload_extractor_lambda_handler/**",+ "rust/cloud-storage/upload_extractor_lambda_trigger/**"+ ],+ "stack_path": "infra/stacks/bulk-upload/**"+ },+ "comms-service": {+ "source_paths": [+ "rust/cloud-storage/comms_service/**"+ ],+ "stack_path": "infra/stacks/comms-service/**"+ },+ "connection-gateway": {+ "source_paths": [+ "rust/cloud-storage/connection_gateway/**"+ ],+ "stack_path": "infra/stacks/connection-gateway/**"+ },+ "contacts-service": {+ "source_paths": [+ "rust/cloud-storage/contacts_service/**"+ ],+ "stack_path": "infra/stacks/contacts-service/**"+ },+ "convert-service": {+ "source_paths": [+ "rust/cloud-storage/convert_service/**"+ ],+ "stack_path": "infra/stacks/convert-service/**"+ },+ "delete-document-worker": {+ "source_paths": [+ "rust/cloud-storage/delete_document_worker/**"+ ],+ "stack_path": "infra/stacks/delete-document-worker/**"+ },+ "deleted-item-poller": {+ "source_paths": [+ "rust/cloud-storage/deleted_item_poller/**"+ ],+ "stack_path": "infra/stacks/deleted-item-poller/**"+ },+ "document-cognition-service": {+ "source_paths": [+ "rust/cloud-storage/document_cognition_service/**"+ ],+ "stack_path": "infra/stacks/document-cognition-service/**"+ },+ "document-storage-service": {+ "source_paths": [+ "rust/cloud-storage/document_storage_service/**"+ ],+ "stack_path": "infra/stacks/cloud-storage-service/**"+ },+ "document-storage": {+ "source_paths": [+ "rust/cloud-storage/document_storage_service/**"+ ],+ "stack_path": "infra/stacks/document-storage/**"+ },+ "document-text-extractor": {+ "source_paths": [+ "rust/cloud-storage/document_text_extractor/**"+ ],+ "stack_path": "infra/stacks/document-text-extractor/**"+ },+ "email-service": {+ "source_paths": [+ "rust/cloud-storage/email_service/**"+ ],+ "stack_path": "infra/stacks/email-service/**"+ },+ "experiment-service": {+ "source_paths": [+ "rust/cloud-storage/experiment_service/**"+ ],+ "stack_path": "infra/stacks/experiment-service/**"+ },+ "insight-service": {+ "source_paths": [+ "rust/cloud-storage/insight_service/**"+ ],+ "stack_path": "infra/stacks/insight-service/**"+ },+ "metering-service": {+ "source_paths": [+ "rust/cloud-storage/metering_service/**"+ ],+ "stack_path": "infra/stacks/metering-service/**"+ },+ "notification-service": {+ "source_paths": [+ "rust/cloud-storage/notification_service/**"+ ],+ "stack_path": "infra/stacks/notification-service/**"+ },+ "notification-email-poller": {+ "source_paths": [+ "rust/cloud-storage/notification_email_poller/**"+ ],+ "stack_path": "infra/stacks/notification-email-poller/**"+ },+ "organization-service": {+ "source_paths": [+ "rust/cloud-storage/organization_service/**"+ ],+ "stack_path": "infra/stacks/organization-service/**"+ },+ "organization-retention": {+ "source_paths": [+ "rust/cloud-storage/organization_retention/**"+ ],+ "stack_path": "infra/stacks/organization-retention/**"+ },+ "properties-service": {+ "source_paths": [+ "rust/cloud-storage/properties_service/**"+ ],+ "stack_path": "infra/stacks/properties-service/**"+ },+ "search-processing-service": {+ "source_paths": [+ "rust/cloud-storage/search_processing_service/**"+ ],+ "stack_path": "infra/stacks/search-processing-service/**"+ },+ "search-service": {+ "source_paths": [+ "rust/cloud-storage/search_service/**"+ ],+ "stack_path": "infra/stacks/search-service/**"+ },+ "search-upload": {+ "source_paths": [+ "rust/cloud-storage/search_upload/**"+ ],+ "stack_path": "infra/stacks/search-upload/**"+ },+ "static-file-service": {+ "source_paths": [+ "rust/cloud-storage/static_file_service/**"+ ],+ "stack_path": "infra/stacks/static-file-service/**"+ },+ "unfurl-service": {+ "source_paths": [+ "rust/cloud-storage/unfurl_service/**"+ ],+ "stack_path": "infra/stacks/unfurl-service/**"+ },+ "sha-cleanup": {+ "source_paths": [+ "rust/cloud-storage/sha_cleanup_worker/**"+ ],+ "stack_path": "infra/stacks/sha-cleanup/**"+ },+ "sha-ref-count-resetter": {+ "source_paths": [+ "rust/cloud-storage/sha_ref_count_resetter/**"+ ],+ "stack_path": "infra/stacks/sha-ref-count-resetter/**"+ },+ "opensearch": {+ "stack_path": "infra/stacks/opensearch/**"+ },+ "search-event-queue": {+ "stack_path": "infra/stacks/search-event-queue/**"+ },+ "search-text-extractor-queue": {+ "stack_path": "infra/stacks/search-text-extractor-queue/**"+ },+ "document-storage-bucket-integrations": {+ "stack_path": "infra/stacks/document-storage-bucket-integrations/**"+ },+ "link-sharing": {+ "stack_path": "infra/stacks/link-sharing/**"+ },+ "email-suppression": {+ "source_paths": [+ "rust/cloud-storage/email_suppression/**"+ ],+ "stack_path": "infra/stacks/email-suppression/**"+ },+ "dlp-handler": {+ "source_paths": [+ "rust/cloud-storage/dlp_handler/**"+ ],+ "stack_path": "infra/stacks/dlp-handler/**"+ }+ }+}diff --git a/.github/workflows/assign-author.yml b/.github/workflows/assign-author.ymlnew file mode 100644index 0000000000..00f1c6da81--- /dev/null+++ b/.github/workflows/assign-author.yml@@ -0,0 +1,13 @@+name: Pull Request++on:+ pull_request:+ types: [opened, reopened]++jobs:+ assignAuthor:+ name: Assign author to PR+ runs-on: ubuntu-latest+ steps:+ - name: Assign author to PR+ uses: technote-space/assign-author@v1diff --git a/.github/workflows/cargo-deny.yml b/.github/workflows/cargo-deny.ymlnew file mode 100644index 0000000000..4623ceeee3--- /dev/null+++ b/.github/workflows/cargo-deny.yml@@ -0,0 +1,24 @@+name: cargo deny check++on:+ pull_request:+ branches: ['main']+ paths:+ - 'rust/cloud-storage/Cargo.toml'+ - 'rust/cloud-storage/**/Cargo.toml'+ - 'rust/cloud-storage/Cargo.lock'+ - 'rust/cloud-storage/deny.toml'+ - .github/workflows/cargo-deny.yml++concurrency:+ group: cargo-deny-${{ github.ref }}+ cancel-in-progress: true++jobs:+ cargo-deny:+ runs-on: ubuntu-22.04+ steps:+ - uses: actions/checkout@v4+ - uses: EmbarkStudios/cargo-deny-action@v2+ with:+ manifest-path: rust/cloud-storage/Cargo.tomldiff --git a/.github/workflows/cargo-workspace-dependency-check.yml b/.github/workflows/cargo-workspace-dependency-check.ymlnew file mode 100644index 0000000000..e7ccb2423e--- /dev/null+++ b/.github/workflows/cargo-workspace-dependency-check.yml@@ -0,0 +1,29 @@+name: cargo workspace dependency check+on:+ pull_request:+ branches: [ 'main' ]+ paths:+ - 'rust/cloud-storage/Cargo.toml'+ - 'rust/cloud-storage/**/Cargo.toml'+ - .github/workflows/cargo-workspace-dependency-check.yml++concurrency:+ group: cargo-workspace-dependency-check-${{ github.ref }}+ cancel-in-progress: true++jobs:+ dependency-check:+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v3+ - uses: actions-rs/toolchain@v1+ with:+ toolchain: stable+ - name: setup rust version+ run: rustup default 1.85+ - name: install tool+ run: cargo install [email protected]+ - name: check+ run: |+ cd rust/cloud-storage+ cargo-workspace-dependency-checkerdiff --git a/.github/workflows/code-check-cloud-storage.yml b/.github/workflows/code-check-cloud-storage.ymlnew file mode 100644index 0000000000..b28dd94b7c--- /dev/null+++ b/.github/workflows/code-check-cloud-storage.yml@@ -0,0 +1,172 @@+name: cloud storage code check+on:+ pull_request:+ branches: [ 'main' ]+ paths:+ - 'rust/cloud-storage/**'+ - .github/workflows/code-check-cloud-storage.yml++concurrency:+ group: code-check-cloud-storage-${{ github.ref }}+ cancel-in-progress: true++jobs:+ check:+ runs-on:+ [+ runs-on,+ runner=8cpu-linux-x64,+ hdd=40,+ spot=false,+ ssh=false,+ 'run-id=${{github.run_id}}',+ ]+ if: github.event.pull_request.draft == false+ env:+ CARGO_TERM_COLOR: always+ RUSTFLAGS: "-Dwarnings"+ RUSTDOCFLAGS: "-Dwarnings"+ SQLX_OFFLINE: true+ steps:+ - uses: runs-on/action@v1+ - uses: actions/checkout@v4+ - uses: ./.github/actions/setup-rust+ - name: fmt+ run: |+ cd rust/cloud-storage+ cargo fmt --check+ - name: clippy+ run: |+ cd rust/cloud-storage+ cargo clippy++ test:+ runs-on:+ [+ runs-on,+ runner=8cpu-linux-x64,+ hdd=40,+ spot=false,+ ssh=false,+ 'run-id=${{github.run_id}}',+ ]+ if: github.event.pull_request.draft == false+ services:+ postgres:+ image: postgres:16+ env:+ POSTGRES_USER: user+ POSTGRES_PASSWORD: password+ POSTGRES_DB: macrodb # Start with macrodb, we initialize all others in the cloud-storage/justfile+ ports:+ - 5432:5432+ # needed because the postgres container does not provide a healthcheck+ options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5+ steps:+ - uses: runs-on/action@v1+ - uses: actions/checkout@v4+ - uses: ./.github/actions/setup-rust+ - uses: actions/cache@v4+ with:+ path: |+ ~/.cargo/bin/+ ~/.cargo/registry/index/+ ~/.cargo/registry/cache/+ ~/.cargo/git/db/+ key: ${{ runner.os }}-cargo-${{ hashFiles('rust/cloud-storage/Cargo.lock') }}+ restore-keys: |+ ${{ runner.os }}-cargo-+ - name: install dependencies+ run: |+ cargo install just --force+ cargo install sqlx-cli --force+ - name: prepare tests+ run: |+ just rust/cloud-storage/setup_test_envs+ just rust/cloud-storage/initialize_dbs+ - name: run tests+ run: |+ cd rust/cloud-storage+ cargo test++ diff-check:+ runs-on: ubuntu-latest+ if: github.event.pull_request.draft == false+ outputs:+ docx-unzip-handler: ${{ steps.changes.outputs.docx-unzip-handler }}+ worker-trigger: ${{ steps.changes.outputs.worker-trigger }}+ document-text-extractor: ${{ steps.changes.outputs.document-text-extractor }}+ organization_retention_trigger: ${{ steps.changes.outputs.organization_retention_trigger }}+ organization_retention_handler: ${{ steps.changes.outputs.organization_retention_handler }}+ delete_chat_handler: ${{ steps.changes.outputs.delete_chat_handler }}+ search_upload_handler: ${{ steps.changes.outputs.search_upload_handler }}+ upload_extractor_lambda_trigger: ${{ steps.changes.outputs.upload_extractor_lambda_trigger }}+ upload_extractor_lambda_handler: ${{ steps.changes.outputs.upload_extractor_lambda_handler }}+ email_suppression_handler: ${{ steps.changes.outputs.email_suppression_handler }}+ deleted_item_poller: ${{ steps.changes.outputs.deleted_item_poller }}+ email_refresh_handler: ${{ steps.changes.outputs.email_refresh_handler }}+ email_scheduled_handler: ${{ steps.changes.outputs.email_scheduled_handler }}+ user_link_cleanup_handler: ${{ steps.changes.outputs.user_link_cleanup_handler }}+ steps:+ - uses: actions/checkout@v4+ - uses: whutchinson98/[email protected]+ id: changes+ with:+ token: ${{ GITHUB.TOKEN }}+ diff: |+ docx-unzip-handler: ./rust/cloud-storage/docx-unzip-handler/*+ worker-trigger: ./rust/cloud-storage/worker-trigger/*+ document-text-extractor: ./rust/cloud-storage/document-text-extractor/*+ organization_retention_trigger: ./rust/cloud-storage/organization_retention_trigger/*+ organization_retention_handler: ./rust/cloud-storage/organization_retention_handler/*+ delete_chat_handler: ./rust/cloud-storage/delete_chat_handler/*+ search_upload_handler: ./rust/cloud-storage/search_upload_handler/*+ upload_extractor_lambda_trigger: ./rust/cloud-storage/upload_extractor_lambda_trigger/*+ upload_extractor_lambda_handler: ./rust/cloud-storage/upload_extractor_lambda_handler/*+ email_suppression_handler: ./rust/cloud-storage/email_suppression_handler/*+ deleted_item_poller: ./rust/cloud-storage/deleted_item_poller/*+ email_refresh_handler: ./rust/cloud-storage/email_refresh_handler/*+ email_scheduled_handler: ./rust/cloud-storage/email_scheduled_handler/*+ user_link_cleanup_handler: ./rust/cloud-storage/user_link_cleanup_handler/*+ lambda_aggregate_frecency: ./rust/cloud-storage/lambda_aggregate_frecency/*++ check-lambdas:+ needs: diff-check+ runs-on: ubuntu-latest+ if: github.event.pull_request.draft == false+ strategy:+ # we want to fail the particular item that failed not all of them.+ fail-fast: false+ matrix:+ include:+ - service: docx-unzip-handler+ - service: worker-trigger+ - service: document-text-extractor+ - service: organization_retention_trigger+ - service: organization_retention_handler+ - service: delete_chat_handler+ - service: search_upload_handler+ - service: upload_extractor_lambda_trigger+ - service: upload_extractor_lambda_handler+ - service: email_suppression_handler+ - service: deleted_item_poller+ - service: email_refresh_handler+ - service: email_scheduled_handler+ - service: user_link_cleanup_handler+ steps:+ - name: setup env var+ shell: bash+ run: |+ echo "Check for ${{ matrix.service }}"+ echo "SHOULD_RUN=${{ needs.diff-check.outputs[matrix.service] }}" >> $GITHUB_ENV+ - uses: actions/checkout@v4+ if: env.SHOULD_RUN == 'true'+ - name: check if lambda is built+ if: env.SHOULD_RUN == 'true'+ run: |+ echo "Checking diff to ensure bootstrap.zip is part of PR"+ git fetch origin ${{ github.base_ref }}+ if ! git diff --name-only --diff-filter=AM origin/${{ github.base_ref }} HEAD | grep "rust/cloud-storage/target/lambda/${{ matrix.service }}/bootstrap.zip" > /dev/null; then+ echo "Code changes detected, but new bootstrap.zip for ${{matrix.service}} not found in PR. Please run: just rust/cloud-storage/${{matrix.service}}/build to build and commit bootstrap.zip. Alternatively you can run just rust/cloud-storage/build_lambads to build all lambdas."+ exit 1+ fidiff --git a/.github/workflows/code-check-infra.yml b/.github/workflows/code-check-infra.ymlnew file mode 100644index 0000000000..d8d087fb6f--- /dev/null+++ b/.github/workflows/code-check-infra.yml@@ -0,0 +1,29 @@+name: infra code check+on:+ pull_request:+ branches: [ 'main' ]+ paths:+ - 'rust/cloud-storage/infra/**'+ - .github/workflows/code-check-infra.yml++concurrency:+ group: code-check-infra-${{ github.ref }}+ cancel-in-progress: true++jobs:+ biome-check:+ runs-on: ubuntu-latest+ if: github.event.pull_request.draft == false+ steps:+ - uses: actions/checkout@v4+ - uses: actions/setup-node@v4+ with:+ node-version: 21+ - name: Setup Biome+ uses: biomejs/setup-biome@v2+ with:+ # keep this in sync with package.json+ version: 2.2.6+ - name: Run Biome+ run: |+ biome ci infradiff --git a/.github/workflows/deploy-all-services.yml b/.github/workflows/deploy-all-services.ymlnew file mode 100644index 0000000000..be0ac33b9b--- /dev/null+++ b/.github/workflows/deploy-all-services.yml@@ -0,0 +1,88 @@+name: Deploy All Services+on:+ workflow_dispatch:+ inputs:+ environment:+ type: choice+ required: true+ default: 'dev'+ options:+ - dev+ - prod+ description: The environment we are deploying to.++# Only run 1 deploy-all workflow at a time per environment+concurrency:+ group: ${{ github.workflow }}-all-services-${{ inputs.environment }}+ cancel-in-progress: false++jobs:+ setup:+ name: Setup Deployment Matrix+ runs-on: ubuntu-latest+ outputs:+ matrix: ${{ steps.set-matrix.outputs.matrix }}+ steps:+ - uses: actions/checkout@v4+ - name: Set deployment matrix+ id: set-matrix+ run: |+ # Get all services+ services=$(jq -r '.services | keys | @json' .github/services-config.json)+ echo "matrix=${services}" >> $GITHUB_OUTPUT+ echo "Deploying services: ${services}"++ deploy-services:+ name: Deploy ${{ matrix.service }}+ needs: setup+ if: ${{ needs.setup.outputs.matrix != '[]' }}+ runs-on:+ [+ runs-on,+ runner=8cpu-linux-x64,+ hdd=40,+ spot=false,+ ssh=false,+ 'run-id=${{github.run_id}}',+ ]+ strategy:+ fail-fast: false+ max-parallel: 20 # Limit concurrent deployments+ matrix:+ service: ${{ fromJson(needs.setup.outputs.matrix) }}+ steps:+ - uses: actions/checkout@v4++ - name: Get project name+ id: project-name+ uses: ./.github/actions/get-project-name+ with:+ service-name: ${{ matrix.service }}++ - name: Deploy ${{ matrix.service }}+ uses: ./.github/actions/deploy-cloud-storage-pulumi+ with:+ environment: ${{ inputs.environment }}+ aws-access-key: ${{ secrets.AWS_ACCESS_KEY }}+ aws-secret-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}+ pulumi-access-token: ${{ secrets.PULUMI_ACCESS_TOKEN }}+ pulumi-service-name: ${{ steps.project-name.outputs.project-name }}+ dd-app-key: ${{ secrets.DD_APP_KEY }}+ dd-api-key: ${{ secrets.DD_API_KEY }}++ deployment-summary:+ name: Deployment Summary+ runs-on: ubuntu-latest+ needs: deploy-services+ if: always()+ steps:+ - name: Check deployment results+ run: |+ if [[ "${{ needs.deploy-services.result }}" == "failure" ]]; then+ echo "❌ One or more service deployments failed"+ exit 1+ elif [[ "${{ needs.deploy-services.result }}" == "skipped" ]]; then+ echo "⏭️ No services to deploy"+ else+ echo "✅ All service deployments completed successfully for ${{ inputs.environment }} environment"+ fidiff --git a/.github/workflows/deploy-cloud-storage-on-push.yml b/.github/workflows/deploy-cloud-storage-on-push.ymlnew file mode 100644index 0000000000..9d37ac6749--- /dev/null+++ b/.github/workflows/deploy-cloud-storage-on-push.yml@@ -0,0 +1,108 @@+name: Deploy Cloud Storage Services on Push++on:+ push:+ branches: [ 'main' ]+ paths:+ - 'rust/cloud-storage/**'+ - '.github/workflows/deploy-cloud-storage-on-push.yml'+ - '.github/services-config.json'++concurrency:+ group: deploy-cloud-storage-${{ github.ref }}+ cancel-in-progress: false++jobs:+ detect-changes:+ name: Detect Changed Services+ runs-on: ubuntu-latest+ outputs:+ services: ${{ steps.detect.outputs.services }}+ has_changes: ${{ steps.detect.outputs.has_changes }}+ steps:+ - uses: actions/checkout@v4+ with:+ fetch-depth: 2++ - name: Setup Rust+ uses: actions-rust-lang/setup-rust-toolchain@v1+ with:+ toolchain: stable++ - name: Detect changed services+ id: detect+ run: |+ # Make the script executable+ chmod +x .github/scripts/detect-affected-services.sh++ # Run the detection script and capture output+ OUTPUT=$(.github/scripts/detect-affected-services.sh)++ # Parse the output+ SERVICES=$(echo "$OUTPUT" | grep "^services=" | cut -d'=' -f2-)+ HAS_CHANGES=$(echo "$OUTPUT" | grep "^has_changes=" | cut -d'=' -f2-)++ # Set outputs+ echo "services=$SERVICES" >> $GITHUB_OUTPUT+ echo "has_changes=$HAS_CHANGES" >> $GITHUB_OUTPUT++ # Log for debugging+ echo "Detected services: $SERVICES"+ echo "Has changes: $HAS_CHANGES"++ deploy-services:+ name: Deploy ${{ matrix.service }}+ needs: detect-changes+ if: ${{ needs.detect-changes.outputs.has_changes == 'true' }}+ runs-on:+ [+ runs-on,+ runner=8cpu-linux-x64,+ hdd=40,+ spot=false,+ ssh=false,+ 'run-id=${{github.run_id}}',+ ]+ strategy:+ fail-fast: false+ max-parallel: 20+ matrix:+ service: ${{ fromJson(needs.detect-changes.outputs.services) }}+ steps:+ - uses: actions/checkout@v4++ - name: Get project name+ id: project-name+ uses: ./.github/actions/get-project-name+ with:+ service-name: ${{ matrix.service }}++ - name: Deploy ${{ matrix.service }}+ uses: ./.github/actions/deploy-cloud-storage-pulumi+ with:+ environment: dev+ aws-access-key: ${{ secrets.AWS_ACCESS_KEY }}+ aws-secret-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}+ pulumi-access-token: ${{ secrets.PULUMI_ACCESS_TOKEN }}+ pulumi-service-name: ${{ steps.project-name.outputs.project-name }}+ dd-app-key: ${{ secrets.DD_APP_KEY }}+ dd-api-key: ${{ secrets.DD_API_KEY }}++ deployment-summary:+ name: Deployment Summary+ runs-on: ubuntu-latest+ needs: [ detect-changes, deploy-services ]+ if: always()+ steps:+ - name: Check deployment results+ run: |+ if [[ "${{ needs.detect-changes.outputs.has_changes }}" == "false" ]]; then+ echo "ℹ️ No cloud-storage services were affected by the changes"+ elif [[ "${{ needs.deploy-services.result }}" == "failure" ]]; then+ echo "❌ One or more service deployments failed"+ exit 1+ elif [[ "${{ needs.deploy-services.result }}" == "skipped" ]]; then+ echo "⏭️ No services to deploy"+ else+ echo "✅ All affected cloud-storage services deployed successfully to dev environment"+ fidiff --git a/.github/workflows/deploy-pulumi-stack.yml b/.github/workflows/deploy-pulumi-stack.ymlnew file mode 100644index 0000000000..789d56f246--- /dev/null+++ b/.github/workflows/deploy-pulumi-stack.yml@@ -0,0 +1,47 @@+name: deploy pulumi service+on:+ workflow_dispatch:+ inputs:+ environment:+ type: choice+ required: true+ default: 'dev'+ options:+ - dev+ - prod+ description: The environment we are deploying to.+ pulumi-service-name:+ type: string+ required: true+ description: The name of the pulumi service to deploy. This will be the exact name of the folder containing your stacks.++concurrency:+ group: ${{ github.workflow }}-${{ inputs.pulumi-service-name }}-${{ inputs.environment }}+ cancel-in-progress: false++jobs:+ deploy:+ runs-on:+ [+ runs-on,+ runner=8cpu-linux-x64,+ hdd=40,+ spot=false,+ ssh=false,+ 'run-id=${{github.run_id}}',+ ]+ outputs:+ level: ${{ steps.set-level.outputs.level }}+ steps:+ - uses: actions/checkout@v4+ with:+ ref: ${{ github.ref_name }}+ - uses: ./.github/actions/deploy-cloud-storage-pulumi+ with:+ environment: ${{ inputs.environment }}+ aws-access-key: ${{ secrets.AWS_ACCESS_KEY }}+ aws-secret-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}+ pulumi-access-token: ${{ secrets.PULUMI_ACCESS_TOKEN }}+ pulumi-service-name: ${{ inputs.pulumi-service-name }} # TODO: we should have validation that this is a valid pulumi service name before we allow it to be set here+ dd-app-key: ${{ secrets.DD_APP_KEY }}+ dd-api-key: ${{ secrets.DD_API_KEY }}diff --git a/.github/workflows/deploy-service-generic.yml b/.github/workflows/deploy-service-generic.ymlnew file mode 100644index 0000000000..6e01861446--- /dev/null+++ b/.github/workflows/deploy-service-generic.yml@@ -0,0 +1,66 @@+name: Deploy Service (Generic)+on:+ workflow_dispatch:+ inputs:+ service:+ type: choice+ required: true+ description: Select the service to deploy+ options:+ - authentication-service+ - bulk-upload+ - comms-service+ - connection-gateway+ - contacts-service+ - convert-service+ - delete-document-worker+ - deleted-item-poller+ - dlp-handler+ - document-cognition-service+ - document-storage+ - document-storage-bucket-integrations+ - document-storage-service+ - document-text-extractor+ - email-service+ - email-suppression+ - experiment-service+ - insight-service+ - lambda-aggregate-frecency+ - link-sharing+ - metering-service+ - notification-service+ - notification-email-poller+ - organization-service+ - organization-retention+ - properties-service+ - search-processing-service+ - search-service+ - search-upload+ - static-file-service+ - unfurl-service+ - sha-cleanup+ - sha-ref-count-resetter+ - opensearch+ - search-event-queue+ - search-text-extractor-queue+ environment:+ type: choice+ required: true+ default: 'dev'+ options:+ - dev+ - prod+ description: The environment to deploy to++concurrency:+ group: deploy-${{ inputs.service }}-${{ inputs.environment }}+ cancel-in-progress: false++jobs:+ deploy:+ name: Deploy ${{ inputs.service }}+ uses: ./.github/workflows/reusable-deploy-service.yml+ with:+ environment: ${{ inputs.environment }}+ service-name: ${{ inputs.service }}+ secrets: inheritdiff --git a/.github/workflows/deploy-services-batch.yml b/.github/workflows/deploy-services-batch.ymlnew file mode 100644index 0000000000..56280aa992--- /dev/null+++ b/.github/workflows/deploy-services-batch.yml@@ -0,0 +1,122 @@+name: Deploy Services (Batch)+on:+ workflow_dispatch:+ inputs:+ environment:+ type: choice+ required: true+ default: 'dev'+ options:+ - dev+ - prod+ description: The environment to deploy to+ services:+ type: string+ required: true+ description: 'Comma-separated list of services to deploy (e.g., "document-cognition-service,search-service,static-file-service")'++concurrency:+ group: deploy-batch-${{ inputs.environment }}-${{ github.run_id }}+ cancel-in-progress: false++jobs:+ parse-services:+ name: Parse Services List+ runs-on: ubuntu-latest+ outputs:+ matrix: ${{ steps.parse.outputs.matrix }}+ steps:+ - uses: actions/checkout@v4+ - name: Parse and validate services+ id: parse+ run: |+ # Split comma-separated list into array+ IFS=',' read -ra SERVICES <<< "${{ inputs.services }}"++ # Trim whitespace and validate each service+ valid_services=()+ invalid_services=()++ # Get valid service names from config+ all_services=$(jq -r '.services | keys[]' .github/services-config.json)++ for service in "${SERVICES[@]}"; do+ # Trim whitespace+ service=$(echo "$service" | xargs)++ # Check if service exists in config+ if echo "$all_services" | grep -q "^${service}$"; then+ valid_services+=("$service")+ else+ invalid_services+=("$service")+ fi+ done++ # Report invalid services+ if [ ${#invalid_services[@]} -gt 0 ]; then+ echo "⚠️ Warning: The following services are invalid and will be skipped:"+ printf '%s\n' "${invalid_services[@]}"+ fi++ # Create matrix JSON+ if [ ${#valid_services[@]} -eq 0 ]; then+ echo "❌ No valid services found in the input list"+ exit 1+ else+ echo "✅ Valid services to deploy:"+ printf '%s\n' "${valid_services[@]}"+ matrix=$(printf '%s\n' "${valid_services[@]}" | jq -R . | jq -s .)+ echo "matrix=${matrix}" >> $GITHUB_OUTPUT+ fi++ deploy-services:+ name: Deploy ${{ matrix.service }}+ needs: parse-services+ runs-on:+ [+ runs-on,+ runner=8cpu-linux-x64,+ hdd=40,+ spot=false,+ ssh=false,+ 'run-id=${{github.run_id}}',+ ]+ strategy:+ fail-fast: false+ max-parallel: 20 # Limit concurrent deployments+ matrix:+ service: ${{ fromJson(needs.parse-services.outputs.matrix) }}+ steps:+ - uses: actions/checkout@v4++ - name: Get project name+ id: project-name+ uses: ./.github/actions/get-project-name+ with:+ service-name: ${{ matrix.service }}++ - name: Deploy ${{ matrix.service }}+ uses: ./.github/actions/deploy-cloud-storage-pulumi+ with:+ environment: ${{ inputs.environment }}+ aws-access-key: ${{ secrets.AWS_ACCESS_KEY }}+ aws-secret-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}+ pulumi-access-token: ${{ secrets.PULUMI_ACCESS_TOKEN }}+ pulumi-service-name: ${{ steps.project-name.outputs.project-name }}+ dd-app-key: ${{ secrets.DD_APP_KEY }}+ dd-api-key: ${{ secrets.DD_API_KEY }}++ summary:+ name: Deployment Summary+ runs-on: ubuntu-latest+ needs: deploy-services+ if: always()+ steps:+ - name: Report results+ run: |+ if [[ "${{ needs.deploy-services.result }}" == "failure" ]]; then+ echo "❌ One or more deployments failed"+ exit 1+ else+ echo "✅ All requested services deployed successfully to ${{ inputs.environment }}"+ fidiff --git a/.github/workflows/pulumi-preview-pr.yml b/.github/workflows/pulumi-preview-pr.ymlnew file mode 100644index 0000000000..17492b7bf1--- /dev/null+++ b/.github/workflows/pulumi-preview-pr.yml@@ -0,0 +1,118 @@+name: Pulumi Preview on PR+on:+ pull_request:+ branches: [ 'main' ]+ paths:+ - 'rust/cloud-storage/**'+ - '.github/workflows/pulumi-preview-pr.yml'+ - '.github/workflows/reusable-preview-service.yml'+ - '.github/actions/preview-cloud-storage-pulumi/**'+ - '.github/services-config.json'++# Cancel in-progress runs of the same workflow on the same PR+concurrency:+ group: ${{ github.workflow }}-${{ github.event.pull_request.number }}+ cancel-in-progress: true++permissions:+ contents: read+ pull-requests: write+ id-token: write++jobs:+ detect-changes:+ name: Detect Changed Services+ runs-on: ubuntu-latest+ outputs:+ services: ${{ steps.detect.outputs.services }}+ has-changes: ${{ steps.detect.outputs.has-changes }}+ steps:+ - uses: actions/checkout@v4+ - name: Get changed files+ id: changed-files+ uses: tj-actions/changed-files@v41+ with:+ files: |+ rust/cloud-storage/**+ .github/services-config.json+ - name: Detect affected services+ id: detect+ run: |+ services=()++ # Read service config+ config=$(cat .github/services-config.json)++ # Check each service for changes+ for service in $(echo "$config" | jq -r '.services | keys[]'); do+ service_changed=false++ # Get paths for this service+ source_path=$(echo "$config" | jq -r --arg s "$service" '.services[$s].source_path // ""')+ stack_path=$(echo "$config" | jq -r --arg s "$service" '.services[$s].stack_path // ""')+ additional_paths=$(echo "$config" | jq -r --arg s "$service" '.services[$s].additional_paths[]? // ""')++ # Check if any changed files match service paths+ for file in ${{ steps.changed-files.outputs.all_changed_files }}; do+ if [[ -n "$source_path" && "$file" == $source_path ]]; then+ service_changed=true+ elif [[ -n "$stack_path" && "$file" == $stack_path ]]; then+ service_changed=true+ elif [[ -n "$additional_paths" ]]; then+ for path in $additional_paths; do+ if [[ "$file" == $path ]]; then+ service_changed=true+ fi+ done+ fi+ done++ if [[ "$service_changed" == "true" ]]; then+ services+=("$service")+ fi+ done++ if [ ${#services[@]} -eq 0 ]; then+ echo "has-changes=false" >> $GITHUB_OUTPUT+ echo "services=[]" >> $GITHUB_OUTPUT+ echo "No services affected by changes"+ else+ echo "has-changes=true" >> $GITHUB_OUTPUT+ services_json=$(printf '%s\n' "${services[@]}" | jq -R . | jq -s -c .)+ echo "services=${services_json}" >> $GITHUB_OUTPUT+ echo "Services to preview: ${services[@]}"+ fi++ preview-services:+ name: Preview ${{ matrix.service }}+ needs: detect-changes+ if: ${{ needs.detect-changes.outputs.has-changes == 'true' }}+ strategy:+ fail-fast: false+ matrix:+ service: ${{ fromJson(needs.detect-changes.outputs.services) }}+ uses: ./.github/workflows/reusable-preview-service.yml+ with:+ environment: dev+ service-name: ${{ matrix.service }}+ github-token: ${{ github.token }}+ secrets: inherit++ preview-status:+ name: Preview Status+ runs-on: ubuntu-latest+ needs: [detect-changes, preview-services]+ if: always()+ steps:+ - name: Summary+ run: |+ if [[ "${{ needs.detect-changes.outputs.has-changes }}" == "false" ]]; then+ echo "ℹ️ No services were affected by the changes in this PR"+ elif [[ "${{ needs.preview-services.result }}" == "failure" ]]; then+ echo "❌ One or more Pulumi previews failed"+ exit 1+ elif [[ "${{ needs.preview-services.result }}" == "success" ]]; then+ echo "✅ All Pulumi previews completed successfully"+ elif [[ "${{ needs.preview-services.result }}" == "skipped" ]]; then+ echo "ℹ️ No services were affected by the changes in this PR"+ fidiff --git a/.github/workflows/reusable-deploy-service.yml b/.github/workflows/reusable-deploy-service.ymlnew file mode 100644index 0000000000..f278add151--- /dev/null+++ b/.github/workflows/reusable-deploy-service.yml@@ -0,0 +1,71 @@+name: Reusable Deploy Service+on:+ workflow_call:+ inputs:+ environment:+ required: true+ type: string+ description: The environment to deploy to+ service-name:+ required: true+ type: string+ description: The name of the service to deploy+ pulumi-stack-name:+ required: false+ type: string+ description: Override pulumi stack name (defaults to service-name)+ use-docker:+ required: false+ type: boolean+ default: true+ description: Whether to setup docker+ use-lfs:+ required: false+ type: boolean+ default: false+ description: Whether to checkout LFS content+ secrets:+ AWS_ACCESS_KEY:+ required: true+ AWS_SECRET_ACCESS_KEY:+ required: true+ PULUMI_ACCESS_TOKEN:+ required: true+ DD_APP_KEY:+ required: true+ DD_API_KEY:+ required: true++jobs:+ deploy:+ runs-on:+ [+ runs-on,+ runner=8cpu-linux-x64,+ hdd=40,+ spot=false,+ ssh=false,+ 'run-id=${{github.run_id}}',+ ]+ steps:+ - uses: actions/checkout@v4+ with:+ ref: ${{ github.ref_name }}++ - name: Get project name+ id: project-name+ uses: ./.github/actions/get-project-name+ with:+ service-name: ${{ inputs.service-name }}++ - uses: ./.github/actions/deploy-cloud-storage-pulumi+ with:+ environment: ${{ inputs.environment }}+ aws-access-key: ${{ secrets.AWS_ACCESS_KEY }}+ aws-secret-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}+ pulumi-access-token: ${{ secrets.PULUMI_ACCESS_TOKEN }}+ pulumi-service-name: ${{ inputs.pulumi-stack-name || steps.project-name.outputs.project-name }}+ dd-app-key: ${{ secrets.DD_APP_KEY }}+ dd-api-key: ${{ secrets.DD_API_KEY }}+ use-docker: ${{ inputs.use-docker }}+ use-lfs: ${{ inputs.use-lfs }}\ No newline at end of filediff --git a/.github/workflows/reusable-preview-service.yml b/.github/workflows/reusable-preview-service.ymlnew file mode 100644index 0000000000..b177a8e8ec--- /dev/null+++ b/.github/workflows/reusable-preview-service.yml@@ -0,0 +1,66 @@+name: Reusable Preview Service+on:+ workflow_call:+ inputs:+ environment:+ required: true+ type: string+ description: The environment to preview+ service-name:+ required: true+ type: string+ description: The name of the service to preview+ pulumi-stack-name:+ required: false+ type: string+ description: Override pulumi stack name (defaults to service-name)+ use-docker:+ required: false+ type: boolean+ default: true+ description: Whether to setup docker+ use-lfs:+ required: false+ type: boolean+ default: false+ description: Whether to checkout LFS content+ github-token:+ required: false+ type: string+ description: GitHub token for PR comments+ secrets:+ AWS_ACCESS_KEY:+ required: true+ AWS_SECRET_ACCESS_KEY:+ required: true+ PULUMI_ACCESS_TOKEN:+ required: true+ DD_APP_KEY:+ required: true+ DD_API_KEY:+ required: true++jobs:+ preview:+ runs-on: ubuntu-latest+ steps:+ - uses: actions/checkout@v4++ - name: Get project name+ id: project-name+ uses: ./.github/actions/get-project-name+ with:+ service-name: ${{ inputs.service-name }}++ - uses: ./.github/actions/preview-cloud-storage-pulumi+ with:+ environment: ${{ inputs.environment }}+ aws-access-key: ${{ secrets.AWS_ACCESS_KEY }}+ aws-secret-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}+ pulumi-access-token: ${{ secrets.PULUMI_ACCESS_TOKEN }}+ pulumi-service-name: ${{ inputs.pulumi-stack-name || steps.project-name.outputs.project-name }}+ dd-app-key: ${{ secrets.DD_APP_KEY }}+ dd-api-key: ${{ secrets.DD_API_KEY }}+ use-docker: ${{ inputs.use-docker }}+ use-lfs: ${{ inputs.use-lfs }}+ github-token: ${{ inputs.github-token }}diff --git a/infra/biome.jsonc b/infra/biome.jsoncnew file mode 100644index 0000000000..5bbd1439a9--- /dev/null+++ b/infra/biome.jsonc@@ -0,0 +1,254 @@+{+ "$schema": "https://biomejs.dev/schemas/2.2.6/schema.json",+ "vcs": {+ "clientKind": "git",+ "enabled": true,+ "useIgnoreFile": true,+ "defaultBranch": "dev"+ },+ "files": {+ "includes": [+ "**/*.ts",+ "**/*.tsx",+ "**/*.js",+ "**/*.jsx",+ "**/openapi.json"+ ]+ },+ "formatter": {+ "enabled": true,+ "formatWithErrors": false,+ "indentStyle": "space",+ "indentWidth": 2,+ "lineEnding": "lf",+ "lineWidth": 80,+ "attributePosition": "auto",+ "includes": [+ "**",+ "!**/.babelrc",+ "!**/.github",+ "!**/.next/",+ "!**/build/",+ "!**/dist/",+ "!**/lib/",+ "!**/node_modules/",+ "!**/package.json",+ "!**/tmp/",+ "!**/.yarn/",+ "!**/*.md"+ ]+ },+ "assist": { "actions": { "source": { "organizeImports": "on" } } },+ "linter": {+ "enabled": true,+ "rules": {+ "recommended": false,+ "a11y": {},+ "complexity": {+ "noUselessConstructor": "warn",+ "noUselessLabel": "warn",+ "noUselessLoneBlockStatements": "warn",+ "noUselessRename": "warn",+ "noAdjacentSpacesInRegex": "warn",+ "noCommaOperator": "warn"+ },+ "correctness": {+ "noConstAssign": "warn",+ "noEmptyCharacterClassInRegex": "warn",+ "noEmptyPattern": "warn",+ "noGlobalObjectCalls": "warn",+ "noInvalidUseBeforeDeclaration": "warn",+ "noSelfAssign": "warn",+ "noUndeclaredVariables": "error",+ "noUnreachable": "warn",+ "noUnreachableSuper": "warn",+ "noUnusedLabels": "warn",+ "noUnusedVariables": "warn",+ "useExhaustiveDependencies": "error",+ "useHookAtTopLevel": "error",+ "useIsNan": "warn",+ "useJsxKeyInIterable": "error",+ "useYield": "warn",+ "noInvalidBuiltinInstantiation": "warn",+ "useValidTypeof": "warn"+ },+ "security": {+ "noDangerouslySetInnerHtmlWithChildren": "warn",+ "noGlobalEval": "warn",+ "noBlankTarget": "warn"+ },+ "style": {+ "useImportType": "warn",+ "noRestrictedGlobals": {+ "level": "error",+ "options": {+ "deniedGlobals": {+ "addEventListener": "TODO: Add a custom message here.",+ "blur": "TODO: Add a custom message here.",+ "closed": "TODO: Add a custom message here.",+ "confirm": "TODO: Add a custom message here.",+ "defaultStatus": "TODO: Add a custom message here.",+ "defaultstatus": "TODO: Add a custom message here.",+ "event": "TODO: Add a custom message here.",+ "external": "TODO: Add a custom message here.",+ "find": "TODO: Add a custom message here.",+ "focus": "TODO: Add a custom message here.",+ "frameElement": "TODO: Add a custom message here.",+ "frames": "TODO: Add a custom message here.",+ "history": "TODO: Add a custom message here.",+ "innerHeight": "TODO: Add a custom message here.",+ "innerWidth": "TODO: Add a custom message here.",+ "length": "TODO: Add a custom message here.",+ "location": "TODO: Add a custom message here.",+ "locationbar": "TODO: Add a custom message here.",+ "menubar": "TODO: Add a custom message here.",+ "moveBy": "TODO: Add a custom message here.",+ "moveTo": "TODO: Add a custom message here.",+ "name": "TODO: Add a custom message here.",+ "onblur": "TODO: Add a custom message here.",+ "onerror": "TODO: Add a custom message here.",+ "onfocus": "TODO: Add a custom message here.",+ "onload": "TODO: Add a custom message here.",+ "onresize": "TODO: Add a custom message here.",+ "onunload": "TODO: Add a custom message here.",+ "open": "TODO: Add a custom message here.",+ "opener": "TODO: Add a custom message here.",+ "opera": "TODO: Add a custom message here.",+ "outerHeight": "TODO: Add a custom message here.",+ "outerWidth": "TODO: Add a custom message here.",+ "pageXOffset": "TODO: Add a custom message here.",+ "pageYOffset": "TODO: Add a custom message here.",+ "parent": "TODO: Add a custom message here.",+ "print": "TODO: Add a custom message here.",+ "removeEventListener": "TODO: Add a custom message here.",+ "resizeBy": "TODO: Add a custom message here.",+ "resizeTo": "TODO: Add a custom message here.",+ "screen": "TODO: Add a custom message here.",+ "screenLeft": "TODO: Add a custom message here.",+ "screenTop": "TODO: Add a custom message here.",+ "screenX": "TODO: Add a custom message here.",+ "screenY": "TODO: Add a custom message here.",+ "scroll": "TODO: Add a custom message here.",+ "scrollbars": "TODO: Add a custom message here.",+ "scrollBy": "TODO: Add a custom message here.",+ "scrollTo": "TODO: Add a custom message here.",+ "scrollX": "TODO: Add a custom message here.",+ "scrollY": "TODO: Add a custom message here.",+ "status": "TODO: Add a custom message here.",+ "statusbar": "TODO: Add a custom message here.",+ "stop": "TODO: Add a custom message here.",+ "toolbar": "TODO: Add a custom message here.",+ "top": "TODO: Add a custom message here."+ }+ }+ },+ "useBlockStatements": "off",+ "useArrayLiterals": "warn"+ },+ "suspicious": {+ "noAssignInExpressions": "warn",+ "noCatchAssign": "warn",+ "noCommentText": "warn",+ "noConfusingLabels": "warn",+ "noControlCharactersInRegex": "warn",+ "noDoubleEquals": "warn",+ "noDuplicateCase": "warn",+ "noDuplicateClassMembers": "warn",+ "noDuplicateJsxProps": "warn",+ "noDuplicateObjectKeys": "warn",+ "noDuplicateParameters": "warn",+ "noFallthroughSwitchClause": "warn",+ "noFunctionAssign": "warn",+ "noGlobalAssign": "warn",+ "noLabelVar": "warn",+ "noRedeclare": "warn",+ "noSelfCompare": "warn",+ "noShadowRestrictedNames": "warn",+ "noUnsafeNegation": "warn",+ "useGetterReturn": "warn",+ "noWith": "warn"+ }+ },+ "includes": [+ "**",+ "!**/*.md",+ "!**/.github/",+ "!**/.next/",+ "!**/build/",+ "!**/dist/",+ "!**/lib/",+ "!**/node_modules/",+ "!**/tmp/",+ "!**/next.config.js",+ "!**/.yarn/"+ ]+ },+ "javascript": {+ "formatter": {+ "jsxQuoteStyle": "double",+ "quoteProperties": "asNeeded",+ "trailingCommas": "es5",+ "semicolons": "always",+ "arrowParentheses": "always",+ "bracketSpacing": true,+ "bracketSameLine": false,+ "quoteStyle": "single",+ "attributePosition": "auto"+ },+ "globals": [+ "JSX",+ "React",+ "describe",+ "test",+ "it",+ "expect",+ "beforeEach",+ "beforeAll",+ "afterEach",+ "jest"+ ]+ },+ "overrides": [+ {+ "includes": ["**/*.ts", "**/*.tsx"],+ "linter": {+ "rules": {+ "complexity": {+ "noUselessConstructor": "warn"+ },+ "correctness": {+ "noInvalidUseBeforeDeclaration": "warn",+ "noUndeclaredVariables": "warn",+ "noUnusedVariables": "error",+ "useJsxKeyInIterable": "warn",+ "useExhaustiveDependencies": "warn"+ },+ "style": {+ "noNamespace": "off"+ },+ "suspicious": {+ "noDuplicateClassMembers": "warn",+ "noRedeclare": "warn"+ }+ }+ }+ },+ {+ "includes": [],+ "linter": {+ "rules": {+ "correctness": {+ "useHookAtTopLevel": "off",+ "useJsxKeyInIterable": "off"+ }+ }+ }+ },+ {+ "includes": [],+ "javascript": {+ "globals": ["Bun"]+ }+ }+ ]+}