-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat(apps): Let users deploy to their own docker hub (and other fixes) #277
Conversation
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 reads great! I left a few more clarifying questions to understand the feature better, but this is already looking good to go ✨
cmd/meroxa/root/apps/deploy.go
Outdated
@@ -44,15 +49,17 @@ type createApplicationClient interface { | |||
|
|||
type Deploy struct { | |||
flags struct { | |||
Path string `long:"path" description:"path to the app directory"` | |||
Path string `long:"path" description:"path to the app directory (default is local directory)"` | |||
DockerHubUserName string `long:"docker-hub-username" description:"DockerHub username to use to build and deploy the application image"` |
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 is neat! Do we want to expose to the user the concept of a function image in the descriptions for these flags, too?
Technically, we're only building a function image, instead of an application image, on Docker. What are your thoughts on the wording though and how much the user should be aware about the distinction between deploying an app and building a function image?
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.
@jayjayjpg I updated the wording last night (mostly due to linting), but now the message is a bit broader. Please take a look and tell me what you think.
} | ||
|
||
func (d *Deploy) validateLocalDeploymentConfig() error { | ||
// Check if users had an old configuration where DockerHub credentials were set as environment variables |
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.
The two step validation step for both environment variables and flags is really neat ✨
// Check if users had an old configuration where DockerHub credentials were set as environment variables | ||
err := d.validateDockerHubEnvVars() | ||
if err != nil { | ||
return err |
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.
Could we also log out the error here using logger.Error
onto the console or is this already taken care of by returning the err
variable?
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.
@jayjayjpg It's been taken care of. That function would return the error to then to the Execute function which Cobra (our CLI. builder, really) will print out as an 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.
Got it and thank you for the outline, that's super helpful!
default: | ||
return fmt.Errorf("language %q not supported. %s", d.lang, LanguageNotSupportedError) | ||
} | ||
|
||
if err != nil { | ||
return err |
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.
If the deploy should fail with an error, would we need to log the error explicitly here via logger.Error
or is this already taken care of by returning the err
object?
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.
if the error is correctly returned by either deploy step, the CLI will ultimately print out the error returned on the execution.
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.
Got it, I wasn't fully aware yet, that an error essentially needs to be passed through to different commands and that sounds good!
} | ||
}) | ||
} | ||
} |
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.
Nice test coverage!
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 reads great! Thank you for the super swift update and all of the details in the PR description, too! ✨
Path string `long:"path" description:"path to the app directory"` | ||
Path string `long:"path" description:"path to the app directory (default is local directory)"` | ||
DockerHubUserName string `long:"docker-hub-username" description:"DockerHub username to use to build and deploy the app"` | ||
DockerHubAccessToken string `long:"docker-hub-access-token" description:"DockerHub access token to use to build and deploy the app"` |
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.
Yes, this reads great and thank you for the swift update! ✨
// Check if users had an old configuration where DockerHub credentials were set as environment variables | ||
err := d.validateDockerHubEnvVars() | ||
if err != nil { | ||
return err |
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.
Got it and thank you for the outline, that's super helpful!
default: | ||
return fmt.Errorf("language %q not supported. %s", d.lang, LanguageNotSupportedError) | ||
} | ||
|
||
if err != nil { | ||
return err |
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.
Got it, I wasn't fully aware yet, that an error essentially needs to be passed through to different commands and that sounds good!
apps init
for JS.Type of change
How was this tested?
Demo
See slack.