Remove StartBinaryBuild
Removes StartBinaryBuild function as it is no longer used.
@@ -2,7 +2,6 @@ package occlient
import (
"bytes"
- "compress/gzip"
"encoding/json"
"fmt"
"io"
@@ -10,7 +9,6 @@ import (
"net/url"
"os"
"os/exec"
- "path/filepath"
"strconv"
"strings"
"time"
@@ -19,8 +17,6 @@ import (
"github.com/fatih/color"
dockerapiv10 "github.com/openshift/api/image/docker10"
- "github.com/openshift/source-to-image/pkg/tar"
- s2ifs "github.com/openshift/source-to-image/pkg/util/fs"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
@@ -885,65 +881,6 @@ func (c *Client) GetLatestBuildName(buildConfigName string) (string, error) {
return fmt.Sprintf("%s-%d", buildConfigName, buildConfig.Status.LastVersion), nil
}
-// StartBinaryBuild starts new build and streams dir as source for build
-// asFile indicates a build will start with a single file specified in the path otherwise it assumes path is a directory
-func (c *Client) StartBinaryBuild(name string, path string, asFile bool) error {
- var r io.Reader
-
- buildRequest := buildv1.BinaryBuildRequestOptions{
- ObjectMeta: metav1.ObjectMeta{
- Name: name,
- },
- }
-
- if !asFile {
- pr, pw := io.Pipe()
- go func() {
- w := gzip.NewWriter(pw)
- if err := tar.New(s2ifs.NewFileSystem()).CreateTarStream(path, false, w); err != nil {
- pw.CloseWithError(err)
- } else {
- w.Close()
- pw.CloseWithError(io.EOF)
- }
- }()
- r = pr
- } else {
- f, err := os.Open(path)
- if err != nil {
- return err
- }
- defer f.Close()
- r = f
- buildRequest.AsFile = filepath.Base(path)
- }
-
- result := &buildv1.Build{}
- // this should be buildClient.BuildConfigs(namespace).Instantiate
- // but there is no way to pass data using that call.
- err := c.buildClient.RESTClient().Post().
- Namespace(c.namespace).
- Resource("buildconfigs").
- Name(name).
- SubResource("instantiatebinary").
- Body(r).
- VersionedParams(&buildRequest, buildschema.ParameterCodec).
- Do().
- Into(result)
-
- if err != nil {
- return errors.Wrapf(err, "unable to push binary build to OpenShift API for %s", name)
- }
- log.Debugf("Build %s from %s directory triggered.", name, path)
-
- err = c.FollowBuildLog(result.Name)
- if err != nil {
- return errors.Wrapf(err, "unable to follow build log for %s", name)
- }
-
- return nil
-}
-
// StartBuild starts new build as it is, returns name of the build stat was started
func (c *Client) StartBuild(name string) (string, error) {
buildRequest := buildv1.BuildRequest{
