-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathslug_builder_info.go
More file actions
34 lines (28 loc) · 1.18 KB
/
slug_builder_info.go
File metadata and controls
34 lines (28 loc) · 1.18 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
package storage
import (
"fmt"
"github.com/deis/builder/pkg/gitreceive/git"
)
// SlugBuilderInfo contains all of the object storage related information needed to pass to a slug builder
type SlugBuilderInfo struct {
pushKey string
pushURL string
tarKey string
tarURL string
}
// NewSlugBuilderInfo creates and populates a new SlugBuilderInfo based on the given data
func NewSlugBuilderInfo(s3Endpoint *Endpoint, bucket, appName, slugName string, gitSha *git.SHA) *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:git-%s/push", appName, gitSha.Short())
return &SlugBuilderInfo{
pushKey: pushKey,
pushURL: fmt.Sprintf("%s/%s/%s", s3Endpoint.FullURL(), bucket, pushKey),
tarKey: tarKey,
tarURL: fmt.Sprintf("%s/%s/%s", s3Endpoint.FullURL(), bucket, tarKey),
}
}
func (s SlugBuilderInfo) PushKey() string { return s.pushKey }
func (s SlugBuilderInfo) PushURL() string { return s.pushURL }
func (s SlugBuilderInfo) TarKey() string { return s.tarKey }
func (s SlugBuilderInfo) TarURL() string { return s.tarURL }