-
-
Notifications
You must be signed in to change notification settings - Fork 0
fix: update context file in runtime. #238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors how image tags are handled in the serverless deployment workflow by moving from inline context parameters to updating the context file at runtime.
- Replaces inline
--context imageTagparameters with runtime updates to the prod.context.yaml file - Adds new workflow steps to update the context file using
yqbefore synth and deploy operations - Updates the default image tag in the context file from "latest-lambda" to "2.1.1"
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| serverless/configs/prod.context.yaml | Updates default imageTag from "latest-lambda" to "2.1.1" |
| .github/workflows/cd-serverless.yaml | Adds context file update steps and removes inline imageTag context parameters |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| working-directory: serverless/configs | ||
| env: | ||
| IMAGE_TAG: "${{ format('{0}-lambda', github.event.workflow_run.head_sha) }}" | ||
| run: | | ||
| yq -i '.imageTag = strenv(IMAGE_TAG)' prod.context.yaml |
Copilot
AI
Oct 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic for updating the context file is duplicated between the synth job (lines 57-63) and deploy job (lines 216-222). Consider extracting this into a reusable composite action or workflow template to reduce code duplication and ensure consistency.
| working-directory: serverless/configs | |
| env: | |
| IMAGE_TAG: "${{ format('{0}-lambda', github.event.workflow_run.head_sha) }}" | |
| run: | | |
| yq -i '.imageTag = strenv(IMAGE_TAG)' prod.context.yaml | |
| uses: ./.github/actions/update-context-file | |
| with: | |
| image_tag: "${{ format('{0}-lambda', github.event.workflow_run.head_sha) }}" | |
| context_file: "prod.context.yaml" | |
| working_directory: "serverless/configs" |
| # --context env=prod | ||
|
|
||
| - name: Update context file with new version | ||
| if: ${{ github.event.workflow_run.conclusion == 'success' }} |
Copilot
AI
Oct 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition checks github.event.workflow_run.conclusion == 'success' but this step runs before the actual deployment operations. If the workflow_run event doesn't exist or has a different conclusion, this step will be skipped and the context file won't be updated, potentially causing the deployment to use an outdated image tag.
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }} |
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified FilesNo covered modified files...
|
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
|



PR Type
Enhancement, Bug fix
Description
Replace inline context parameter with file-based configuration
Add workflow step to dynamically update context file with image tag
Remove hardcoded imageTag logic from CDK commands
Update prod.context.yaml with new version reference
Diagram Walkthrough
File Walkthrough
cd-serverless.yaml
Replace inline context with file-based configuration.github/workflows/cd-serverless.yaml
prod.context.yamlwith dynamic imagetag before synth and deploy
--context imageTagparameter from both CDK synth anddeploy commands
yqtoupdate YAML file
prod.context.yaml
Update image tag to version 2.1.1serverless/configs/prod.context.yaml
imageTagvalue fromlatest-lambdato2.1.1imageUriandimageTagfields