Exemple #1
0
func GenerateLocalInputs(client concourse.Client, inputMappings []flaghelpers.InputPairFlag) (map[string]Input, error) {
	kvMap := map[string]Input{}

	for _, i := range inputMappings {
		inputName := i.Name
		absPath := i.Path

		pipe, err := client.CreatePipe()
		if err != nil {
			return nil, err
		}

		kvMap[inputName] = Input{
			Name: inputName,
			Path: absPath,
			Pipe: pipe,
		}
	}

	return kvMap, nil
}
Exemple #2
0
func DetermineOutputs(
	client concourse.Client,
	taskOutputs []atc.TaskOutputConfig,
	outputMappings []flaghelpers.OutputPairFlag,
) ([]Output, error) {

	outputs := []Output{}

	for _, i := range outputMappings {
		outputName := i.Name

		notInConfig := true
		for _, configOutput := range taskOutputs {
			if configOutput.Name == outputName {
				notInConfig = false
			}
		}
		if notInConfig {
			return nil, fmt.Errorf("unknown output '%s'", outputName)
		}

		absPath, err := filepath.Abs(i.Path)
		if err != nil {
			return nil, err
		}

		pipe, err := client.CreatePipe()
		if err != nil {
			return nil, err
		}

		outputs = append(outputs, Output{
			Name: outputName,
			Path: absPath,
			Pipe: pipe,
		})
	}

	return outputs, nil
}