mirror of https://github.com/knative/func.git
fix: use image name for run command (#238)
The run command shouldn't consume the digest (as it is being created once the image is being pushed to the external registry), because if we do deploy , then build and then run, the run will use image produced by deploy not the subsequent build. Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
This commit is contained in:
parent
7e47377ce4
commit
985906b0e1
|
@ -30,15 +30,15 @@ func (n *Runner) Run(f faas.Function) error {
|
|||
return errors.New("please install 'docker'")
|
||||
}
|
||||
|
||||
if f.Image == "" || f.ImageWithDigest() == "" {
|
||||
return errors.New("Function has no associated Image and Digest. Has it been built?")
|
||||
if f.Image == "" {
|
||||
return errors.New("Function has no associated Image. Has it been built?")
|
||||
}
|
||||
|
||||
// Extra arguments to docker
|
||||
args := []string{"run", "--rm", "-t", "-p=8080:8080"}
|
||||
|
||||
for name, value := range f.EnvVars {
|
||||
if !strings.HasSuffix(name,"-") {
|
||||
if !strings.HasSuffix(name, "-") {
|
||||
args = append(args, fmt.Sprintf("-e%s=%s", name, value))
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ func (n *Runner) Run(f faas.Function) error {
|
|||
if n.Verbose {
|
||||
args = append(args, "-e VERBOSE=true")
|
||||
}
|
||||
args = append(args, f.ImageWithDigest())
|
||||
args = append(args, f.Image)
|
||||
|
||||
// Set up the command with extra arguments and to run rooted at path
|
||||
cmd := exec.Command("docker", args...)
|
||||
|
|
Loading…
Reference in New Issue