Conversation
…eting Lambda@Edge function
📝 Walkthrough## Walkthrough
The script responsible for deleting AWS Lambda function versions was updated to include a `set +e` command before the deletion loop. This adjustment allows the script to continue running even if an error occurs during the deletion process. By capturing the exit code of the `aws lambda delete-function` command, the script can now identify specific error messages, such as those related to function replication, and implement a retry mechanism with a delay instead of terminating immediately.
## Changes
| File(s) | Change Summary |
|-----------------------------|-----------------------------------------------------------------------------------------------------------------------|
| deployment/delete_lambda | Added `set +e` before the Lambda version deletion loop to disable immediate exit on error, enabling manual error handling and retries for specific AWS Lambda deletion errors. |
| doc/release/RELEASE-NOTES.md| Expanded release notes for OSDEV-1886 to describe the added retry mechanism and internal exit code management preventing forced script termination during Lambda deletion. |
## Sequence Diagram(s)
```mermaid
sequenceDiagram
participant Script
participant AWS Lambda
loop For each Lambda version
Script->>AWS Lambda: delete-function
alt Deletion succeeds
Script-->>Script: Continue to next version
else Deletion fails (replication error)
Script-->>Script: Wait, then retry deletion
else Other errors
Script-->>Script: Handle error accordingly
end
endPossibly related PRs
Suggested reviewers
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
deployment/delete_lambda (1)
83-99: Effective error handling implementationThe error handling logic is well-implemented. You're capturing the exit code, properly identifying replication-related errors for retry, and handling unexpected errors by displaying them and exiting.
Consider adding
set -eat the end of the deletion loop (after line 101) to restore the strict error handling for any potential future commands added to the script.done + set -e echo "Process completed successfully."
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
deployment/delete_lambda(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (13)
- GitHub Check: run-integration-test-code-quality
- GitHub Check: run-flake8-linter
- GitHub Check: run-fe-code-quality
- GitHub Check: run-eslint-linter-and-prettier-formatter
- GitHub Check: run-django-code-quality
- GitHub Check: run-dd-code-quality
- GitHub Check: run-countries-code-quality
- GitHub Check: run-contricleaner-code-quality
- GitHub Check: get-base-branch-fe-cov
- GitHub Check: get-base-branch-countries-cov
- GitHub Check: get-base-branch-contricleaner-cov
- GitHub Check: get-base-branch-django-cov
- GitHub Check: get-base-branch-dd-cov
🔇 Additional comments (1)
deployment/delete_lambda (1)
74-76: Excellent addition to improve error handling!Adding
set +ehere is a good solution for handling the error when deleting Lambda@Edge functions. This allows the script to continue execution and implement the retry mechanism when encountering the "function is replicated" error condition.
React App | Jest test suite - Code coverage reportTotal: 33.99%Your code coverage diff: 0.00% ▴ ✅ All code changes are covered |
Dedupe Hub App | Unittest test suite - Code coverage reportTotal: 56.14%Your code coverage diff: 0.00% ▴ ✅ All code changes are covered |
Countries App | Unittest test suite - Code coverage reportTotal: 100%Your code coverage diff: 0.00% ▴ ✅ All code changes are covered |
Contricleaner App | Unittest test suite - Code coverage reportTotal: 98.98%Your code coverage diff: 0.00% ▴ ✅ All code changes are covered |
Django App | Unittest test suite - Code coverage reportTotal: 80.74%Your code coverage diff: 0.00% ▴ ✅ All code changes are covered |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
doc/release/RELEASE-NOTES.md (2)
35-36: Fix nested list indentation to satisfy Markdown lint rules
The sub-bullets under the OSDEV-1886 entry use 4 spaces for indentation, which violates MD007. Use 2 spaces for nested list items:- * Fixed the script to run within the Destroy Environment GitHub workflow... - * Implemented prevention of forced script termination... + * Fixed the script to run within the Destroy Environment GitHub workflow... + * Implemented prevention of forced script termination...🧰 Tools
🪛 markdownlint-cli2 (0.17.2)
35-35: Unordered list indentation
Expected: 2; Actual: 4(MD007, ul-indent)
36-36: Unordered list indentation
Expected: 2; Actual: 4(MD007, ul-indent)
34-37: Consolidate duplicate OSDEV-1886 entries
This ticket appears both under Release 2.3.0 and earlier under Release 2.1.0. To avoid confusion, consider merging the initial script creation and the follow-up “set +e” improvement into a single release-note entry or explicitly mark one as an enhancement to the other.🧰 Tools
🪛 markdownlint-cli2 (0.17.2)
35-35: Unordered list indentation
Expected: 2; Actual: 4(MD007, ul-indent)
36-36: Unordered list indentation
Expected: 2; Actual: 4(MD007, ul-indent)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
doc/release/RELEASE-NOTES.md(1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
doc/release/RELEASE-NOTES.md
35-35: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
36-36: Unordered list indentation
Expected: 2; Actual: 4
(MD007, ul-indent)
⏰ Context from checks skipped due to timeout of 90000ms (13)
- GitHub Check: run-integration-test-code-quality
- GitHub Check: run-fe-code-quality
- GitHub Check: run-flake8-linter
- GitHub Check: run-eslint-linter-and-prettier-formatter
- GitHub Check: run-django-code-quality
- GitHub Check: run-dd-code-quality
- GitHub Check: run-countries-code-quality
- GitHub Check: run-contricleaner-code-quality
- GitHub Check: get-base-branch-fe-cov
- GitHub Check: get-base-branch-dd-cov
- GitHub Check: get-base-branch-contricleaner-cov
- GitHub Check: get-base-branch-django-cov
- GitHub Check: get-base-branch-countries-cov
🔇 Additional comments (1)
doc/release/RELEASE-NOTES.md (1)
34-34: Release notes updated for OSDEV-1886
The new bullet concisely summarizes the added error-handling behavior for the Lambda@Edge deletion script.
|



Adding the
set +ecommand is necessary to ensure that the script does not terminate on an error, allowing us to handle the exit code of the Lambda function deletion command manually. This is especially useful in cases where the function might already be deleted or doesn't exist — theaws lambda delete-functioncommand would return an error, but withset +e, we can catch that error and decide how to proceed.