-
Notifications
You must be signed in to change notification settings - Fork 29
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
Feature implementation: release list charts #456
Conversation
dd96c3e
to
34b503c
Compare
34b503c
to
2ef133d
Compare
cmd/release/cmd/list.go
Outdated
Short: "List Charts assets versions state for release process", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
|
||
var branch, chart string = "", "" |
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.
Let's take advantage of the "0 value" and update this to be
var branch string
var chart string
We don't need to explicitly set the new string to ""
cmd/release/cmd/list.go
Outdated
return errors.New("verify your config file, chart configuration not implemented correctly, you must insert workspace path and your forked repo url") | ||
} | ||
|
||
err := charts.ListLifecycleStatus(context.Background(), config, branch, chart) |
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.
You can return here and remove the code underneath.
release/charts/charts.go
Outdated
"os/exec" | ||
"strings" | ||
|
||
ecmConfig "github.com/rancher/ecm-distro-tools/cmd/release/config" |
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.
Does this need the import alias?
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.
@briandowns
To be honest, I copied it from:
release/k3s/k3s.go
but I can remove it.
I just wanted to follow the pattern that was already there from the example I caught.
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.
Let's avoid import aliases if the imported package name doesn't conflict with any other imported or existing symbol.
release/charts/charts.go
Outdated
|
||
// ListLifecycleStatus prints the lifecycle status of the charts | ||
func ListLifecycleStatus(ctx context.Context, c *ecmConfig.ChartsRelease, branch, chart string) 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.
Remove this new line.
release/charts/charts.go
Outdated
} | ||
|
||
// change working dir to the charts repo | ||
err = os.Chdir(chartsRepoPath) |
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.
Move the if check up a line and scope lock the err value. Please do this for all calls that return a single err value.
} | ||
|
||
err := executeChartsBuildScripts(c.Workspace, "lifecycle-status", branchArg, chartArg) | ||
if err != nil { |
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.
Let's rename this to: runChartsBuild. The previous name leaks implementation detail that could change in the future. This new name still conveys the idea and allows us to change from scripts to programs and exec model.
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.
Not sure if this isn't updating but it doesn't appear as though this has been completed.
d0537ea
to
937541b
Compare
release/charts/charts.go
Outdated
return err | ||
} | ||
|
||
fmt.Printf("generated log files for inspection at: \n%s\n", c.Workspace+"/logs/") |
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.
Let's remove this in favor of printing output from the calling code of this function. Library code shouldn't be putting anything to a log or STDOUT unless in debug.
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.
@briandowns I removed the print from here to the parent calling function, please check if this is right now.
937541b
to
cd5720a
Compare
@briandowns all fixes implemented. |
cmd/release/cmd/list.go
Outdated
Use: "charts [branch] [charts](optional)", | ||
Short: "List Charts assets versions state for release process", | ||
RunE: func(cmd *cobra.Command, args []string) 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.
Small thing but remove this empty line.
release/charts/charts.go
Outdated
return response, nil | ||
} | ||
|
||
func runChartsBuildScripts(chartsRepoPath string, args ...string) ([]byte, 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.
I thought I had left a comment about changing the name but I guess not. Please change this to be runChartsBuild
release/charts/charts.go
Outdated
// save current working dir | ||
ecmWorkDir, err := os.Getwd() | ||
if err != nil { | ||
return []byte{}, 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.
I think we can/should return nil here rather than having an unnecessary allocation.
b192b2d
to
5abebe1
Compare
Issue:
#445
Solution:
After implementing: rancher/charts-build-scripts#144
This is the integration between:
charts-build-scripts
commandlifecycle-status
ecm-distro-tools
commandrelease list charts
Result example:
The logs printed by
lifecycle-status
are printed to the terminal and the saved log files path is also printed in the terminal: