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:
@@ -7,7 +7,6 @@ spec:
|
|||||||
version: 2
|
version: 2
|
||||||
builder:
|
builder:
|
||||||
command: build
|
command: build
|
||||||
image: fission/go-builder:0.6.0
|
image: fission/go-builder-1.12:1.5.0
|
||||||
runtime:
|
runtime:
|
||||||
image: fission/go-env:0.6.0
|
image: fission/go-env-1.12:1.5.0
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ spec:
|
|||||||
environment:
|
environment:
|
||||||
name: go
|
name: go
|
||||||
namespace: default
|
namespace: default
|
||||||
|
functionTimeout: 60
|
||||||
package:
|
package:
|
||||||
functionName: Handler
|
functionName: Handler
|
||||||
packageref:
|
packageref:
|
||||||
|
|||||||
@@ -746,7 +746,7 @@ func applyPackages(fclient *client.Client, fr *spec.FissionResources, delete boo
|
|||||||
keep = true
|
keep = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if keep {
|
if keep && existingObj.Status.BuildStatus == fv1.BuildStatusSucceeded {
|
||||||
// nothing to do on the server
|
// nothing to do on the server
|
||||||
metadataMap[mapKey(&o.Metadata)] = existingObj.Metadata
|
metadataMap[mapKey(&o.Metadata)] = existingObj.Metadata
|
||||||
} else {
|
} else {
|
||||||
@@ -760,6 +760,12 @@ func applyPackages(fclient *client.Client, fr *spec.FissionResources, delete boo
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
// log and ignore
|
// log and ignore
|
||||||
fmt.Printf("Error waiting for package '%v' build, ignoring\n", o.Metadata.Name)
|
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)
|
newmeta, err := fclient.PackageUpdate(pkg)
|
||||||
|
|||||||
Reference in New Issue
Block a user