-
Notifications
You must be signed in to change notification settings - Fork 6
Add support for reading images from AWS ECR #16
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
71d8457
to
a6c05a4
Compare
modal-js/src/app.ts
Outdated
|
||
async imageFromAwsEcr(tag: string, secret: Secret): Promise<Image> { | ||
if (!secret.secretId) { | ||
throw new Error("secret.secretId must not be null"); |
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.
This error could be a bit more helpful, like secret must be a reference to an existing Secret, e.g.
await Secret.from_name("my_secret")or similar - I wouldn't expect users to know how to get an object with a
secretId` here otherwise
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.
👍 ✅
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.
Hi @ehdr, can you make the following changes:
- implement the same functionality in Go
- add tests to both secret and, ideally,
imageFromAwsEcr
- add examples
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.
Lgtm just need to follow some language conventions and add tests! I think you'd likely have noticed the camelCase naming thing after writing the examples / tests since they would be inconsistent with the code around it.
Also what Luis mentioned above, we're trying to keep the code as similar as possible between Go and TS and avoid it drifting.
modal-js/src/app.ts
Outdated
if (!secret.secretId) { | ||
throw new Error( | ||
"secret must be a reference to an existing Secret, e.g. `await Secret.from_name('my_secret')`", | ||
); | ||
} |
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.
I don't think this validation is needed or helpful since the Secret
object, once constructed properly, must have a secret ID already.
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.
I added it because it failed when I left out the await
on Secret.from_name
in await app.imageFromAwsEcr("alpine:3.21", await Secret.from_name("aws"))
. Do you think it makes sense, and/or is there a better way to guard for this?
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.
Ah got it. Yeah that would be caught by TypeScript! A more direct check might be
if (!(secret instanceof Secret)) {
throw new TypeError("...");
}
a0ba483
to
4bb7820
Compare
I fixed most of the comments now. Will have to pause this for a bit for customer related work, but will add example and update Go client later before merging! |
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.
Thank you for updating!
4bb7820
to
c598abe
Compare
App.imageFromAwsEcr
for reading images from AWS ECRThere 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.
Go implementation lgtm.
modal-go/secret.go
Outdated
RequiredKeys []string | ||
} | ||
|
||
func SecretFromName(ctx context.Context, name string, options SecretFromNameOptions) (*Secret, error) { |
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.
Add documentation
c598abe
to
c908344
Compare
I finally (after some other distractions) got around to finishing this, so I think all outstanding comments are fixed now! I also adapted it to #23 (e.g. the Go SDK accepts |
cac5072
to
a4751e7
Compare
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.
LGTM!
a4751e7
to
063e245
Compare
5310419
to
8798e93
Compare
8912234
to
49cc720
Compare
49cc720
to
5302232
Compare
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.
Thank you!
modal-js/tsconfig.json
Outdated
"*.config.ts", | ||
"vitest.config.ts", | ||
"tsup.config.ts" |
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.
Isn't this redundant?
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.
Ah yes, good catch, fixed!
CLI-433
Adds support similar to modal.Image.from_aws_ecr(), related support for
Secret
s.