func newConveyor(t testing.TB) *Conveyor { db := sqlx.MustConnect("postgres", databaseURL) if err := core.Reset(db); err != nil { t.Fatal(err) } c := core.New(db) c.BuildQueue = core.NewBuildQueue(100) c.Logger = logs.Discard ch := make(chan core.BuildContext) c.BuildQueue.Subscribe(ch) w := worker.New(c, worker.Options{ Builder: builder.BuilderFunc(func(ctx context.Context, w io.Writer, options builder.BuildOptions) (string, error) { io.WriteString(w, "Pulling base image\n") return "remind101/acme-inc:1234", nil }), BuildRequests: ch, }) go w.Start() return &Conveyor{ Conveyor: c, worker: w, } }
func newConveyor(c *cli.Context) *conveyor.Conveyor { cy := conveyor.New(newDB(c)) cy.BuildQueue = newBuildQueue(c) cy.Logger = newLogger(c) cy.GitHub = conveyor.NewGitHub(newGitHubClient(c)) cy.Hook = conveyor.NewHook(c.String("url"), c.String("github.secret")) return cy }
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 }
func newConveyor(c *cli.Context) *conveyor.Conveyor { cy := conveyor.New(newDB(c)) cy.BuildQueue = newBuildQueue(c) cy.Logger = newLogger(c) return cy }