Example #1
0
func newBuilder(c *cli.Context) builder.Builder {
	db, err := docker.NewBuilderFromEnv()
	if err != nil {
		must(err)
	}
	db.DryRun = c.Bool("dry")
	db.Image = c.String("builder.image")

	g := builder.NewGitHubClient(c.String("github.token"))

	var backend builder.Builder = builder.UpdateGitHubCommitStatus(db, g, fmt.Sprintf(logsURLTemplate, c.String("url")))

	if uri := c.String("stats"); uri != "" {
		u := urlParse(uri)

		switch u.Scheme {
		case "dogstatsd":
			c, err := statsd.New(u.Host)
			must(err)

			backend = datadog.WithStats(
				backend,
				c,
			)
		default:
			must(fmt.Errorf("Unknown stats backend: %v", u.Scheme))
		}
	}

	b := worker.NewBuilder(backend)
	b.Reporter = newReporter(c)

	return b
}
Example #2
0
func newDockerBuilder(t *testing.T) *docker.Builder {
	checkDocker(t)

	b, err := docker.NewBuilderFromEnv()
	if err != nil {
		t.Fatal(err)
	}
	return b
}
Example #3
0
func newConveyor(t *testing.T) *conveyor.Conveyor {
	b, err := docker.NewBuilderFromEnv()
	if err != nil {
		t.Fatal(err)
	}
	b.DryRun = true
	c := conveyor.New(b)
	return c
}