Skip to content

Commit 7a10839

Browse files
author
Aaron Schlesinger
committed
fix(*): improve on build errors with AWS SDK
1 parent a8c14ba commit 7a10839

5 files changed

Lines changed: 11 additions & 5 deletions

File tree

pkg/gitreceive/build.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"strings"
1111
"time"
1212

13+
"github.com/aws/aws-sdk-go/service/s3"
1314
"github.com/deis/builder/pkg"
1415
"github.com/deis/builder/pkg/gitreceive/log"
1516
"github.com/pborman/uuid"
@@ -51,7 +52,7 @@ func run(cmd *exec.Cmd) error {
5152
return cmd.Run()
5253
}
5354

54-
func build(conf *Config, s3Client *s3.Client, builderKey, gitSha string) error {
55+
func build(conf *Config, s3Client *s3.S3, builderKey, gitSha string) error {
5556
repo := conf.Repository
5657
if len(gitSha) <= shortShaIdx {
5758
return errGitShaTooShort{sha: gitSha}

pkg/gitreceive/storage/bucket.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
package storage
22

3-
func CreateBucket(s3Client *s3.Client, bucketName string) error {
3+
import (
4+
"github.com/aws/aws-sdk-go/aws"
5+
"github.com/aws/aws-sdk-go/service/s3"
6+
)
7+
8+
func CreateBucket(s3Client *s3.S3, bucketName string) error {
49
_, err := s3Client.CreateBucket(&s3.CreateBucketInput{
510
Bucket: aws.String(bucketName),
611
})

pkg/gitreceive/storage/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func GetClient() (*s3.S3, error) {
1212
if err != nil {
1313
return nil, err
1414
}
15-
awsCfg.Endpoint = endpt
15+
awsCfg.Endpoint = aws.String(endpt)
1616
creds, err := getCreds()
1717
if err != nil {
1818
return nil, err

pkg/gitreceive/storage/endpoint.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ func getEndpoint() (string, error) {
3232
} else if oHost != "" && oPort != "" {
3333
return fmt.Sprintf("https://%s:%s", oHost, oPort), nil
3434
} else {
35-
return nil, errNoStorageConfig
35+
return "", errNoStorageConfig
3636
}
3737
}

pkg/gitreceive/storage/exists.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ func ObjectExists(s3Client *s3.S3, bucket, objName string) bool {
1111
Bucket: aws.String(bucket),
1212
Key: aws.String(objName),
1313
}
14-
resp, err := svc.HeadObject(in)
14+
resp, err := s3Client.HeadObject(in)
1515
if err != nil {
1616
return false
1717
}

0 commit comments

Comments
 (0)