Skip to content

Commit

Permalink
Remove build from deploy flow
Browse files Browse the repository at this point in the history
  • Loading branch information
tejal29 committed Apr 22, 2019
1 parent c868dea commit 71b52b6
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion cmd/skaffold/app/cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ limitations under the License.
package cmd

import (
"context"
"io"

"github.com/GoogleContainerTools/skaffold/pkg/skaffold/build"
"github.com/pkg/errors"
"github.com/spf13/cobra"
)

Expand All @@ -31,11 +34,32 @@ func NewCmdDeploy(out io.Writer) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
// Same actions as `skaffold run`, but with pre-built images.
opts.Command = "deploy"
return run(out)
return runDeploy(out)
},
}
AddRunDevFlags(cmd)
AddRunDeployFlags(cmd)
cmd.Flags().StringSliceVar(&opts.PreBuiltImages, "images", nil, "A list of pre-built images to deploy")
return cmd
}

func runDeploy(out io.Writer) error {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
catchCtrlC(cancel)
runner, _, err := newRunner(opts)
if err != nil {
return errors.Wrap(err, "creating runner")
}
defer runner.RPCServerShutdown()

// TODO: This should be fixed with https://github.com/GoogleContainerTools/skaffold/issues/922#issuecomment-474710200
// where buildArtifacts will consume `skaffold build` output
buildArtifacts := []build.Artifact{}
if err := runner.Deploy(ctx, out, buildArtifacts); err != nil {
return err
}

runner.TailLogs(ctx, out, nil, buildArtifacts)
return nil
}

0 comments on commit 71b52b6

Please sign in to comment.