Exemplo n.º 1
0
func sanityCheckBuild(cmd *c.Command, args []string) {
	dev.MustFindCrowbar()
	paths := make([]string, 0, 0)
	for _, bc := range dev.BarclampsInBuild(dev.CurrentBuild()) {
		paths = append(paths, filepath.Join(bc.Repo.Path(), "crowbar.yml"))
	}
	buildutils.SanityCheckMetadata(paths)
}
Exemplo n.º 2
0
func switchBuild(cmd *c.Command, args []string) {
	dev.MustFindCrowbar()
	if ok, _ := dev.IsClean(); !ok {
		log.Fatalln("Crowbar is not clean, cannot switch builds.")
	}
	rels := dev.Releases()
	current := dev.CurrentBuild()
	var target dev.Build
	found := false
	switch len(args) {
	case 0:
		target, found = current, true
	case 1:
		// Were we passed a known release?
		rel, foundRel := rels[args[0]]
		if foundRel {
			for _, build := range []string{current.Name(), "master"} {
				target, found = rel.Builds()[build]
				if found {
					break
				}
			}
		} else {
			target, found = dev.Builds()[args[0]]
		}
	default:
		log.Fatalf("switch takes 0 or 1 argument.")
	}
	if !found {
		log.Fatalf("%s is not anything we can switch to!")
	}
	ok, tokens := dev.Switch(target)
	for _, tok := range tokens {
		if tok.Results != nil {
			log.Printf("%s: %v\n", tok.Name, tok.Results)
		}
	}
	if ok {
		log.Printf("Switched to %s\n", target.FullName())
		os.Exit(0)
	}
	log.Printf("Failed to switch to %s!\n", target.FullName())
	ok, _ = dev.Switch(current)
	os.Exit(1)
}
Exemplo n.º 3
0
func barclampsInBuild(cmd *c.Command, args []string) {
	dev.MustFindCrowbar()
	res := make([]string, 0, 20)
	var build dev.Build
	var found bool
	if len(args) == 0 {
		build = dev.CurrentBuild()
	} else if len(args) == 1 {
		builds := dev.Builds()
		build, found = builds[args[0]]
		if !found {
			log.Fatalln("No such build %s", args[0])
		}
	}
	for name := range dev.BarclampsInBuild(build) {
		res = append(res, name)
	}
	sort.Strings(res)
	for _, name := range res {
		fmt.Println(name)
	}
}
Exemplo n.º 4
0
func showBuild(cmd *c.Command, args []string) {
	dev.MustFindCrowbar()
	fmt.Println(dev.CurrentBuild().FullName())
}