@@ -54,11 +54,14 @@ func build(conf *Config, s3Client *s3.S3, kubeClient *client.Client, builderKey,
5454 buildDir := filepath .Join (repoDir , "build" )
5555
5656 slugName := fmt .Sprintf ("%s:git-%s" , appName , gitSha .Short ())
57- imageName := strings .Replace (slugName , ":" , "-" , - 1 )
5857 if err := os .MkdirAll (buildDir , os .ModeDir ); err != nil {
5958 return fmt .Errorf ("making the build directory %s (%s)" , buildDir , err )
6059 }
61- tmpDir := os .TempDir ()
60+
61+ tmpDir , err := ioutil .TempDir (buildDir , "tmp" )
62+ if err != nil {
63+ return fmt .Errorf ("unable to create tmpdir %s (%s)" , buildDir , err )
64+ }
6265
6366 slugBuilderInfo := storage .NewSlugBuilderInfo (s3Client .Endpoint , appName , slugName , gitSha )
6467
@@ -78,7 +81,7 @@ func build(conf *Config, s3Client *s3.S3, kubeClient *client.Client, builderKey,
7881
7982 // build a tarball from the new objects
8083 appTgz := fmt .Sprintf ("%s.tar.gz" , appName )
81- gitArchiveCmd := repoCmd (repoDir , "git" , "archive" , "--format=tar.gz" , fmt .Sprintf ("--output=%s" , appTgz ), gitSha .Full ())
84+ gitArchiveCmd := repoCmd (repoDir , "git" , "archive" , "--format=tar.gz" , fmt .Sprintf ("--output=%s" , appTgz ), gitSha .Short ())
8285 gitArchiveCmd .Stdout = os .Stdout
8386 gitArchiveCmd .Stderr = os .Stderr
8487 if err := run (gitArchiveCmd ); err != nil {
@@ -97,7 +100,7 @@ func build(conf *Config, s3Client *s3.S3, kubeClient *client.Client, builderKey,
97100 bType := getBuildTypeForDir (tmpDir )
98101 usingDockerfile := bType == buildTypeDockerfile
99102
100- var procType pkg.ProcessType
103+ procType := pkg.ProcessType {}
101104 if bType == buildTypeProcfile {
102105 rawProcFile , err := ioutil .ReadFile (fmt .Sprintf ("%s/Procfile" , tmpDir ))
103106 if err != nil {
@@ -136,7 +139,7 @@ func build(conf *Config, s3Client *s3.S3, kubeClient *client.Client, builderKey,
136139 conf .PodNamespace ,
137140 appConf .Values ,
138141 slugBuilderInfo .TarURL (),
139- imageName ,
142+ slugName ,
140143 )
141144 } else {
142145 buildPodName = slugBuilderPodName (appName , gitSha .Short ())
@@ -201,13 +204,12 @@ func build(conf *Config, s3Client *s3.S3, kubeClient *client.Client, builderKey,
201204 if err != nil {
202205 return fmt .Errorf ("Timed out waiting for object in storage. Aborting build..." )
203206 }
204-
205207 log .Info ("Build complete." )
206208 log .Info ("Launching app." )
207209 log .Info ("Launching..." )
208210
209211 buildHook := & pkg.BuildHook {
210- Sha : gitSha .Full (),
212+ Sha : gitSha .Short (),
211213 ReceiveUser : conf .Username ,
212214 ReceiveRepo : appName ,
213215 Image : appName ,
@@ -217,7 +219,6 @@ func build(conf *Config, s3Client *s3.S3, kubeClient *client.Client, builderKey,
217219 buildHook .Dockerfile = ""
218220 } else {
219221 buildHook .Dockerfile = "true"
220- buildHook .Image = imageName
221222 }
222223 buildHookResp , err := publishRelease (conf , builderKey , buildHook )
223224 if err != nil {
0 commit comments