forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
builder.go
49 lines (40 loc) · 1.26 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
package builder
import (
"github.com/spf13/cobra"
"github.com/openshift/origin/pkg/build/builder/cmd"
"github.com/openshift/origin/pkg/version"
)
const (
stiBuilderLong = `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.`
dockerBuilderLong = `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.`
)
// 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: stiBuilderLong,
Run: func(c *cobra.Command, args []string) {
cmd.RunSTIBuild()
},
}
cmd.AddCommand(version.NewVersionCommand(name))
return cmd
}
// 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: dockerBuilderLong,
Run: func(c *cobra.Command, args []string) {
cmd.RunDockerBuild()
},
}
cmd.AddCommand(version.NewVersionCommand(name))
return cmd
}