-
Notifications
You must be signed in to change notification settings - Fork 100
runners; Add accountId to findAmiID #6744
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
base: main
Are you sure you want to change the base?
Conversation
This should resolve issues where accountId is needed for findAmiID Signed-off-by: Eli Uriegas <[email protected]>
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
terraform-aws-github-runner/modules/runners/lambdas/runners/src/scale-runners/runners.test.ts
Fixed
Show fixed
Hide fixed
terraform-aws-github-runner/modules/runners/lambdas/runners/src/scale-runners/runners.test.ts
Fixed
Show fixed
Hide fixed
terraform-aws-github-runner/modules/runners/lambdas/runners/src/scale-runners/runners.test.ts
Fixed
Show fixed
Hide fixed
export async function findAmiID(metrics: Metrics, region: string, filter: string, owners = 'amazon'): Promise<string> { | ||
const ec2 = new EC2({ region: region }); | ||
const accountId = await getCurrentAccountId(); | ||
const allOwners = [accountId, owners]; | ||
|
Check failure
Code scanning / lintrunner
SPACES/trailing spaces Error
terraform-aws-github-runner/modules/runners/lambdas/runners/src/scale-runners/runners.ts
Fixed
Show fixed
Hide fixed
Signed-off-by: Eli Uriegas <[email protected]>
Signed-off-by: Eli Uriegas <[email protected]>
Signed-off-by: Eli Uriegas <[email protected]>
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.
Vibe coding ft(almost)w
export async function findAmiID(metrics: Metrics, region: string, filter: string, owners = 'amazon'): Promise<string> { | ||
const ec2 = new EC2({ region: region }); | ||
const accountId = await getCurrentAccountId(); | ||
const allOwners = [accountId, owners]; |
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.
These would be a good set of owners to include in the list:
// Helper function to get the current AWS account ID | ||
async function getCurrentAccountId(): Promise<string> { | ||
const sts = new STS(); | ||
const identity = await sts.getCallerIdentity().promise(); |
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.
Please double check to see if the lambdas have access to this identity before checking in the code. But I suspect my comment below includes all the identities that would be needed
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.
Claude seemed to think that we already did
export async function findAmiID(metrics: Metrics, region: string, filter: string, owners = 'amazon'): Promise<string> { | ||
const ec2 = new EC2({ region: region }); | ||
const accountId = await getCurrentAccountId(); | ||
const allOwners = [accountId, owners]; |
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.
Also, note that the function definition has "owners" passed in here as an optional parameter that no caller actually uses.
Consider changing that optional parameter's type to a list of strings and moving this owner identification code to a higher state of being 😇
const sts = new STS(); | ||
const identity = await sts.getCallerIdentity().promise(); | ||
if (!identity.Account) { | ||
throw new Error('Unable to retrieve AWS account ID'); |
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.
Instead of failing with error, should we just log the error and fallback to Amazon only images ?
What is our test plan on deploying this ? Is there a way to test it in canary only ? |
Signed-off-by: Eli Uriegas <[email protected]>
} | ||
|
||
export async function findAmiID( | ||
metrics: Metrics, |
Check failure
Code scanning / lintrunner
SPACES/trailing spaces Error
|
||
export async function findAmiID( | ||
metrics: Metrics, | ||
region: string, |
Check failure
Code scanning / lintrunner
SPACES/trailing spaces Error
export async function findAmiID( | ||
metrics: Metrics, | ||
region: string, | ||
filter: string, |
Check failure
Code scanning / lintrunner
SPACES/trailing spaces Error
const ec2 = new EC2({ region: region }); | ||
const accountId = await getCurrentAccountId(); | ||
const lfAccountId = '391835788720'; | ||
|
Check failure
Code scanning / lintrunner
SPACES/trailing spaces Error
const accountId = await getCurrentAccountId(); | ||
const lfAccountId = '391835788720'; | ||
|
||
const allOwners = accountId |
Check failure
Code scanning / lintrunner
SPACES/trailing spaces Error
This should resolve issues where accountId is needed for findAmiID
Resolves #6688