Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 17 additions & 5 deletions applications/chatops/slack-bot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ verify-aws:

# Valid components
# Quadrant-based workers (new architecture)
QUADRANT_WORKERS := sr lw
VALID_COMPONENTS := router sr lw
QUADRANT_WORKERS := sr lw lr sw
VALID_COMPONENTS := router sr lw lr sw

build: clean-dist
@echo "$(BLUE)Building all Lambda functions...$(NC)"
Expand All @@ -136,7 +136,7 @@ upload-%: build-% verify-aws
echo "$$UPLOAD_OUTPUT"; \
echo "$$UPLOAD_OUTPUT" | grep -o '##VERSION_ID=.*##' | sed 's/##VERSION_ID=//;s/##//' > .s3-version-id-$*.tmp || true

upload-all: upload-router upload-sr upload-lw
upload-all: upload-router upload-sr upload-lw upload-lr upload-sw
@echo "$(GREEN)✓ All quadrant workers uploaded$(NC)"

upload-all-legacy: upload-router upload-deploy upload-status upload-build
Expand All @@ -153,13 +153,25 @@ deploy-sr: build-sr
deploy-lw: build-lw
@VERSION=$(VERSION) SANDBOX_ROOT=$(SANDBOX_ROOT) $(SCRIPTS_DIR)/deploy-component.sh lw --local

deploy-lr: build-lr
@VERSION=$(VERSION) SANDBOX_ROOT=$(SANDBOX_ROOT) $(SCRIPTS_DIR)/deploy-component.sh lr --local

deploy-sw: build-sw
@VERSION=$(VERSION) SANDBOX_ROOT=$(SANDBOX_ROOT) $(SCRIPTS_DIR)/deploy-component.sh sw --local

# Explicit -local targets for quadrant workers
deploy-sr-local: build-sr
@VERSION=$(VERSION) SANDBOX_ROOT=$(SANDBOX_ROOT) $(SCRIPTS_DIR)/deploy-component.sh sr --local

deploy-lw-local: build-lw
@VERSION=$(VERSION) SANDBOX_ROOT=$(SANDBOX_ROOT) $(SCRIPTS_DIR)/deploy-component.sh lw --local

deploy-lr-local: build-lr
@VERSION=$(VERSION) SANDBOX_ROOT=$(SANDBOX_ROOT) $(SCRIPTS_DIR)/deploy-component.sh lr --local

deploy-sw-local: build-sw
@VERSION=$(VERSION) SANDBOX_ROOT=$(SANDBOX_ROOT) $(SCRIPTS_DIR)/deploy-component.sh sw --local

deploy-router-local: build-router
@VERSION=$(VERSION) SANDBOX_ROOT=$(SANDBOX_ROOT) $(SCRIPTS_DIR)/deploy-component.sh router --local

Expand All @@ -171,8 +183,8 @@ deploy-build: build-build
deploy-%: upload-%
@VERSION=$(VERSION) SANDBOX_ROOT=$(SANDBOX_ROOT) $(SCRIPTS_DIR)/deploy-component.sh $*

# Deploy all quadrant workers from local (router, sr, lw only)
deploy-all-local: deploy-router-local deploy-sr-local deploy-lw-local
# Deploy all quadrant workers from local (router, sr, lw, lr, sw)
deploy-all-local: deploy-router-local deploy-sr-local deploy-lw-local deploy-lr-local deploy-sw-local
@echo "$(GREEN)✓ All quadrant workers deployed from local$(NC)"

# Deploy from S3 with smart version handling
Expand Down
11 changes: 11 additions & 0 deletions applications/chatops/slack-bot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,17 @@ cd infrastructure
sam local invoke CommandHandler -e test-events/slack-command.json
```

## Slack Commands

### `/check-status`

- **Signature:** `/check-status env=<env> app=<app> target=<resource-name>` (order of arguments does not matter).
- **Defaults:** `env=plt`, `app=slack-bot` when arguments are omitted.
- **Purpose:** Returns a table of tagged resources (ECS services, Lambda functions, DynamoDB tables) filtered by the provided `Environment`/`Application` tag pair, optionally narrowed to a `target` substring.
- **Output:** Slack response contains a markdown table with resource name, quadrant (ECS/Lambda/DynamoDB), status (up/down plus running vs desired counts or state), and the latest CloudWatch metric (CPUUtilization, Errors, or ConsumedReadCapacityUnits) pulled from the last five minutes.

The command relies on Resource Groups Tagging API lookups (requires `tag:GetResources`) together with the existing read-only CloudWatch/IAM permissions, so it is safe to run frequently for DevSecOps visibility.

## Security

### Secret Management
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class SlackBotStack extends cdk.Stack {

/**
* QUADRANT 1: Short + Read
* Commands: /status, /health, /metrics, /echo
* Commands: /check-status, /health, /metrics, /echo
* Purpose: Fast queries for system state
* Permissions: Read-only CloudWatch, Lambda metadata, ECS describe
* Timeout: ≤30s
Expand All @@ -93,7 +93,10 @@ export class SlackBotStack extends cdk.Stack {

// ECS service status (read-only)
'ecs:DescribeServices',
'ecs:DescribeClusters'
'ecs:DescribeClusters',

// Tagging API for resource enumeration
'tag:GetResources'
],
resources: ['*'],
conditions: {
Expand Down
Loading