-
Notifications
You must be signed in to change notification settings - Fork 73
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
[HOTFIX]: Add manual trigger for cache updater stack #1001
Merged
Merged
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8b55bf1
[HOTFIX]: Add manual trigger for cache updater stack
branberry 08a0e32
[HOTFIX]: Test
branberry 3607db5
[HOTFIX]: Use correct env
branberry 2ed443c
[HOTFIX]: Up CPU and memory limit
branberry 9b65aae
[HOTFIX]: Uncomment force run
branberry 9ad36be
[HOTFIX]: use main branch for docs-worker-actions
branberry 3b5329d
[HOTFIX]: Remove push
branberry b0483b1
[HOTFIX]: Update readme
branberry f54b4d0
address comment
branberry 23fd49b
Merge branch 'main' into cache-updater-hotfix
branberry File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,15 @@ | ||
on: | ||
release: | ||
types: [released] | ||
workflow_dispatch: | ||
inputs: | ||
forceRun: | ||
description: Force the cache to be rebuilt. | ||
default: 'false' | ||
push: | ||
branches: | ||
- 'cache-updater-hotfix' | ||
|
||
concurrency: | ||
group: environment-prd-enhanced-cacheUpdate-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
@@ -20,7 +29,9 @@ jobs: | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-east-2 | ||
- name: Rebuild Cache if New Snooty Parser Version | ||
uses: mongodb/docs-worker-actions/rebuild-parse-cache@main | ||
uses: mongodb/docs-worker-actions/rebuild-parse-cache@cache-update-hotfix | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NOTE: revert this after merging this PR |
||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
WORKSPACE: ${{ github.workspace }} | ||
# FORCE_RUN: ${{ inputs.forceRun }} | ||
FORCE_RUN: 'true' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,15 +7,27 @@ import { S3Client } from '@aws-sdk/client-s3'; | |
import { executeCliCommand } from '../commands/src/helpers'; | ||
|
||
const readdirAsync = promisify(fs.readdir); | ||
const SNOOTY_CACHE_BUCKET_NAME = process.env.SNOOTY_CACHE_BUCKET_NAME; | ||
const { SNOOTY_CACHE_BUCKET_NAME, GITHUB_BOT_USERNAME, GITHUB_BOT_PASSWORD } = process.env; | ||
|
||
if (!SNOOTY_CACHE_BUCKET_NAME) throw new Error('ERROR! SNOOTY_CACHE_BUCKET_NAME is not defined'); | ||
|
||
async function cloneDocsRepo(repoName: string, repoOwner: string) { | ||
if (!GITHUB_BOT_USERNAME) { | ||
const errorMessage = `ERROR! GITHUB_BOT_USERNAME is not set. ${repoOwner}/${repoName} will not have their cache updated`; | ||
console.error(`ERROR! GITHUB_BOT_USERNAME is not set. ${repoOwner}/${repoName} will not have their cache updated`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Nit) Should we consolidate to |
||
throw new Error(errorMessage); | ||
} | ||
|
||
if (!GITHUB_BOT_PASSWORD) { | ||
const errorMessage = `ERROR! GITHUB_BOT_PASSWORD is not set. ${repoOwner}/${repoName} will not have their cache updated`; | ||
console.error(errorMessage); | ||
throw new Error(errorMessage); | ||
} | ||
|
||
try { | ||
const cloneResults = await executeCliCommand({ | ||
command: 'git', | ||
args: ['clone', `https://github.com/${repoOwner}/${repoName}`], | ||
args: ['clone', `https://${GITHUB_BOT_USERNAME}:${GITHUB_BOT_PASSWORD}@github.com/${repoOwner}/${repoName}`], | ||
}); | ||
|
||
console.log('clone: ', cloneResults); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
NOTE: Remove this before merging