func (a *apiServer) StartPipelineRun(ctx context.Context, startPipelineRunRequest *pps.StartPipelineRunRequest) (*pps.StartPipelineRunResponse, error) { dockerHost := os.Getenv("DOCKER_HOST") if dockerHost == "" { dockerHost = "unix:///var/run/docker.sock" } containerClient, err := container.NewDockerClient( container.DockerClientOptions{ Host: dockerHost, }, ) if err != nil { return nil, err } runner := run.NewRunner( source.NewSourcer(), graph.NewGrapher(), containerClient, a.storeClient, a.timer, ) runID, err := runner.Start(startPipelineRunRequest.PipelineSource) if err != nil { return nil, err } return &pps.StartPipelineRunResponse{ PipelineRunId: runID, }, nil }
func (a *apiServer) GetPipeline(ctx context.Context, getPipelineRequest *pps.GetPipelineRequest) (*pps.GetPipelineResponse, error) { _, pipeline, err := source.NewSourcer().GetDirPathAndPipeline(getPipelineRequest.PipelineSource) if err != nil { return nil, err } return &pps.GetPipelineResponse{ Pipeline: pipeline, }, nil }
func (a *apiServer) CreateAndGetPipeline(ctx context.Context, request *pps.CreateAndGetPipelineRequest) (*pps.Pipeline, error) { pipelineSource, err := a.storeClient.GetPipelineSource(request.PipelineSourceId) if err != nil { return nil, err } _, pipeline, err := source.NewSourcer().GetDirPathAndPipeline(pipelineSource) if err != nil { return nil, err } pipeline.Id = strings.Replace(uuid.NewV4().String(), "-", "", -1) if err := a.storeClient.CreatePipeline(pipeline); err != nil { return nil, err } return pipeline, nil }
func (a *apiServer) StartPipelineRun(ctx context.Context, startPipelineRunRequest *pps.StartPipelineRunRequest) (*pps.StartPipelineRunResponse, error) { runner := run.NewRunner( source.NewSourcer(), graph.NewGrapher(), a.containerClient, a.storeClient, a.timer, ) runID, err := runner.Start(startPipelineRunRequest.PipelineSource) if err != nil { return nil, err } return &pps.StartPipelineRunResponse{ PipelineRunId: runID, }, nil }