Fix spec doesn't update status of failed package when applying spec files (#1332)

Previously, the spec doesn't update the package status if nothing
in the spec file changed. Due to this, the failed package will
always stay in the failed state.

This PR adds a check to see whether a package is in the failed state.
If yes, then changes the state to pending for builder manager to rebuild it.
This commit is contained in:
Ta-Ching Chen
2019-09-28 04:35:57 +08:00
committed by GitHub
parent 7fbb4098a4
commit 81ae6f38fc
3 changed files with 10 additions and 4 deletions
+7 -1
View File
@@ -746,7 +746,7 @@ func applyPackages(fclient *client.Client, fr *spec.FissionResources, delete boo
keep = true
}
if keep {
if keep && existingObj.Status.BuildStatus == fv1.BuildStatusSucceeded {
// nothing to do on the server
metadataMap[mapKey(&o.Metadata)] = existingObj.Metadata
} else {
@@ -760,6 +760,12 @@ func applyPackages(fclient *client.Client, fr *spec.FissionResources, delete boo
if err != nil {
// log and ignore
fmt.Printf("Error waiting for package '%v' build, ignoring\n", o.Metadata.Name)
pkg = &o
}
// update status in order to rebuild the package again
if pkg.Status.BuildStatus == fv1.BuildStatusFailed {
pkg.Status.BuildStatus = fv1.BuildStatusPending
}
newmeta, err := fclient.PackageUpdate(pkg)