func (b *BuildPipelineCpp) CopyBinary(p *gaia.CreatePipeline) error {
	src := filepath.Join(p.Pipeline.Repo.LocalDest, cppFinalBinaryName)
	dest := filepath.Join(gaia.Cfg.PipelinePath, pipelinehelper.AppendTypeToName(p.Pipeline.Name, p.Pipeline.Type))
	if err := filehelper.CopyFileContents(src, dest); err != nil {
		return err
	}
	return os.Chmod(dest, gaia.ExecutablePermission)
}
CopyBinary copies the final compiled binary to the
destination folder.
package pipeline
import (
	"os"
	"os/exec"
	"path/filepath"
	"strings"
	"time"
	"github.com/gaia-pipeline/gaia/helper/filehelper"
	"github.com/gaia-pipeline/gaia/helper/pipelinehelper"
	"github.com/gaia-pipeline/gaia"
	"github.com/gaia-pipeline/gaia/services"
	"github.com/gofrs/uuid"
)
const (
	cppBinaryName      = "make"
	cppFinalBinaryName = "pipeline.out"
)
type BuildPipelineCpp struct {
	Type gaia.PipelineType
}
func (b *BuildPipelineCpp) PrepareEnvironment(p *gaia.CreatePipeline) error {
	v4, err := uuid.NewV4()
	if err != nil {
		return err
	}
	uniqueName := uuid.Must(v4, nil)
	cloneFolder := filepath.Join(gaia.Cfg.HomePath, gaia.TmpFolder, gaia.TmpCppFolder, gaia.SrcFolder, uniqueName.String())
	err = os.MkdirAll(cloneFolder, 0700)
	if err != nil {
		return err
	}
	if p.Pipeline.Repo == nil {
		p.Pipeline.Repo = &gaia.GitRepo{}
	}
	p.Pipeline.Repo.LocalDest = cloneFolder
	p.Pipeline.UUID = uniqueName.String()
	return nil
}
func (b *BuildPipelineCpp) ExecuteBuild(p *gaia.CreatePipeline) error {
	path, err := exec.LookPath(cppBinaryName)
	if err != nil {
		gaia.Cfg.Logger.Debug("cannot find c++ binary executable", "error", err.Error())
		return err
	}
	args := []string{}
	localDest := ""
	if p.Pipeline.Repo != nil {
		localDest = p.Pipeline.Repo.LocalDest
	}
	output, err := executeCmd(path, args, os.Environ(), localDest)
	p.Output = string(output)
	if err != nil {
		gaia.Cfg.Logger.Debug("cannot build pipeline", "error", err.Error(), "output", string(output))
		return err
	}
	p.Pipeline.ExecPath = filepath.Join(localDest, cppFinalBinaryName)
	return nil
}