@@ -10,10 +10,10 @@ 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/deis/builder/pkg/gitreceive/storage"
16- "github.com/mitchellh/goamz/s3"
1717 "github.com/pborman/uuid"
1818 "gopkg.in/yaml.v2"
1919)
@@ -72,11 +72,11 @@ func build(conf *Config, s3Client *s3.S3, builderKey, gitSha string) error {
7272 tmpDir := os .TempDir ()
7373
7474 tarObjKey := fmt .Sprintf ("home/%s/tar" , slugName )
75- tarURL := fmt .Sprintf ("%s/git/%s" , s3Client .S3Endpoint , tarObjKey )
75+ tarURL := fmt .Sprintf ("%s/git/%s" , s3Client .Endpoint , tarObjKey )
7676
7777 // this is where workflow tells slugrunner to download the slug from, so we have to tell slugbuilder to upload it to here
7878 pushObjKey := fmt .Sprintf ("home/%s/push" , fmt .Sprintf ("%s:git-%s" , appName , gitSha ))
79- pushURL := fmt .Sprintf ("%s/%s" , s3Client .S3Endpoint , pushObjKey )
79+ pushURL := fmt .Sprintf ("%s/%s" , s3Client .Endpoint , pushObjKey )
8080
8181 // Get the application config from the controller, so we can check for a custom buildpack URL
8282 appConf , err := getAppConfig (conf , builderKey , conf .Username , appName )
@@ -125,23 +125,22 @@ func build(conf *Config, s3Client *s3.S3, builderKey, gitSha string) error {
125125 }
126126
127127 var srcManifest string
128- if creds == nil {
129- // both key and secret are missing, proceed with no credentials
130- if usingDockerfile {
131- srcManifest = "/etc/deis-dockerbuilder-no-creds.yaml"
132- } else {
133- srcManifest = "/etc/deis-slugbuilder-no-creds.yaml"
134- }
135- } else if err == nil {
128+
129+ creds := storage .CredsOK ()
130+ if creds {
136131 // both key and secret are in place, so proceed with credentials
137132 if usingDockerfile {
138133 srcManifest = "/etc/deis-dockerbuilder.yaml"
139134 } else {
140135 srcManifest = "/etc/deis-slugbuilder.yaml"
141136 }
142- } else if err != nil {
143- // unexpected error, fail
144- return fmt .Errorf ("unexpected error (%s)" , err )
137+ } else {
138+ // both key and secret are missing, proceed with no credentials
139+ if usingDockerfile {
140+ srcManifest = "/etc/deis-dockerbuilder-no-creds.yaml"
141+ } else {
142+ srcManifest = "/etc/deis-slugbuilder-no-creds.yaml"
143+ }
145144 }
146145
147146 fileBytes , err := ioutil .ReadFile (srcManifest )
@@ -181,7 +180,7 @@ func build(conf *Config, s3Client *s3.S3, builderKey, gitSha string) error {
181180 return fmt .Errorf ("opening %s for read (%s)" , appTgz , err )
182181 }
183182 if err := storage .UploadObject (s3Client , bucketName , tarObjKey , appTgzReader ); err != nil {
184- return fmt .Errorf ("uploading %s to %s/%s (%s )" , absAppTgz , bucketName , tarObjKey , err )
183+ return fmt .Errorf ("uploading %s to %s/%s (%v )" , absAppTgz , bucketName , tarObjKey , err )
185184 }
186185
187186 log .Info ("Starting build... but first, coffee!" )
0 commit comments