Exemplo n.º 1
0
func (command *SetPipelineCommand) Execute(args []string) error {
	configPath := command.Config
	templateVariablesFiles := command.VarsFrom
	pipelineName := command.Pipeline

	templateVariables := template.Variables{}
	for _, v := range command.Var {
		templateVariables[v.Name] = v.Value
	}

	connection, err := rc.TargetConnection(Fly.Target)
	if err != nil {
		log.Fatalln(err)
		return nil
	}
	client := concourse.NewClient(connection)

	webRequestGenerator := rata.NewRequestGenerator(connection.URL(), web.Routes)

	atcConfig := setpipelinehelpers.ATCConfig{
		PipelineName:        pipelineName,
		WebRequestGenerator: webRequestGenerator,
		Client:              client,
		SkipInteraction:     command.SkipInteractive,
	}

	atcConfig.Set(configPath, templateVariables, templateVariablesFiles)
	return nil
}
Exemplo n.º 2
0
func (command *SetPipelineCommand) Execute(args []string) error {
	configPath := command.Config
	templateVariablesFiles := command.VarsFrom
	pipelineName := command.Pipeline

	templateVariables := template.Variables{}
	for _, v := range command.Var {
		templateVariables[v.Name] = v.Value
	}

	client, err := rc.TargetClient(Fly.Target)
	if err != nil {
		return err
	}
	err = rc.ValidateClient(client, Fly.Target)
	if err != nil {
		return err
	}

	webRequestGenerator := rata.NewRequestGenerator(client.URL(), web.Routes)

	atcConfig := setpipelinehelpers.ATCConfig{
		PipelineName:        pipelineName,
		WebRequestGenerator: webRequestGenerator,
		Client:              client,
		SkipInteraction:     command.SkipInteractive,
	}

	return atcConfig.Set(configPath, templateVariables, templateVariablesFiles)
}