Skip to content

Commit e00994d

Browse files
author
Aaron Schlesinger
committed
fix(build.go): search for and replace the buildpack URL in the slugbuilder manifests
1 parent f508467 commit e00994d

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

pkg/gitreceive/build.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,11 @@ func build(conf *Config, builderKey, gitSha string) error {
9595
return fmt.Errorf("getting app config for %s (%s)", appName, err)
9696
}
9797
log.Debug("got the following config back for app %s: %+v", appName, *appConf)
98-
buildPackURLInterface, ok := appConf.Values["BUILDPACK_URL"]
99-
if !ok {
100-
return fmt.Errorf("BUILDPACK_URL not found in returned app config")
101-
}
102-
buildPackURL, ok := buildPackURLInterface.(string)
103-
if !ok {
104-
return fmt.Errorf("BUILDPACK_URL not returned as a string")
98+
var buildPackURL string
99+
if buildPackURLInterface, ok := appConf.Values["BUILDPACK_URL"]; ok {
100+
if bpStr, ok := buildPackURLInterface.(string); ok {
101+
buildPackURL = bpStr
102+
}
105103
}
106104

107105
// build a tarball from the new objects
@@ -164,12 +162,12 @@ func build(conf *Config, builderKey, gitSha string) error {
164162
finalManifest = strings.Replace(string(fileBytes), "repo_name", buildPodName, -1)
165163
finalManifest = strings.Replace(finalManifest, "puturl", pushURL, -1)
166164
finalManifest = strings.Replace(finalManifest, "tar-url", tarURL, -1)
165+
finalManifest = strings.Replace(finalManifest, "buildurl", buildPackURL, -1)
167166
} else {
168167
buildPodName = fmt.Sprintf("slugbuild-%s-%s-%s", appName, shortSha, uid)
169168
finalManifest = strings.Replace(string(fileBytes), "repo_name", buildPodName, -1)
170169
finalManifest = strings.Replace(finalManifest, "puturl", pushURL, -1)
171170
finalManifest = strings.Replace(finalManifest, "tar-url", tarURL, -1)
172-
finalManifest = strings.Replace(finalManifest, "buildurl", buildPackURL, -1)
173171
}
174172

175173
log.Debug("writing builder manifest to %s", finalManifestFileLocation)

0 commit comments

Comments
 (0)