Skip to content

Commit

Permalink
command report information contains all expected data
Browse files Browse the repository at this point in the history
  • Loading branch information
kcq committed Jul 20, 2019
1 parent 452b18b commit f13a571
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
11 changes: 0 additions & 11 deletions internal/app/master/commands/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,17 +250,6 @@ func OnBuild(
instructions)
errutil.FailOn(err)

/*
func NewImageBuilder(client *docker.Client,
imageRepoName string,
imageInfo *docker.Image,
artifactLocation string,
showBuildLogs bool,
imageOverrides map[string]bool,
overrides *config.ContainerOverrides,
instructions *config.ImageNewInstructions)
*/

if !builder.HasData {
logger.Info("WARNING - no data artifacts")
}
Expand Down
25 changes: 22 additions & 3 deletions pkg/report/command_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ func NewInfoCommand(reportLocation string) *InfoCommand {
}
}

// Save saves the report data to the configured location
func (p *Command) Save() {
func (p *Command) saveInfo(info interface{}) {
if p.reportLocation != "" {
dirName := filepath.Dir(p.reportLocation)
baseName := filepath.Base(p.reportLocation)
Expand All @@ -142,10 +141,30 @@ func (p *Command) Save() {
}
}

reportData, err := json.MarshalIndent(p, "", " ")
reportData, err := json.MarshalIndent(info, "", " ")
errutil.FailOn(err)

err = ioutil.WriteFile(p.reportLocation, reportData, 0644)
errutil.FailOn(err)
}
}

// Save saves the report data to the configured location
func (p *Command) Save() {
p.saveInfo(p)
}

// Save saves the Build command report data to the configured location
func (p *BuildCommand) Save() {
p.saveInfo(p)
}

// Save saves the Profile command report data to the configured location
func (p *ProfileCommand) Save() {
p.saveInfo(p)
}

// Save saves the Info command report data to the configured location
func (p *InfoCommand) Save() {
p.saveInfo(p)
}

0 comments on commit f13a571

Please sign in to comment.