Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions pkg/cmd/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,23 @@ func NewCommandCLI(name, fullName string) *cobra.Command {
cmds.SetUsageTemplate(templates.CliUsageTemplate())
cmds.SetHelpTemplate(templates.CliHelpTemplate())

cmds.AddCommand(cmd.NewCmdNewApplication(f, out))
cmds.AddCommand(cmd.NewCmdStartBuild(f, out))
cmds.AddCommand(cmd.NewCmdCancelBuild(f, out))
cmds.AddCommand(cmd.NewCmdBuildLogs(f, out))
cmds.AddCommand(cmd.NewCmdRollback(name, "rollback", f, out))
cmds.AddCommand(cmd.NewCmdNewApplication(fullName, f, out))
cmds.AddCommand(cmd.NewCmdStartBuild(fullName, f, out))
cmds.AddCommand(cmd.NewCmdCancelBuild(fullName, f, out))
cmds.AddCommand(cmd.NewCmdBuildLogs(fullName, f, out))
cmds.AddCommand(cmd.NewCmdRollback(fullName, f, out))
cmds.AddCommand(cmd.NewCmdGet(fullName, f, out))
cmds.AddCommand(f.NewCmdDescribe(out))
// Deprecate 'osc apply' with 'osc create' command.
cmds.AddCommand(applyToCreate(cmd.NewCmdCreate(fullName, f, out)))
cmds.AddCommand(cmd.NewCmdProcess(f, out))
cmds.AddCommand(cmd.NewCmdProcess(fullName, f, out))
cmds.AddCommand(cmd.NewCmdUpdate(fullName, f, out))
cmds.AddCommand(cmd.NewCmdDelete(fullName, f, out))
cmds.AddCommand(cmd.NewCmdLog(fullName, f, out))
cmds.AddCommand(f.NewCmdProxy(out))
cmds.AddCommand(kubecmd.NewCmdNamespace(out))
cmds.AddCommand(cmd.NewCmdOptions(f, out))
cmds.AddCommand(version.NewVersionCommand(name))
cmds.AddCommand(version.NewVersionCommand(fullName))

return cmds
}
Expand Down
17 changes: 10 additions & 7 deletions pkg/cmd/cli/cmd/buildlogs.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmd

import (
"fmt"
"io"

"github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/cmd/util"
Expand All @@ -9,19 +10,21 @@ import (
"github.com/openshift/origin/pkg/cmd/util/clientcmd"
)

func NewCmdBuildLogs(f *clientcmd.Factory, out io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "build-logs <build>",
Short: "Show container logs from the build container",
Long: `Retrieve logs from the containers where the build occured
const buildLogsLongDesc = `Retrieve logs from the containers where the build occured

NOTE: This command may be moved in the future.

Examples:

# Stream logs from container to stdout
$ osc build-logs 566bed879d2d
`,
$ %[1]s build-logs 566bed879d2d
`

func NewCmdBuildLogs(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "build-logs <build>",
Short: "Show container logs from the build container",
Long: fmt.Sprintf(buildLogsLongDesc, fullName),
Run: func(cmd *cobra.Command, args []string) {
if len(args) != 1 {
usageError(cmd, "<build> is a required argument")
Expand Down
28 changes: 15 additions & 13 deletions pkg/cmd/cli/cmd/cancelbuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,30 @@ import (
"github.com/openshift/origin/pkg/cmd/util/clientcmd"
)

// NewCmdCancelBuild manages a build cancelling event.
// To cancel a build its name has to be specified, and two options
// are available: displaying logs and restarting.
func NewCmdCancelBuild(f *clientcmd.Factory, out io.Writer) *cobra.Command {

cmd := &cobra.Command{
Use: "cancel-build <build>",
Short: "Cancel a pending or running build.",
Long: `
const cancelBuildLongDesc = `
Cancels a pending or running build.

Examples:

# Cancel the build with the given name
$ osc cancel-build 1da32cvq
$ %[1]s cancel-build 1da32cvq

# Cancel the named build and print the build logs
$ osc cancel-build 1da32cvq --dump-logs
$ %[1]s cancel-build 1da32cvq --dump-logs

# Cancel the named build and create a new one with the same parameters
$ osc cancel-build 1da32cvq --restart
`,
$ %[1]s cancel-build 1da32cvq --restart
`

// NewCmdCancelBuild manages a build cancelling event.
// To cancel a build its name has to be specified, and two options
// are available: displaying logs and restarting.
func NewCmdCancelBuild(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {

cmd := &cobra.Command{
Use: "cancel-build <build>",
Short: "Cancel a pending or running build.",
Long: fmt.Sprintf(cancelBuildLongDesc, fullName),
Run: func(cmd *cobra.Command, args []string) {

if len(args) == 0 || len(args[0]) == 0 {
Expand Down
12 changes: 6 additions & 6 deletions pkg/cmd/cli/cmd/newapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type usage interface {
UsageError(commandName string) string
}

const longNewAppDescription = `
const newAppLongDesc = `
Create a new application in OpenShift by specifying source code, templates, and/or images.

This command will try to build up the components of an application using images or code
Expand All @@ -36,28 +36,28 @@ configuration, and a service will be hookup up to the first public port of the a
Examples:

# Try to create an application based on the source code in the current directory
$ osc new-app .
$ %[1]s new-app .

$ Use the public Docker Hub MySQL image to create an app
$ osc new-app mysql
$ %[1]s new-app mysql

# Use a MySQL image in a private registry to create an app
$ osc new-app myregistry.com/mycompany/mysql
$ %[1]s new-app myregistry.com/mycompany/mysql

If you specify source code, you may need to run a build with 'start-build' after the
application is created.

ALPHA: This command is under active development - feedback is appreciated.
`

func NewCmdNewApplication(f *clientcmd.Factory, out io.Writer) *cobra.Command {
func NewCmdNewApplication(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
config := newcmd.NewAppConfig()

helper := dockerutil.NewHelper()
cmd := &cobra.Command{
Use: "new-app <components> [--code=<path|url>]",
Short: "Create a new application",
Long: longNewAppDescription,
Long: fmt.Sprintf(newAppLongDesc, fullName),

Run: func(c *cobra.Command, args []string) {
namespace, err := f.DefaultNamespace(c)
Expand Down
24 changes: 13 additions & 11 deletions pkg/cmd/cli/cmd/process.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"errors"
"fmt"
"io"
"strings"

Expand Down Expand Up @@ -36,23 +36,25 @@ func injectUserVars(cmd *cobra.Command, t *api.Template) {
}
}

// NewCmdProcess returns a 'process' command
func NewCmdProcess(f *clientcmd.Factory, out io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "process -f filename",
Short: "Process template into list of resources",
Long: `Process template into a list of resources specified in filename or stdin
const processLongDesc = `Process template into a list of resources specified in filename or stdin

JSON and YAML formats are accepted.

Examples:

# Convert template.json into resource list
$ osc process -f template.json
$ %[1]s process -f template.json

# Convert template.json into resource list
$ cat template.json | osc process -f -
`,
$ cat template.json | %[1]s process -f -
`

// NewCmdProcess returns a 'process' command
func NewCmdProcess(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "process -f filename",
Short: "Process template into list of resources",
Long: fmt.Sprintf(processLongDesc, fullName),
Run: func(cmd *cobra.Command, args []string) {
filename := cmdutil.GetFlagString(cmd, "filename")
if len(filename) == 0 {
Expand All @@ -74,7 +76,7 @@ Examples:

templateObj, ok := obj.(*api.Template)
if !ok {
checkErr(errors.New("Unable to the convert input to the Template"))
checkErr(fmt.Errorf("cannot convert input to Template"))
}

client, _, err := f.Clients(cmd)
Expand Down
12 changes: 6 additions & 6 deletions pkg/cmd/cli/cmd/rollback.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,26 @@ will be.
Examples:

# Perform a rollback
$ %[1]s %[2]s deployment-1
$ %[1]s rollback deployment-1

# See what the rollback will look like, but don't perform the rollback
$ %[1]s %[2]s deployment-1 --dry-run
$ %[1]s rollback deployment-1 --dry-run

# Perform the rollback manually by piping the JSON of the new config back to %[1]s
$ %[1]s %[2]s deployment-1 --output=json | %[1]s update deploymentConfigs deployment -f -
$ %[1]s rollback deployment-1 --output=json | %[1]s update deploymentConfigs deployment -f -
`

func NewCmdRollback(parentName string, name string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
func NewCmdRollback(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
rollback := &deployapi.DeploymentConfigRollback{
Spec: deployapi.DeploymentConfigRollbackSpec{
IncludeTemplate: true,
},
}

cmd := &cobra.Command{
Use: fmt.Sprintf("%s <from-deployment>", name),
Use: "rollback <from-deployment>",
Short: "Revert part of an application back to a previous deployment.",
Long: fmt.Sprintf(rollbackLongDesc, parentName, name),
Long: fmt.Sprintf(rollbackLongDesc, fullName),
Run: func(cmd *cobra.Command, args []string) {
if len(args) == 0 || len(args[0]) == 0 {
usageError(cmd, "A deployment name is required.")
Expand Down
20 changes: 11 additions & 9 deletions pkg/cmd/cli/cmd/startbuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,28 @@ import (
"github.com/openshift/origin/pkg/cmd/util/clientcmd"
)

func NewCmdStartBuild(f *clientcmd.Factory, out io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "start-build (<buildConfig>|--from-build=<build>)",
Short: "Starts a new build from existing build or buildConfig",
Long: `
const startBuildLongDesc = `
Manually starts build from existing build or buildConfig

NOTE: This command is experimental and is subject to change in the future.

Examples:

# Starts build from build configuration matching the name "3bd2ug53b"
$ osc start-build 3bd2ug53b
$ %[1]s start-build 3bd2ug53b

# Starts build from build matching the name "3bd2ug53b"
$ osc start-build --from-build=3bd2ug53b
$ %[1]s start-build --from-build=3bd2ug53b

# Starts build from build configuration matching the name "3bd2ug53b" and watches the logs until the build completes or fails
$ osc start-build 3bd2ug53b --follow
`,
$ %[1]s start-build 3bd2ug53b --follow
`

func NewCmdStartBuild(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "start-build (<buildConfig>|--from-build=<build>)",
Short: "Starts a new build from existing build or buildConfig",
Long: fmt.Sprintf(startBuildLongDesc, fullName),
Run: func(cmd *cobra.Command, args []string) {
buildName := cmdutil.GetFlagString(cmd, "from-build")
follow := cmdutil.GetFlagBool(cmd, "follow")
Expand Down