Skip to content
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

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

FnCLI fn deploy #670

wants to merge 3 commits into from

Conversation

Jaytee-fn
Copy link
Contributor

No description provided.

return
var hostedPlatform = runtime.GOARCH
if platform, ok := TargetPlatformMap[shape]; ok {
targetPlatform := strings.Join(platform," ")

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?

Copy link
Contributor Author

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 {

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@Jaytee-fn Jaytee-fn force-pushed the jayarora/FnCLI branch 2 times, most recently from 24c1515 to b64346d Compare August 9, 2023 09:49
Copy link

@sudhindraaoracle sudhindraaoracle left a 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)

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,

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")

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,"," )

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)

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 : '

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)

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")

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)

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 )

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")

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

@Jaytee-fn Jaytee-fn marked this pull request as draft November 6, 2023 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants