apx-aws-lambda 1.3.0__tar.gz → 1.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/PKG-INFO +2 -2
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/README.md +1 -1
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda/lambda_.py +20 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda.egg-info/PKG-INFO +2 -2
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/pyproject.toml +1 -1
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/tests/test_targets.py +55 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/LICENSE +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda/__init__.py +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda/abc.py +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda/checks.py +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda/cli.py +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda/connect/template.yaml +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda/credentials.py +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda/health.py +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda/overlays/cloud/aws/lambda/cookiecutter.json +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda/overlays/cloud/aws/lambda/hooks/post_gen_project.py +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/.github/workflows/deploy.yml +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/DEPLOY.md +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/Makefile +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/requirements/policy.json +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/requirements/trust.json +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/samconfig.toml +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda/overlays/cloud/aws/lambda/{{cookiecutter.project_slug}}/template.yaml +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda/overlays/index.json +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda/plugin.py +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda/sam.py +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda/shell.py +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda/spec.py +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda/stack.py +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda/tools.py +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda.egg-info/SOURCES.txt +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda.egg-info/dependency_links.txt +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda.egg-info/entry_points.txt +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda.egg-info/requires.txt +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/apx_aws_lambda.egg-info/top_level.txt +0 -0
- {apx_aws_lambda-1.3.0 → apx_aws_lambda-1.3.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: apx-aws-lambda
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.1
|
|
4
4
|
Summary: AWS Lambda for Action Platform: the aws/lambda deploy target (SAM) with its overlay, and tools to read stacks and functions.
|
|
5
5
|
Author-email: Action Platform <cloud@actionplatform.io>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -46,7 +46,7 @@ action-platform diagnose
|
|
|
46
46
|
| | |
|
|
47
47
|
|---|---|
|
|
48
48
|
| Overlay | `template.yaml`, `samconfig.toml`, a one-line `Makefile` (`ap-build package`), `requirements/` (IAM examples), `.github/workflows/deploy.yml` (optional). One template for every language: the Lambda Web Adapter layer runs the project as an HTTP server on `$PORT` — `run.sh` from `ap-build` (Python `python3.12`, Node `nodejs22.x`, Java/Kotlin `java21`, Ruby `ruby3.3`) or the static `bootstrap` on `provided.al2023` (Go). Every `web/*` template of the official repository deploys; the health route is `/health` (API Gateway keeps `/ping` for itself on `execute-api`). Template parameters the target fills: `Stage` (the scope's name), and for a connected account `PermissionsBoundaryArn` and `RolePath` |
|
|
49
|
-
| Readiness | before a deploy, without building or changing anything: the tooling is there, the overlay is applied, the stack name resolves, the credentials work, the stack is not mid-operation or failed (a failed first creation — `ROLLBACK_COMPLETE` or `ROLLBACK_FAILED` — is a warning: the deploy deletes it), the overlay takes a connected account's boundary and role path, the deploy role may do what the template needs (simulated with `iam:SimulatePrincipalPolicy` against the stack, the function, its log group, the execution role and every public layer the template references — the Lambda Web Adapter's, for one) and `sam validate --lint` passes. The platform runs it after every release for each of the app's scopes and refuses a blocked deploy unless forced; `action-platform readiness` runs it on a machine |
|
|
49
|
+
| Readiness | before a deploy, without building or changing anything: the tooling is there, the overlay is applied, the stack name resolves, the credentials work, the stack is not mid-operation or failed (a failed first creation — `ROLLBACK_COMPLETE` or `ROLLBACK_FAILED` — is a warning: the deploy deletes it), the overlay takes a connected account's boundary and role path, the deploy role may do what the template needs (simulated with `iam:SimulatePrincipalPolicy` against the stack, the function, its log group, the execution role and every public layer the template references — the Lambda Web Adapter's, for one) and `sam validate --lint` passes. The platform runs it after every release for each of the app's scopes and refuses a blocked deploy unless forced; `action-platform readiness` runs it on a machine. A stack its own pipeline deploys (an observed target) skips the credentials and permissions checks, since that pipeline deploys with another identity; its state is read only when an identity can read it |
|
|
50
50
|
| Deploy | `sam build` + `sam deploy --config-env <stage>` (scope `prod` → `prod`, any other → `default`). A stack left by a failed first creation (`ROLLBACK_COMPLETE`, `ROLLBACK_FAILED`) is deleted first; when that delete fails on a resource that was never created, the stack is deleted again with it retained. On a connected account, an overlay without `PermissionsBoundaryArn` and `RolePath` stops the deploy before the build. Every line `sam` prints reaches the platform's run log as it appears — the deploy form, the run dialog, `action-platform logs -f` |
|
|
51
51
|
| Rollback | CloudFormation `rollback-stack` — previous stack state |
|
|
52
52
|
| Diagnose | stack status and the HTTP API url |
|
|
@@ -28,7 +28,7 @@ action-platform diagnose
|
|
|
28
28
|
| | |
|
|
29
29
|
|---|---|
|
|
30
30
|
| Overlay | `template.yaml`, `samconfig.toml`, a one-line `Makefile` (`ap-build package`), `requirements/` (IAM examples), `.github/workflows/deploy.yml` (optional). One template for every language: the Lambda Web Adapter layer runs the project as an HTTP server on `$PORT` — `run.sh` from `ap-build` (Python `python3.12`, Node `nodejs22.x`, Java/Kotlin `java21`, Ruby `ruby3.3`) or the static `bootstrap` on `provided.al2023` (Go). Every `web/*` template of the official repository deploys; the health route is `/health` (API Gateway keeps `/ping` for itself on `execute-api`). Template parameters the target fills: `Stage` (the scope's name), and for a connected account `PermissionsBoundaryArn` and `RolePath` |
|
|
31
|
-
| Readiness | before a deploy, without building or changing anything: the tooling is there, the overlay is applied, the stack name resolves, the credentials work, the stack is not mid-operation or failed (a failed first creation — `ROLLBACK_COMPLETE` or `ROLLBACK_FAILED` — is a warning: the deploy deletes it), the overlay takes a connected account's boundary and role path, the deploy role may do what the template needs (simulated with `iam:SimulatePrincipalPolicy` against the stack, the function, its log group, the execution role and every public layer the template references — the Lambda Web Adapter's, for one) and `sam validate --lint` passes. The platform runs it after every release for each of the app's scopes and refuses a blocked deploy unless forced; `action-platform readiness` runs it on a machine |
|
|
31
|
+
| Readiness | before a deploy, without building or changing anything: the tooling is there, the overlay is applied, the stack name resolves, the credentials work, the stack is not mid-operation or failed (a failed first creation — `ROLLBACK_COMPLETE` or `ROLLBACK_FAILED` — is a warning: the deploy deletes it), the overlay takes a connected account's boundary and role path, the deploy role may do what the template needs (simulated with `iam:SimulatePrincipalPolicy` against the stack, the function, its log group, the execution role and every public layer the template references — the Lambda Web Adapter's, for one) and `sam validate --lint` passes. The platform runs it after every release for each of the app's scopes and refuses a blocked deploy unless forced; `action-platform readiness` runs it on a machine. A stack its own pipeline deploys (an observed target) skips the credentials and permissions checks, since that pipeline deploys with another identity; its state is read only when an identity can read it |
|
|
32
32
|
| Deploy | `sam build` + `sam deploy --config-env <stage>` (scope `prod` → `prod`, any other → `default`). A stack left by a failed first creation (`ROLLBACK_COMPLETE`, `ROLLBACK_FAILED`) is deleted first; when that delete fails on a resource that was never created, the stack is deleted again with it retained. On a connected account, an overlay without `PermissionsBoundaryArn` and `RolePath` stops the deploy before the build. Every line `sam` prints reaches the platform's run log as it appears — the deploy form, the run dialog, `action-platform logs -f` |
|
|
33
33
|
| Rollback | CloudFormation `rollback-stack` — previous stack state |
|
|
34
34
|
| Diagnose | stack status and the HTTP API url |
|
|
@@ -115,6 +115,9 @@ class LambdaTarget(DeployTarget):
|
|
|
115
115
|
if not checks[-1].ok:
|
|
116
116
|
return checks
|
|
117
117
|
|
|
118
|
+
if ctx.observed:
|
|
119
|
+
return checks + self._observed(ctx, spec)
|
|
120
|
+
|
|
118
121
|
try:
|
|
119
122
|
access = self.credentials(ctx, spec).access(spec)
|
|
120
123
|
except DeployError as e:
|
|
@@ -150,6 +153,23 @@ class LambdaTarget(DeployTarget):
|
|
|
150
153
|
|
|
151
154
|
return checks
|
|
152
155
|
|
|
156
|
+
def _observed(self, ctx: Context, spec: Spec) -> list[Check]:
|
|
157
|
+
"""A stack its own pipeline deploys, with its own identity: the platform's credentials and permissions say nothing about that deploy, so only the stack's state is read, and only when an identity can read it."""
|
|
158
|
+
try:
|
|
159
|
+
access = self.credentials(ctx, spec).access(spec)
|
|
160
|
+
except DeployError:
|
|
161
|
+
access = None
|
|
162
|
+
|
|
163
|
+
if access is None or not CredentialsCheck(access).run(spec).ok:
|
|
164
|
+
return [TemplateValidCheck(self.parts(spec, Access(None)).sam).run(spec)]
|
|
165
|
+
|
|
166
|
+
parts = self.parts(spec, access)
|
|
167
|
+
|
|
168
|
+
return [
|
|
169
|
+
StackStateCheck(parts.stack).run(spec),
|
|
170
|
+
TemplateValidCheck(parts.sam).run(spec),
|
|
171
|
+
]
|
|
172
|
+
|
|
153
173
|
def deploy(self, ctx: Context) -> DeployResult:
|
|
154
174
|
shell.require("sam", HINT)
|
|
155
175
|
spec = self.spec(ctx)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: apx-aws-lambda
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.1
|
|
4
4
|
Summary: AWS Lambda for Action Platform: the aws/lambda deploy target (SAM) with its overlay, and tools to read stacks and functions.
|
|
5
5
|
Author-email: Action Platform <cloud@actionplatform.io>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -46,7 +46,7 @@ action-platform diagnose
|
|
|
46
46
|
| | |
|
|
47
47
|
|---|---|
|
|
48
48
|
| Overlay | `template.yaml`, `samconfig.toml`, a one-line `Makefile` (`ap-build package`), `requirements/` (IAM examples), `.github/workflows/deploy.yml` (optional). One template for every language: the Lambda Web Adapter layer runs the project as an HTTP server on `$PORT` — `run.sh` from `ap-build` (Python `python3.12`, Node `nodejs22.x`, Java/Kotlin `java21`, Ruby `ruby3.3`) or the static `bootstrap` on `provided.al2023` (Go). Every `web/*` template of the official repository deploys; the health route is `/health` (API Gateway keeps `/ping` for itself on `execute-api`). Template parameters the target fills: `Stage` (the scope's name), and for a connected account `PermissionsBoundaryArn` and `RolePath` |
|
|
49
|
-
| Readiness | before a deploy, without building or changing anything: the tooling is there, the overlay is applied, the stack name resolves, the credentials work, the stack is not mid-operation or failed (a failed first creation — `ROLLBACK_COMPLETE` or `ROLLBACK_FAILED` — is a warning: the deploy deletes it), the overlay takes a connected account's boundary and role path, the deploy role may do what the template needs (simulated with `iam:SimulatePrincipalPolicy` against the stack, the function, its log group, the execution role and every public layer the template references — the Lambda Web Adapter's, for one) and `sam validate --lint` passes. The platform runs it after every release for each of the app's scopes and refuses a blocked deploy unless forced; `action-platform readiness` runs it on a machine |
|
|
49
|
+
| Readiness | before a deploy, without building or changing anything: the tooling is there, the overlay is applied, the stack name resolves, the credentials work, the stack is not mid-operation or failed (a failed first creation — `ROLLBACK_COMPLETE` or `ROLLBACK_FAILED` — is a warning: the deploy deletes it), the overlay takes a connected account's boundary and role path, the deploy role may do what the template needs (simulated with `iam:SimulatePrincipalPolicy` against the stack, the function, its log group, the execution role and every public layer the template references — the Lambda Web Adapter's, for one) and `sam validate --lint` passes. The platform runs it after every release for each of the app's scopes and refuses a blocked deploy unless forced; `action-platform readiness` runs it on a machine. A stack its own pipeline deploys (an observed target) skips the credentials and permissions checks, since that pipeline deploys with another identity; its state is read only when an identity can read it |
|
|
50
50
|
| Deploy | `sam build` + `sam deploy --config-env <stage>` (scope `prod` → `prod`, any other → `default`). A stack left by a failed first creation (`ROLLBACK_COMPLETE`, `ROLLBACK_FAILED`) is deleted first; when that delete fails on a resource that was never created, the stack is deleted again with it retained. On a connected account, an overlay without `PermissionsBoundaryArn` and `RolePath` stops the deploy before the build. Every line `sam` prints reaches the platform's run log as it appears — the deploy form, the run dialog, `action-platform logs -f` |
|
|
51
51
|
| Rollback | CloudFormation `rollback-stack` — previous stack state |
|
|
52
52
|
| Diagnose | stack status and the HTTP API url |
|
|
@@ -377,6 +377,61 @@ class LambdaTargetTest(unittest.TestCase):
|
|
|
377
377
|
self.assertEqual(checks[-1].id, "aws.credentials")
|
|
378
378
|
self.assertFalse(checks[-1].ok)
|
|
379
379
|
|
|
380
|
+
def test_readiness_of_an_observed_stack_without_credentials_checks_only_the_template(
|
|
381
|
+
self,
|
|
382
|
+
):
|
|
383
|
+
target = LambdaTarget(region="us-east-1")
|
|
384
|
+
|
|
385
|
+
def run(args, cwd=None, env=None):
|
|
386
|
+
self.calls.append([Path(args[0]).name, *args[1:]])
|
|
387
|
+
|
|
388
|
+
if " ".join(args[1:3]) == "sts get-caller-identity":
|
|
389
|
+
raise DeployError("aws sts failed: Unable to locate credentials")
|
|
390
|
+
|
|
391
|
+
return "{}"
|
|
392
|
+
|
|
393
|
+
ctx = self.ctx("dev")
|
|
394
|
+
ctx.observed = True
|
|
395
|
+
|
|
396
|
+
with mock.patch.multiple(
|
|
397
|
+
shell, run=run, require=lambda tool, hint: [f"/usr/bin/{tool}"]
|
|
398
|
+
):
|
|
399
|
+
checks = {c.id: c for c in target.readiness(ctx)}
|
|
400
|
+
|
|
401
|
+
self.assertNotIn("aws.credentials", checks)
|
|
402
|
+
self.assertNotIn("aws.permissions", checks)
|
|
403
|
+
self.assertNotIn("stack.state", checks)
|
|
404
|
+
self.assertTrue(checks["template.valid"].ok)
|
|
405
|
+
self.assertNotIn(
|
|
406
|
+
["aws", "cloudformation", "describe-stacks"], [c[:3] for c in self.calls]
|
|
407
|
+
)
|
|
408
|
+
|
|
409
|
+
def test_readiness_of_an_observed_stack_reads_its_state_but_not_permissions(self):
|
|
410
|
+
target = LambdaTarget(region="us-east-1")
|
|
411
|
+
ctx = self.ctx("dev")
|
|
412
|
+
ctx.observed = True
|
|
413
|
+
|
|
414
|
+
with self.fake(
|
|
415
|
+
{
|
|
416
|
+
"sts get-caller-identity": {
|
|
417
|
+
"Account": "1",
|
|
418
|
+
"Arn": "arn:aws:sts::1:assumed-role/ap-deploy-x/p",
|
|
419
|
+
},
|
|
420
|
+
"cloudformation describe-stacks": {
|
|
421
|
+
"Stacks": [{"StackStatus": "UPDATE_ROLLBACK_FAILED"}]
|
|
422
|
+
},
|
|
423
|
+
}
|
|
424
|
+
):
|
|
425
|
+
checks = {c.id: c for c in target.readiness(ctx)}
|
|
426
|
+
|
|
427
|
+
self.assertNotIn("aws.credentials", checks)
|
|
428
|
+
self.assertNotIn("aws.permissions", checks)
|
|
429
|
+
self.assertFalse(checks["stack.state"].ok)
|
|
430
|
+
self.assertTrue(checks["template.valid"].ok)
|
|
431
|
+
self.assertNotIn(
|
|
432
|
+
["aws", "iam", "simulate-principal-policy"], [c[:3] for c in self.calls]
|
|
433
|
+
)
|
|
434
|
+
|
|
380
435
|
def test_diagnose_reads_the_stack(self):
|
|
381
436
|
with self.fake(
|
|
382
437
|
{
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|