Skip to content

Commit

Permalink
[DOP-4171]: Warn instead of throw error on getSnootyParserVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
branberry committed Jan 26, 2024
1 parent a3c52be commit 886438e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
22 changes: 13 additions & 9 deletions .github/workflows/deploy-feature-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,27 @@ jobs:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: Deploy Feature Branch Infrastructure

- name: Install Node Dependencies
run: |
npm ci
cd cdk-infra/
npm ci
npm run deploy:feature:stack -- -c env=stg -c customFeatureName=enhancedApp-stg-${{github.head_ref}} auto-builder-stack-enhancedApp-stg-${{github.head_ref}}-queues
npm run deploy:feature:stack -- -c env=stg -c customFeatureName=enhancedApp-stg-${{github.head_ref}} auto-builder-stack-enhancedApp-stg-${{github.head_ref}}-worker
npm run deploy:feature:stack -- -c env=stg -c customFeatureName=enhancedApp-stg-${{github.head_ref}} auto-builder-stack-enhancedApp-stg-${{github.head_ref}}-webhooks --outputs-file outputs.json
- name: Get Webhook URL
uses: mongodb/docs-worker-actions/comment-pr@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cache root node_modules
id: cache-root
uses: actions/cache@v3
with:
path: |
node_modules
cdk-infra/node_modules
key: ${{ github.head_ref }}
key: ${{ github.head_ref }}
- name: Deploy Feature Branch Infrastructure
run: |
npm run deploy:feature:stack -- -c env=stg -c customFeatureName=enhancedApp-stg-${{github.head_ref}} auto-builder-stack-enhancedApp-stg-${{github.head_ref}}-queues
npm run deploy:feature:stack -- -c env=stg -c customFeatureName=enhancedApp-stg-${{github.head_ref}} auto-builder-stack-enhancedApp-stg-${{github.head_ref}}-worker
npm run deploy:feature:stack -- -c env=stg -c customFeatureName=enhancedApp-stg-${{github.head_ref}} auto-builder-stack-enhancedApp-stg-${{github.head_ref}}-webhooks --outputs-file outputs.json
- name: Get Webhook URL
uses: mongodb/docs-worker-actions/comment-pr@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/test-cache-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2

- name: Get Webhook URL
- name: Rebuild Cache if New Snooty Parser Version
uses: mongodb/docs-worker-actions/rebuild-parse-cache@DOP-4294
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
6 changes: 5 additions & 1 deletion cdk-infra/utils/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ export function isEnhanced(): boolean {
export function getSnootyParserVersion(): string {
checkContextInit();
const snootyParserVersion = contextVarsMap.get('snootyParserVersion');
if (!snootyParserVersion) throw new Error('Error! The context variable snootyParserVersion is not defined.');

if (!snootyParserVersion) {
console.warn('Error! The context variable snootyParserVersion is not defined.');
return '';
}

return snootyParserVersion;
}
Expand Down

0 comments on commit 886438e

Please sign in to comment.