-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathslug_builder_info.go
More file actions
29 lines (24 loc) · 898 Bytes
/
slug_builder_info.go
File metadata and controls
29 lines (24 loc) · 898 Bytes
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
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, 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", s3Endpoint, pushKey),
TarKey: tarKey,
TarURL: fmt.Sprintf("%s/git/%s", s3Endpoint, tarKey),
}
}