forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
builder.go
56 lines (46 loc) · 1.46 KB
/
builder.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package builder
import (
"github.com/spf13/cobra"
"github.com/openshift/origin/pkg/build/builder/cmd"
"github.com/openshift/origin/pkg/cmd/templates"
"github.com/openshift/origin/pkg/version"
)
const longCommandSTIDesc = `
Perform a Source-to-Image Build
This command executes a Source-to-Image build using arguments passed via the environment.
It expects to be run inside of a container.
`
// NewCommandSTIBuilder provides a CLI handler for STI build type
func NewCommandSTIBuilder(name string) *cobra.Command {
cmd := &cobra.Command{
Use: name,
Short: "Run an OpenShift Source-to-Images build",
Long: longCommandSTIDesc,
Run: func(c *cobra.Command, args []string) {
cmd.RunSTIBuild()
},
}
templates.UseMainTemplates(cmd)
cmd.AddCommand(version.NewVersionCommand(name))
return cmd
}
const longCommandDockerDesc = `
Perform a Docker Build
This command executes a Docker build using arguments passed via the environment.
It expects to be run inside of a container.
`
// NewCommandDockerBuilder provides a CLI handler for Docker build type
func NewCommandDockerBuilder(name string) *cobra.Command {
cmd := &cobra.Command{
Use: name,
Short: "Run an OpenShift Docker build",
Long: longCommandDockerDesc,
Run: func(c *cobra.Command, args []string) {
cmd.RunDockerBuild()
},
}
cmd.SetUsageTemplate(templates.MainUsageTemplate())
cmd.SetHelpTemplate(templates.MainHelpTemplate())
cmd.AddCommand(version.NewVersionCommand(name))
return cmd
}