Skip to content

Commit d76c640

Browse files
committed
feat(Makefile): add makefile targets for idp-cli publish, deploy, and delete-stack
1 parent 1b16200 commit d76c640

11 files changed

Lines changed: 134 additions & 9 deletions

File tree

Makefile

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ else
2121
PIP := $(CURDIR)/$(VENV_DIR)/bin/pip
2222
endif
2323

24+
# idp-cli invocation — uses `python -m idp_cli.cli` so it works whether or not
25+
# the virtualenv is activated (picks up $(PYTHON) which prefers .venv).
26+
IDP_CLI := $(PYTHON) -m idp_cli.cli
27+
2428
##@ General
2529
.PHONY: help
2630
help: ## Show this help message
@@ -393,3 +397,74 @@ dsr-scan: ## Run DSR security scan
393397
dsr-fix: ## Run DSR interactive fix
394398
@echo "Running DSR interactive fix..."
395399
$(PYTHON) scripts/dsr/fix.py
400+
401+
##@ Deploy
402+
# Thin wrappers around `idp-cli publish` / `deploy` / `delete` for the common
403+
# 80% case. Uncommon flags can still be passed via EXTRA_ARGS="--foo --bar".
404+
# See 'docs/idp-cli.md' (or 'idp-cli <cmd> --help') for the full option list.
405+
406+
.PHONY: publish deploy delete-stack
407+
408+
# Usage examples:
409+
# make publish REGION=us-east-1
410+
# make publish REGION=us-east-1 BUCKET_BASENAME=my-idp-artifacts PREFIX=v1
411+
# make publish REGION=us-gov-west-1 HEADLESS=1
412+
# make publish REGION=us-east-1 PUBLIC=1 EXTRA_ARGS="--clean-build --verbose"
413+
publish: ## Build & publish IDP artifacts to S3 (Usage: make publish REGION=... [BUCKET_BASENAME=...] [PREFIX=...] [HEADLESS=1] [PUBLIC=1] [EXTRA_ARGS=...])
414+
ifndef REGION
415+
$(error REGION is not set. Usage: make publish REGION=us-east-1 [BUCKET_BASENAME=...] [PREFIX=...] [HEADLESS=1] [PUBLIC=1] [EXTRA_ARGS=...])
416+
endif
417+
@echo -e "$(CYAN)Running idp-cli publish (region=$(REGION))...$(NC)"
418+
$(IDP_CLI) publish \
419+
--source-dir . \
420+
--region $(REGION) \
421+
$(if $(BUCKET_BASENAME),--bucket-basename $(BUCKET_BASENAME)) \
422+
$(if $(PREFIX),--prefix $(PREFIX)) \
423+
$(if $(HEADLESS),--headless) \
424+
$(if $(PUBLIC),--public) \
425+
$(EXTRA_ARGS)
426+
427+
# Usage examples:
428+
# make deploy STACK_NAME=my-idp ADMIN_EMAIL=me@example.com # create new stack
429+
# make deploy STACK_NAME=my-idp # update existing stack
430+
# make deploy STACK_NAME=my-idp-dev ADMIN_EMAIL=me@example.com FROM_CODE=1 # build & deploy from local source
431+
# make deploy STACK_NAME=my-idp ADMIN_EMAIL=me@example.com HEADLESS=1 # headless (no UI)
432+
# make deploy STACK_NAME=my-idp CUSTOM_CONFIG=./my-config.yaml # update config on existing stack
433+
# make deploy STACK_NAME=my-idp NO_WAIT=1 # fire-and-forget (default is --wait)
434+
# make deploy STACK_NAME=my-idp EXTRA_ARGS="--max-concurrent 200 --log-level DEBUG"
435+
deploy: ## Deploy/update IDP CloudFormation stack (Usage: make deploy STACK_NAME=... [ADMIN_EMAIL=...] [REGION=...] [FROM_CODE=1] [HEADLESS=1] [CUSTOM_CONFIG=...] [TEMPLATE_URL=...] [TEMPLATE_FILE=...] [NO_WAIT=1] [EXTRA_ARGS=...])
436+
ifndef STACK_NAME
437+
$(error STACK_NAME is not set. Usage: make deploy STACK_NAME=my-stack [ADMIN_EMAIL=...] [REGION=...] [FROM_CODE=1] [HEADLESS=1] [CUSTOM_CONFIG=...] [NO_WAIT=1] [EXTRA_ARGS=...])
438+
endif
439+
@echo -e "$(CYAN)Running idp-cli deploy (stack=$(STACK_NAME))...$(NC)"
440+
$(IDP_CLI) deploy \
441+
--stack-name $(STACK_NAME) \
442+
$(if $(ADMIN_EMAIL),--admin-email $(ADMIN_EMAIL)) \
443+
$(if $(REGION),--region $(REGION)) \
444+
$(if $(FROM_CODE),--from-code .) \
445+
$(if $(HEADLESS),--headless) \
446+
$(if $(CUSTOM_CONFIG),--custom-config $(CUSTOM_CONFIG)) \
447+
$(if $(TEMPLATE_URL),--template-url $(TEMPLATE_URL)) \
448+
$(if $(TEMPLATE_FILE),--template-file $(TEMPLATE_FILE)) \
449+
$(if $(NO_WAIT),,--wait) \
450+
$(EXTRA_ARGS)
451+
452+
# Usage examples:
453+
# make delete-stack STACK_NAME=test-stack # interactive
454+
# make delete-stack STACK_NAME=test-stack FORCE=1 # skip confirmation
455+
# make delete-stack STACK_NAME=test-stack FORCE=1 EMPTY_BUCKETS=1 # empty buckets first
456+
# make delete-stack STACK_NAME=test-stack FORCE=1 FORCE_DELETE_ALL=1 # comprehensive cleanup
457+
delete-stack: ## Delete an IDP CloudFormation stack (Usage: make delete-stack STACK_NAME=... [FORCE=1] [EMPTY_BUCKETS=1] [FORCE_DELETE_ALL=1] [REGION=...] [NO_WAIT=1] [EXTRA_ARGS=...])
458+
ifndef STACK_NAME
459+
$(error STACK_NAME is not set. Usage: make delete-stack STACK_NAME=my-stack [FORCE=1] [EMPTY_BUCKETS=1] [FORCE_DELETE_ALL=1])
460+
endif
461+
@echo -e "$(YELLOW)Running idp-cli delete (stack=$(STACK_NAME))...$(NC)"
462+
$(IDP_CLI) delete \
463+
--stack-name $(STACK_NAME) \
464+
$(if $(FORCE),--force) \
465+
$(if $(EMPTY_BUCKETS),--empty-buckets) \
466+
$(if $(FORCE_DELETE_ALL),--force-delete-all) \
467+
$(if $(REGION),--region $(REGION)) \
468+
$(if $(NO_WAIT),,--wait) \
469+
$(EXTRA_ARGS)
470+

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.5.8.rc2
1+
0.5.8.rc3

docs/idp-cli.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,56 @@ cd lib/idp_cli_pkg
9191
pip install -e ".[test]"
9292
```
9393

94+
## Makefile Shortcuts
95+
96+
The root `Makefile` provides convenience wrappers for the most common `idp-cli` commands. These use the project's `.venv` Python automatically — no need to `source .venv/bin/activate` first.
97+
98+
```bash
99+
# Publish artifacts to S3
100+
make publish REGION=us-east-1
101+
make publish REGION=us-east-1 BUCKET_BASENAME=my-artifacts PREFIX=v1
102+
make publish REGION=us-gov-west-1 HEADLESS=1
103+
104+
# Deploy / update a stack (--wait is the default)
105+
make deploy STACK_NAME=my-idp ADMIN_EMAIL=me@example.com
106+
make deploy STACK_NAME=my-idp-dev ADMIN_EMAIL=me@example.com FROM_CODE=1
107+
make deploy STACK_NAME=my-idp CUSTOM_CONFIG=./my-config.yaml
108+
109+
# Delete a stack
110+
make delete-stack STACK_NAME=test-stack FORCE=1 FORCE_DELETE_ALL=1
111+
```
112+
113+
**First-class Make variables** (common flags):
114+
115+
| Variable | Target(s) | Maps to CLI flag |
116+
|---|---|---|
117+
| `REGION` | publish, deploy, delete-stack | `--region` |
118+
| `STACK_NAME` | deploy, delete-stack | `--stack-name` |
119+
| `ADMIN_EMAIL` | deploy | `--admin-email` |
120+
| `FROM_CODE=1` | deploy | `--from-code .` |
121+
| `HEADLESS=1` | publish, deploy | `--headless` |
122+
| `PUBLIC=1` | publish | `--public` |
123+
| `BUCKET_BASENAME` | publish | `--bucket-basename` |
124+
| `PREFIX` | publish | `--prefix` |
125+
| `CUSTOM_CONFIG` | deploy | `--custom-config` |
126+
| `TEMPLATE_URL` | deploy | `--template-url` |
127+
| `TEMPLATE_FILE` | deploy | `--template-file` |
128+
| `NO_WAIT=1` | deploy, delete-stack | omits `--wait` |
129+
| `FORCE=1` | delete-stack | `--force` |
130+
| `EMPTY_BUCKETS=1` | delete-stack | `--empty-buckets` |
131+
| `FORCE_DELETE_ALL=1` | delete-stack | `--force-delete-all` |
132+
133+
**Uncommon flags** — pass anything else via `EXTRA_ARGS`:
134+
135+
```bash
136+
make deploy STACK_NAME=my-idp EXTRA_ARGS="--role-arn arn:aws:iam::123:role/Foo --no-rollback"
137+
make publish REGION=us-east-1 EXTRA_ARGS="--clean-build --verbose"
138+
```
139+
140+
Run `make help` to see all available targets, or `idp-cli <command> --help` for the full option reference.
141+
142+
---
143+
94144
## Quick Start
95145

96146
### Global Options

lib/idp_cli_pkg/idp_cli/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def _display_deployment_failure(client, stack_name: str, result):
237237

238238

239239
@click.group()
240-
@click.version_option(version="0.5.7")
240+
@click.version_option(version="0.5.8.rc3")
241241
def cli():
242242
"""
243243
IDP CLI - Batch document processing for IDP Accelerator

lib/idp_cli_pkg/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
77

88
[project]
99
name = "idp-cli"
10-
version = "0.5.7"
10+
version = "0.5.8.rc3"
1111
description = "Command-line interface for IDP Accelerator batch document processing"
1212
authors = [{name = "AWS"}]
1313
license = {text = "MIT-0"}

lib/idp_common_pkg/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ exclude = [
2121

2222
[project]
2323
name = "idp_common"
24-
version = "0.5.7"
24+
version = "0.5.8.rc3"
2525
description = "Common utilities for GenAI IDP Accelerator patterns"
2626
authors = [{ name = "AWS", email = "noreply@amazon.com" }]
2727
requires-python = ">=3.12,<3.14"

lib/idp_common_pkg/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117

118118
setup(
119119
name="idp_common",
120-
version="0.5.7",
120+
version="0.5.8.rc3",
121121
packages=find_packages(
122122
exclude=[
123123
"build",

lib/idp_mcp_connector_pkg/idp_mcp_connector/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
IDP Accelerator's remote MCP Server on Amazon Bedrock AgentCore Gateway.
99
"""
1010

11-
__version__ = "0.5.7"
11+
__version__ = "0.5.8.rc3"
1212
__all__ = ["CognitoAuth", "IDPMCPConnector", "run_connector"]
1313

1414
from .auth import CognitoAuth

lib/idp_mcp_connector_pkg/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
77

88
[project]
99
name = "idp_mcp_connector"
10-
version = "0.5.7"
10+
version = "0.5.8.rc3"
1111
description = "Local MCP connector that bridges IDE tools (Cline, Kiro) to the IDP Accelerator MCP Server on AWS Bedrock AgentCore Gateway"
1212
readme = "README.md"
1313
requires-python = ">=3.11"

lib/idp_sdk/idp_sdk/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
TemplateTransformResult,
110110
)
111111

112-
__version__ = "0.5.7"
112+
__version__ = "0.5.8.rc3"
113113

114114
__all__ = [
115115
# Client

0 commit comments

Comments
 (0)