Move builds to package level (#297)
Introduce _Archives_ as a type to reference arbitrary blobs. _Packages_ are a pair of Source and Deployment archives. Packages have an environment reference. Functions reference a package. Multiple functions can reference the same package.
This commit is contained in:
@@ -81,8 +81,10 @@ func TestFunctionApi(t *testing.T) {
|
||||
Namespace: api.NamespaceDefault,
|
||||
},
|
||||
Spec: fission.FunctionSpec{
|
||||
EnvironmentName: "nodejs",
|
||||
Deployment: fission.FunctionPackageRef{
|
||||
Environment: fission.EnvironmentReference{
|
||||
Name: "nodejs",
|
||||
},
|
||||
Package: fission.FunctionPackageRef{
|
||||
FunctionName: "xxx",
|
||||
},
|
||||
},
|
||||
@@ -99,7 +101,7 @@ func TestFunctionApi(t *testing.T) {
|
||||
_, err = g.client.FunctionCreate(testFunc)
|
||||
assertNameReuseFailure(err, "function")
|
||||
|
||||
testFunc.Spec.Deployment.FunctionName = "yyy"
|
||||
testFunc.Spec.Package.FunctionName = "yyy"
|
||||
_, err = g.client.FunctionUpdate(testFunc)
|
||||
panicIf(err)
|
||||
|
||||
|
||||
@@ -65,7 +65,12 @@ func (a *API) PackageApiCreate(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// Ensure size limits
|
||||
if len(f.Spec.Literal) > 256*1024 {
|
||||
if len(f.Spec.Source.Literal) > 256*1024 {
|
||||
err := fission.MakeError(fission.ErrorInvalidArgument, "Package literal larger than 256K")
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
}
|
||||
if len(f.Spec.Deployment.Literal) > 256*1024 {
|
||||
err := fission.MakeError(fission.ErrorInvalidArgument, "Package literal larger than 256K")
|
||||
a.respondWithError(w, err)
|
||||
return
|
||||
@@ -104,7 +109,7 @@ func (a *API) PackageApiGet(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
var resp []byte
|
||||
if raw != "" {
|
||||
resp = []byte(f.Spec.Literal)
|
||||
resp = []byte(f.Spec.Deployment.Literal)
|
||||
} else {
|
||||
resp, err = json.Marshal(f)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user