Skip to content

Commit f69c700

Browse files
committed
Fix CloudFoundry protocol compliance in finalize phase
- Add stager.SetStagingEnvironment() call before finalize logic - Add stager.StagingComplete() call at end of finalize - Remove unnecessary calls (CheckBuildpackValid, SetAppCacheDir, WriteConfigYml, CleanupAppCache) - Align exit codes with reference buildpacks (go-buildpack, ruby-buildpack) Fixes ensure proper CloudFoundry lifecycle signaling
1 parent f0bca05 commit f69c700

1 file changed

Lines changed: 8 additions & 20 deletions

File tree

src/java/finalize/cli/main.go

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,16 @@ func main() {
3636
installer := libbuildpack.NewInstaller(manifest)
3737
stager := libbuildpack.NewStager(os.Args[1:], logger, manifest)
3838

39-
if err := stager.CheckBuildpackValid(); err != nil {
40-
os.Exit(11)
41-
}
42-
43-
if err = installer.SetAppCacheDir(stager.CacheDir()); err != nil {
44-
logger.Error("Unable to setup appcache: %s", err)
45-
os.Exit(18)
46-
}
47-
4839
if err = manifest.ApplyOverride(stager.DepsDir()); err != nil {
4940
logger.Error("Unable to apply override.yml files: %s", err)
5041
os.Exit(17)
5142
}
5243

44+
if err := stager.SetStagingEnvironment(); err != nil {
45+
logger.Error("Unable to setup environment variables: %s", err.Error())
46+
os.Exit(10)
47+
}
48+
5349
f := finalize.Finalizer{
5450
Stager: stager,
5551
Manifest: manifest,
@@ -59,7 +55,7 @@ func main() {
5955
}
6056

6157
if err = finalize.Run(&f); err != nil {
62-
os.Exit(14)
58+
os.Exit(12)
6359
}
6460

6561
if err := libbuildpack.RunAfterCompile(stager); err != nil {
@@ -69,16 +65,8 @@ func main() {
6965

7066
if err := stager.SetLaunchEnvironment(); err != nil {
7167
logger.Error("Unable to setup launch environment: %s", err.Error())
72-
os.Exit(16)
73-
}
74-
75-
if err := stager.WriteConfigYml(nil); err != nil {
76-
logger.Error("Error writing config.yml: %s", err.Error())
77-
os.Exit(15)
68+
os.Exit(14)
7869
}
7970

80-
if err = installer.CleanupAppCache(); err != nil {
81-
logger.Error("Unable to clean up app cache: %s", err)
82-
os.Exit(19)
83-
}
71+
stager.StagingComplete()
8472
}

0 commit comments

Comments
 (0)