1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Added validity checks for repo name and tag in build job.

Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
Joffrey F 2014-10-02 17:37:13 +02:00
parent 7304c09ecc
commit aabba9801a

View file

@ -9,6 +9,7 @@ import (
"github.com/docker/docker/daemon" "github.com/docker/docker/daemon"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/graph"
"github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/parsers" "github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/registry" "github.com/docker/docker/registry"
@ -42,7 +43,18 @@ func (b *BuilderJob) CmdBuild(job *engine.Job) engine.Status {
) )
job.GetenvJson("authConfig", authConfig) job.GetenvJson("authConfig", authConfig)
job.GetenvJson("configFile", configFile) job.GetenvJson("configFile", configFile)
repoName, tag = parsers.ParseRepositoryTag(repoName) repoName, tag = parsers.ParseRepositoryTag(repoName)
if repoName != "" {
if _, _, err := registry.ResolveRepositoryName(repoName); err != nil {
return job.Error(err)
}
if len(tag) > 0 {
if err := graph.ValidateTagName(tag); err != nil {
return job.Error(err)
}
}
}
if remoteURL == "" { if remoteURL == "" {
context = ioutil.NopCloser(job.Stdin) context = ioutil.NopCloser(job.Stdin)