-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.go
37 lines (30 loc) · 924 Bytes
/
build.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package sidekiq
import (
"fmt"
"github.com/paketo-buildpacks/packit"
"github.com/paketo-buildpacks/packit/scribe"
)
func Build(logger scribe.Logger) packit.BuildFunc {
return func(context packit.BuildContext) (packit.BuildResult, error) {
logger.Title("%s %s", context.BuildpackInfo.Name, context.BuildpackInfo.Version)
sidekiqExec := NewSidekiqExecutable()
exec, err := sidekiqExec.Find(context)
if err != nil {
return packit.BuildResult{}, fmt.Errorf("failed to find sidekiq executable: %w", err)
}
command := fmt.Sprintf("bundle exec %s -t ${timeout:-60} -c ${threads:-5} ${additional_args}", exec)
logger.Process("Assigning launch processes")
logger.Subprocess("sidekiq: %s", command)
logger.Break()
return packit.BuildResult{
Launch: packit.LaunchMetadata{
Processes: []packit.Process{
{
Type: "sidekiq",
Command: command,
},
},
},
}, nil
}
}