-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathslug_builder_info.go
More file actions
43 lines (34 loc) · 1.55 KB
/
slug_builder_info.go
File metadata and controls
43 lines (34 loc) · 1.55 KB
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
38
39
40
41
42
43
package gitreceive
import (
"fmt"
)
const (
slugTGZName = "slug.tgz"
)
// SlugBuilderInfo contains all of the object storage related information needed to pass to a
// slug builder.
type SlugBuilderInfo struct {
pushKey string
tarKey string
}
// NewSlugBuilderInfo creates and populates a new SlugBuilderInfo based on the given data
func NewSlugBuilderInfo(slugName string) *SlugBuilderInfo {
tarKey := fmt.Sprintf("home/%s/tar", slugName)
// this is where workflow tells slugrunner to download the slug from, so we have to tell slugbuilder to upload it to here
pushKey := fmt.Sprintf("home/%s/push", slugName)
return &SlugBuilderInfo{
pushKey: pushKey,
tarKey: tarKey,
}
}
// PushKey returns the object storage key that the slug builder will store the slug in.
// The returned value only contains the path to the folder, not including the final filename.
func (s SlugBuilderInfo) PushKey() string { return s.pushKey }
// TarKey returns the object storage key from which the slug builder will download for the tarball
// (from which it uses to build the slug). The returned value only contains the path to the
// folder, not including the final filename.
func (s SlugBuilderInfo) TarKey() string { return s.tarKey }
// AbsoluteSlugObjectKey returns the PushKey plus the final filename of the slug.
func (s SlugBuilderInfo) AbsoluteSlugObjectKey() string { return s.PushKey() + "/" + slugTGZName }
// AbsoluteProcfileKey returns the PushKey plus the standard procfile name.
func (s SlugBuilderInfo) AbsoluteProcfileKey() string { return s.PushKey() + "/Procfile" }