Esempio n. 1
0
func TestGetNameToNodeInfo(t *testing.T) {
	pipeline, err := parse.NewParser().ParsePipeline("../parse/testdata/basic")
	require.NoError(t, err)
	nodeInfos, err := getNameToNodeInfo(pipeline.NameToNode)
	require.NoError(t, err)
	require.Equal(t, []string{"bar-node"}, nodeInfos["baz-node-bar-in-bar-out-in"].Parents)
}
Esempio n. 2
0
func getDirPathAndPipeline(pipelineSource *pps.PipelineSource) (string, *pps.Pipeline, error) {
	if pipelineSource.GetGithubPipelineSource() != nil {
		dirPath, err := githubClone(pipelineSource.GetGithubPipelineSource())
		if err != nil {
			return "", nil, err
		}
		dirPath = filepath.Join(dirPath, pipelineSource.GetGithubPipelineSource().ContextDir)
		pipeline, err := parse.NewParser().ParsePipeline(dirPath)
		if err != nil {
			return "", nil, err
		}
		pipeline.PipelineSourceId = pipelineSource.Id
		return dirPath, pipeline, nil
	}
	return "", nil, fmt.Errorf("must specify pipeline source")
}