remove image constraint

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
This commit is contained in:
Hongchao Deng
2020-10-23 13:14:14 -07:00
parent 125a0ce081
commit f2825f2181
3 changed files with 10 additions and 7 deletions
+5 -4
View File
@@ -81,11 +81,12 @@ func (app *AppFile) buildOAM(ns string, io cmdutil.IOStreams, buildImage bool, t
v, ok := svc["image"]
if ok {
image = v.(string)
} else {
return nil, nil, ErrImageNotDefined
}
if b := svc.GetBuild(); b != nil {
if image == "" {
return nil, nil, ErrImageNotDefined
}
if buildImage {
io.Infof("\nBuilding service (%s)...\n", sname)
if err := b.BuildImage(io, image); err != nil {
@@ -94,8 +95,8 @@ func (app *AppFile) buildOAM(ns string, io cmdutil.IOStreams, buildImage bool, t
}
}
io.Infof("\nRendering component configs for service (%s)...\n", sname)
acComp, comp, err := svc.RenderService(tm, sname, ns, image)
io.Infof("\nRendering configs for service (%s)...\n", sname)
acComp, comp, err := svc.RenderService(tm, sname, ns)
if err != nil {
return nil, nil, err
}
+3
View File
@@ -36,6 +36,9 @@ services:
yamlNoImage := `name: myapp
services:
bad-server:
build:
docker:
file: Dockerfile
cmd: ["node", "server.js"]
`
+2 -3
View File
@@ -62,7 +62,7 @@ func (s Service) GetBuild() *Build {
// RenderService render all capabilities of a service to CUE values of a Component.
// It outputs a Component which will be marshaled as standalone Component and also returned AppConfig Component section.
func (s Service) RenderService(tm template.Manager, name, ns, image string) (
func (s Service) RenderService(tm template.Manager, name, ns string) (
*v1alpha2.ApplicationConfigurationComponent, *v1alpha2.Component, error) {
// sort out configs by workload/trait
@@ -89,8 +89,7 @@ func (s Service) RenderService(tm template.Manager, name, ns, image string) (
// only render webservice workload for now.
ctxData := map[string]string{
"name": name,
"image": image,
"name": name,
}
u, err := evalComponent(tm.LoadTemplate(wtype), ctxData, intifyValues(workloadKeys))
if err != nil {