-
Notifications
You must be signed in to change notification settings - Fork 66
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
FnCLI fn deploy #670
base: master
Are you sure you want to change the base?
FnCLI fn deploy #670
Conversation
885deda
to
6e96ab1
Compare
39e2d65
to
fae33f2
Compare
return | ||
var hostedPlatform = runtime.GOARCH | ||
if platform, ok := TargetPlatformMap[shape]; ok { | ||
targetPlatform := strings.Join(platform," ") |
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.
Why are we appending " " to platform?
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.
Added comment in the code
common/common.go
Outdated
targetPlatform := strings.Join(platform," ") | ||
if targetPlatform != hostedPlatform { | ||
fmt.Println("TargetedPlatform and hostPlatform are not same") | ||
if containerEngineType == ContainerEngineType { |
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.
Change the variable name to reflect docker type.
Please move this condition to the method
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.
done
24c1515
to
b64346d
Compare
b64346d
to
31dcfc0
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.
Optimise the logs and format them properly. Logic seems to be fine.
@@ -390,9 +390,12 @@ func (p *deploycmd) deployFuncV20180708(c *cli.Context, app *models.App, funcfil | |||
if !p.local { | |||
// fetch the architectures | |||
shape = app.Shape | |||
fmt.Printf("*****shape is %v *******", shape) |
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.
Can we print this log once the shape is properly assigned (after default case ie., line 400)?
args := []string{ | ||
buildCommand, | ||
"build", | ||
"-t", name, | ||
//"-t", name, |
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.
Can we clean these comments?
} | ||
|
||
if containerEngineType != containerEngineTypeDocker { | ||
fmt.Println("*** engine type not docker append load") |
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.
Can these be in 'DEBUG' logs? It will be too 'internal' for the INFO logs.
var buildCommand = "buildx" | ||
var name = imageName | ||
|
||
plat:= strings.Join(architectures,"," ) |
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.
plat is not comprehensive. You can directly use 'strings.Join' command in fmt.Println()
Another variable is not required.
Buildx platform confusing. You can say 'Specified Platform/s : '
var name = imageName | ||
plat:= strings.Join(architectures,"," ) | ||
fmt.Println("build platform is %v", plat) |
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.
plat is not comprehensive. You can directly use 'strings.Join' command in fmt.Println()
Another variable is not required.
Build platform confusing. You can say 'Specified Platform/s : '
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.
Make the logs look more professional
if platform, ok := TargetPlatformMap[shape]; ok { | ||
// create target platform string to compare with hosted platform | ||
targetPlatform := strings.Join(platform," ") | ||
fmt.Println("hosted platform %v target platform %v", hostedPlatform, targetPlatform) |
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.
Format the log statement
targetPlatform := strings.Join(platform," ") | ||
fmt.Println("hosted platform %v target platform %v", hostedPlatform, targetPlatform) | ||
if targetPlatform != hostedPlatform { | ||
fmt.Println("TargetedPlatform and hostPlatform are not same") |
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 can be inferred from the log at line 549. Do we need it again?
As the logs are public facing, lets limit the INFO logs. If its needed for DEBUG, lets put it in DEBUG logs
defer cleanupContainerBuilder(containerEngineType) | ||
} else { | ||
fmt.Println("TargetedPlatform and hostPlatform are same") | ||
fmt.Println("1. issuePush is ", issuePush) |
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.
Do we need these issuePush logs?
} | ||
|
||
fmt.Println("*****containerEngineType*****",containerEngineType ) |
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.
Can we merge it into a single log?
@@ -551,6 +591,31 @@ func RunBuild(verbose bool, dir, imageName, dockerfile string, buildArgs []strin | |||
fmt.Fprintln(os.Stderr) | |||
return fmt.Errorf("build cancelled on signal %v", signal) | |||
} | |||
if containerEngineType != containerEngineTypeDocker || issuePush { | |||
fmt.Println("Using Container engine", containerEngineType, "to push as --push id only for docker and --load is for podman") |
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.
Optimise these logs.
Log statement need not be true because we use push even for podman with Build command
No description provided.