func main() { conf := descend.Descend{ Host: "localhost", Port: 443, } flags, err := config.LoadFlags("descend", &conf) if err != nil { panic(err) } flags.Parse(os.Args[1:]) Missing(flags, conf.CaCert, conf.Cert, conf.Key) client, err := descend.NewClient(conf.CaCert, conf.Cert, conf.Key) if err != nil { panic(err) } for _, changesPath := range flags.Args() { changes, err := control.ParseChangesFile(changesPath) if err != nil { panic(err) } fmt.Printf("Pushing %s\n", changesPath) err = descend.DoPutChanges( client, changes, fmt.Sprintf("%s:%d", conf.Host, conf.Port), conf.Archive, ) if err != nil { panic(err) } } }
func UploadChanges(conf MinionConfig, job Build, changesPath string) error { client, err := descend.NewClient(conf.CaCert, conf.Cert, conf.Key) if err != nil { return err } changes, err := control.ParseChangesFile(changesPath) if err != nil { return err } err = descend.DoPutChanges( client, changes, fmt.Sprintf("%s:%d", job.Upload.Host, job.Upload.Port), job.Upload.Archive, ) return err }