Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #833 from StrongMonkey/rename-build-hist
Browse files Browse the repository at this point in the history
Rename build-history, fix template bug
  • Loading branch information
StrongMonkey authored Nov 18, 2019
2 parents a7ffe03 + 9b28bff commit 7765776
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 34 deletions.
39 changes: 39 additions & 0 deletions cli/cmd/buildhistory/buildhistory.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package buildhistory

import (
"github.com/rancher/rio/cli/pkg/builder"
"github.com/rancher/rio/cli/pkg/clicontext"
"github.com/rancher/rio/cli/pkg/table"
"github.com/rancher/rio/cli/pkg/tables"
"github.com/rancher/rio/cli/pkg/types"
"github.com/urfave/cli"
)

func History(app *cli.App) cli.Command {
hist := builder.Command(&BuildHistory{},
"List Build History",
app.Name+" build-history [OPTIONS]",
"")
return cli.Command{
Name: "build-history",
Usage: "Show build-history",
Action: clicontext.DefaultAction(hist.Action),
Flags: table.WriterFlags(),
}
}

type BuildHistory struct {
}

func (b *BuildHistory) Customize(cmd *cli.Command) {
cmd.Flags = append(table.WriterFlags(), cmd.Flags...)
}

func (b BuildHistory) Run(ctx *clicontext.CLIContext) error {
objs, err := ctx.List(types.BuildType)
if err != nil {
return err
}
writer := tables.NewBuild(ctx)
return writer.Write(objs)
}
7 changes: 0 additions & 7 deletions cli/cmd/builds/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,10 @@ import (
)

func Builds(app *cli.App) cli.Command {
ls := builder.Command(&History{},
"List Build History",
app.Name+" build history [OPTIONS]",
"")
build := builder.Command(&Build{},
"Build docker image using buildkitd",
app.Name+" build [OPTIONS] PATH",
"")
build.Subcommands = []cli.Command{
ls,
}
return build
}

Expand Down
25 changes: 0 additions & 25 deletions cli/cmd/builds/ls.go

This file was deleted.

4 changes: 3 additions & 1 deletion cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import (
"os"
"path/filepath"

"github.com/rancher/rio/cli/cmd/dashboard"
"github.com/rancher/rio/cli/cmd/buildhistory"

"github.com/docker/docker/pkg/reexec"
"github.com/rancher/rio/cli/cmd/attach"
"github.com/rancher/rio/cli/cmd/builds"
"github.com/rancher/rio/cli/cmd/config"
"github.com/rancher/rio/cli/cmd/dashboard"
"github.com/rancher/rio/cli/cmd/edit"
"github.com/rancher/rio/cli/cmd/endpoint"
"github.com/rancher/rio/cli/cmd/exec"
Expand Down Expand Up @@ -129,6 +130,7 @@ func main() {
""),

builds.Builds(app),
buildhistory.History(app),

config.NewCatCommand("", app),

Expand Down
6 changes: 5 additions & 1 deletion pkg/template/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/rancher/rio/pkg/template/gotemplate"
"github.com/rancher/wrangler/pkg/merr"
"github.com/rancher/wrangler/pkg/yaml"
"github.com/sirupsen/logrus"
)

type templateFile struct {
Expand Down Expand Up @@ -58,7 +59,10 @@ func (t *Template) RequiredEnv() ([]string, error) {

func (t *Template) readTemplateFile(content []byte) (*templateFile, error) {
templateFile := &templateFile{}
return templateFile, yaml.Unmarshal(content, templateFile)
if err := yaml.Unmarshal(content, templateFile); err != nil {
logrus.Debugf("Error unmarshalling template: %v", err)
}
return templateFile, nil
}

func (t *Template) Parse(answers AnswerCallback) ([]byte, error) {
Expand Down

0 comments on commit 7765776

Please sign in to comment.