Skip to content
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

Update sst version #374

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open

Update sst version #374

wants to merge 33 commits into from

Conversation

ayinloya
Copy link
Collaborator

Update sst version
Fix smart-camera-web and web embed preview url not shared as comment

@ayinloya ayinloya marked this pull request as ready for review December 16, 2024 19:26
@prfectionist
Copy link

prfectionist bot commented Dec 16, 2024

PR Reviewer Guide 🔍

(Review updated until commit d6fbaa7)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Error Handling
The workflow has continue-on-error set for critical steps like installing SST and retrieving app URL. This could mask important failures.

Dependency Change
The removal of the 'needs: [embed]' dependency could cause race conditions if both jobs run in parallel.

@prfectionist
Copy link

prfectionist bot commented Dec 16, 2024

PR Code Suggestions ✨

Latest suggestions up to d6fbaa7

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Score
Possible issue
Remove error suppression from critical workflow steps to ensure failures are properly caught and reported

Remove the continue-on-error directive from critical steps like retrieving the app
URL, as this could mask important failures.

.github/workflows/share-preview-url.yml [34-35]

 - name: retrieve sst app url
-  continue-on-error: true
   id: get_app_url
   working-directory: ./previews
Suggestion importance[1-10]: 8

Why: Removing continue-on-error from critical steps is crucial as it prevents masking of important failures that could affect the deployment process. This change ensures proper error reporting and workflow integrity.

8
Best practice
Add error handling and logging for secret configuration commands to improve debugging and reliability

Add error handling for the sst secret commands using conditional execution (&&) to
ensure all secrets are set correctly before proceeding with deployment.

.github/workflows/deploy-preview.yml [96-99]

-npm run sst secret set PartnerId ${{ secrets.PREVIEW_PARTNER_ID }} -- --stage ${{ steps.get_branch_name.outputs.SST_STAGE }} &&
-npm run sst secret set CallbackUrl ${{ secrets.PREVIEW_CALLBACK_URL }} -- --stage ${{ steps.get_branch_name.outputs.SST_STAGE }} &&
-npm run sst secret set SmileIdApiKey ${{ secrets.PREVIEW_SMILEID_API_KEY }} -- --stage ${{ steps.get_branch_name.outputs.SST_STAGE }} &&
-npm run sst secret set SmileIdEnvironment ${{ secrets.PREVIEW_SMILEID_ENVIRONMENT }} -- --stage ${{ steps.get_branch_name.outputs.SST_STAGE }}
+if ! npm run sst secret set PartnerId ${{ secrets.PREVIEW_PARTNER_ID }} -- --stage ${{ steps.get_branch_name.outputs.SST_STAGE }}; then
+  echo "Failed to set PartnerId secret" && exit 1
+fi &&
+if ! npm run sst secret set CallbackUrl ${{ secrets.PREVIEW_CALLBACK_URL }} -- --stage ${{ steps.get_branch_name.outputs.SST_STAGE }}; then
+  echo "Failed to set CallbackUrl secret" && exit 1
+fi &&
+if ! npm run sst secret set SmileIdApiKey ${{ secrets.PREVIEW_SMILEID_API_KEY }} -- --stage ${{ steps.get_branch_name.outputs.SST_STAGE }}; then
+  echo "Failed to set SmileIdApiKey secret" && exit 1
+fi &&
+if ! npm run sst secret set SmileIdEnvironment ${{ secrets.PREVIEW_SMILEID_ENVIRONMENT }} -- --stage ${{ steps.get_branch_name.outputs.SST_STAGE }}; then
+  echo "Failed to set SmileIdEnvironment secret" && exit 1
+fi
Suggestion importance[1-10]: 7

Why: The suggestion adds robust error handling and logging for secret configuration, which would help identify and debug deployment issues more effectively. This is important for maintaining deployment reliability.

7
Add error handling for network operations to improve workflow reliability

Add error handling to the curl command by checking its exit status and providing a
fallback or error message if the download fails.

.github/workflows/destroy-preview.yml [26]

-curl -fsSL https://ion.sst.dev/install | VERSION=3.4.5 bash
+curl -fsSL https://ion.sst.dev/install | VERSION=3.4.5 bash || { echo "Failed to install SST"; exit 1; }
Suggestion importance[1-10]: 7

Why: Adding explicit error handling for the curl command is important for workflow reliability, as it ensures failures are caught and reported properly rather than potentially being silently ignored.

7
Add error handling for command execution to ensure proper workflow failure reporting

Add error handling for the npm run sst remove command to ensure the workflow fails
appropriately if the removal fails.

.github/workflows/destroy-preview.yml [37]

-npm run sst remove -- --stage ${{ steps.get_branch_name.outputs.SS_STAGE }}
+npm run sst remove -- --stage ${{ steps.get_branch_name.outputs.SS_STAGE }} || { echo "Failed to remove SST app"; exit 1; }
Suggestion importance[1-10]: 7

Why: Adding error handling for the SST removal command is valuable as it ensures the workflow will explicitly fail if the cleanup operation fails, preventing potential resource leaks or incomplete cleanups.

7

Previous suggestions

Suggestions up to commit d6fbaa7
CategorySuggestion                                                                                                                                    Score
Security
Enhance security by verifying the integrity of downloaded installation scripts

Consider pinning the curl installation script to a specific hash to prevent
potential supply chain attacks. This ensures the downloaded script hasn't been
tampered with.

.github/workflows/destroy-preview.yml [26]

-curl -fsSL https://ion.sst.dev/install | VERSION=3.4.5 bash
+curl -fsSL https://ion.sst.dev/install | sha256sum --check <(echo "expected-hash  -") && VERSION=3.4.5 bash
Suggestion importance[1-10]: 9

Why: Adding hash verification for downloaded scripts is a critical security practice that helps prevent supply chain attacks and ensures script integrity.

9
Possible issue
Remove error suppression from critical workflow steps to ensure proper error handling

Remove continue-on-error from critical steps like retrieving app URL since failures
should stop the workflow.

.github/workflows/share-preview-url.yml [34]

 - name: retrieve sst app url
-  continue-on-error: true
   id: get_app_url
Suggestion importance[1-10]: 8

Why: Removing continue-on-error from the URL retrieval step is critical as this is an essential operation, and its failure should stop the workflow to prevent sharing invalid preview URLs.

8
Best practice
Add error handling to ensure secret configuration commands complete successfully

Add error handling and status checks after each secret setting command to ensure all
secrets are properly configured before deployment.

.github/workflows/deploy-preview.yml [96-99]

-npm run sst secret set PartnerId ${{ secrets.PREVIEW_PARTNER_ID }} -- --stage ${{ steps.get_branch_name.outputs.SST_STAGE }} &&
-npm run sst secret set CallbackUrl ${{ secrets.PREVIEW_CALLBACK_URL }} -- --stage ${{ steps.get_branch_name.outputs.SST_STAGE }} &&
-npm run sst secret set SmileIdApiKey ${{ secrets.PREVIEW_SMILEID_API_KEY }} -- --stage ${{ steps.get_branch_name.outputs.SST_STAGE }} &&
-npm run sst secret set SmileIdEnvironment ${{ secrets.PREVIEW_SMILEID_ENVIRONMENT }} -- --stage ${{ steps.get_branch_name.outputs.SST_STAGE }}
+npm run sst secret set PartnerId ${{ secrets.PREVIEW_PARTNER_ID }} -- --stage ${{ steps.get_branch_name.outputs.SST_STAGE }} || exit 1
+npm run sst secret set CallbackUrl ${{ secrets.PREVIEW_CALLBACK_URL }} -- --stage ${{ steps.get_branch_name.outputs.SST_STAGE }} || exit 1
+npm run sst secret set SmileIdApiKey ${{ secrets.PREVIEW_SMILEID_API_KEY }} -- --stage ${{ steps.get_branch_name.outputs.SST_STAGE }} || exit 1
+npm run sst secret set SmileIdEnvironment ${{ secrets.PREVIEW_SMILEID_ENVIRONMENT }} -- --stage ${{ steps.get_branch_name.outputs.SST_STAGE }} || exit 1
Suggestion importance[1-10]: 7

Why: Adding explicit error handling with || exit 1 ensures the workflow fails immediately if any secret configuration fails, preventing deployment with incomplete configuration.

7
Add explicit error handling to prevent silent failures in CI/CD pipeline commands

Add error handling to ensure the sst remove command executes successfully,
preventing silent failures in the workflow.

.github/workflows/destroy-preview.yml [37]

-npm run sst remove -- --stage ${{ steps.get_branch_name.outputs.SS_STAGE }}
+npm run sst remove -- --stage ${{ steps.get_branch_name.outputs.SS_STAGE }} || exit 1
Suggestion importance[1-10]: 7

Why: Explicit error handling with exit codes is important for CI/CD reliability, ensuring pipeline failures are properly caught and reported rather than silently continuing.

7
Suggestions up to commit a900b71
CategorySuggestion                                                                                                                                    Score
Security
Enhance security by verifying the integrity of downloaded scripts before execution

Add version pinning to the curl command using a SHA256 hash to ensure the downloaded
installer hasn't been tampered with and for better security.

.github/workflows/destroy-preview.yml [26]

-curl -fsSL https://ion.sst.dev/install | VERSION=3.4.5 bash
+curl -fsSL https://ion.sst.dev/install --output install.sh && echo "<sha256sum> install.sh" | sha256sum -c && VERSION=3.4.5 bash install.sh
Suggestion importance[1-10]: 9

Why: The suggestion addresses a critical security concern by adding integrity verification for downloaded scripts, which helps prevent supply chain attacks and ensures the authenticity of the installer script before execution.

9
Possible issue
Remove error suppression from critical workflow steps to ensure failures are properly detected

Remove continue-on-error from critical steps like retrieving the app URL since this
could mask important failures.

.github/workflows/share-preview-url.yml [30]

 - name: retrieve sst app url
-  continue-on-error: true
   id: get_app_url
   working-directory: ./previews
Suggestion importance[1-10]: 8

Why: Removing continue-on-error from critical steps like URL retrieval is important for detecting deployment issues, as masking these failures could lead to incomplete or failed deployments going unnoticed.

8
Best practice
Add error handling to fail the workflow if any secret configuration fails

Add error handling and status checks after each secret setting command to ensure all
secrets are properly configured before deployment.

.github/workflows/deploy-preview.yml [96-99]

-npm run sst secret set PartnerId ${{ secrets.PREVIEW_PARTNER_ID }} -- --stage ${{ steps.get_branch_name.outputs.SST_STAGE }} &&
-npm run sst secret set CallbackUrl ${{ secrets.PREVIEW_CALLBACK_URL }} -- --stage ${{ steps.get_branch_name.outputs.SST_STAGE }} &&
-npm run sst secret set SmileIdApiKey ${{ secrets.PREVIEW_SMILEID_API_KEY }} -- --stage ${{ steps.get_branch_name.outputs.SST_STAGE }} &&
-npm run sst secret set SmileIdEnvironment ${{ secrets.PREVIEW_SMILEID_ENVIRONMENT }} -- --stage ${{ steps.get_branch_name.outputs.SST_STAGE }}
+npm run sst secret set PartnerId ${{ secrets.PREVIEW_PARTNER_ID }} -- --stage ${{ steps.get_branch_name.outputs.SST_STAGE }} || exit 1
+npm run sst secret set CallbackUrl ${{ secrets.PREVIEW_CALLBACK_URL }} -- --stage ${{ steps.get_branch_name.outputs.SST_STAGE }} || exit 1
+npm run sst secret set SmileIdApiKey ${{ secrets.PREVIEW_SMILEID_API_KEY }} -- --stage ${{ steps.get_branch_name.outputs.SST_STAGE }} || exit 1
+npm run sst secret set SmileIdEnvironment ${{ secrets.PREVIEW_SMILEID_ENVIRONMENT }} -- --stage ${{ steps.get_branch_name.outputs.SST_STAGE }} || exit 1
Suggestion importance[1-10]: 7

Why: The suggestion improves reliability by ensuring the workflow fails immediately if any secret configuration fails, rather than potentially continuing with missing secrets.

7

@ayinloya ayinloya marked this pull request as draft December 16, 2024 19:31
@ayinloya ayinloya marked this pull request as ready for review December 16, 2024 19:33
@prfectionist
Copy link

prfectionist bot commented Dec 16, 2024

Persistent review updated to latest commit d6fbaa7

Copy link

This branch has been deployed to s3 / cloudfront.

✅ Preview URL for Smart Camera Web:
https://cdn.smileidentity.com/js/preview-update-sst/smart-camera-web.js
✅ Preview URL for Embed:
https://cdn.smileidentity.com/inline/preview-update-sst/js/script.min.js
✅ Preview URL for Web Client:

@ayinloya ayinloya marked this pull request as draft December 16, 2024 19:50
@ayinloya ayinloya marked this pull request as ready for review December 16, 2024 19:50
@prfectionist
Copy link

prfectionist bot commented Dec 16, 2024

Persistent review updated to latest commit d6fbaa7

@smileidentity smileidentity deleted a comment from github-actions bot Dec 16, 2024
Copy link

github-actions bot commented Jan 6, 2025

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant