forked from LaconicNetwork/kompose
Merge pull request #609 from surajnarwade/validate_dockerfilepath
Validate dockerfilepath in buildconfig
This commit is contained in:
commit
1f0cf0b2e1
@ -329,6 +329,11 @@ func (c *Compose) LoadFile(files []string) (kobject.KomposeObject, error) {
|
|||||||
envs := loadEnvVars(composeServiceConfig.Environment)
|
envs := loadEnvVars(composeServiceConfig.Environment)
|
||||||
serviceConfig.Environment = envs
|
serviceConfig.Environment = envs
|
||||||
|
|
||||||
|
//Validate dockerfile path
|
||||||
|
if filepath.IsAbs(serviceConfig.Dockerfile) {
|
||||||
|
log.Fatalf("%q defined in service %q is an absolute path, it must be a relative path.", serviceConfig.Dockerfile, name)
|
||||||
|
}
|
||||||
|
|
||||||
// load ports
|
// load ports
|
||||||
ports, err := loadPorts(composeServiceConfig.Ports)
|
ports, err := loadPorts(composeServiceConfig.Ports)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -197,6 +197,8 @@ convert::expect_success_and_warning "kompose -f $KOMPOSE_ROOT/script/test/fixtur
|
|||||||
# Openshift Test
|
# Openshift Test
|
||||||
convert::expect_success_and_warning "kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/service-name-change/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/service-name-change/output-os.json" "Unsupported root level volumes key - ignoring"
|
convert::expect_success_and_warning "kompose --provider openshift -f $KOMPOSE_ROOT/script/test/fixtures/service-name-change/docker-compose.yml convert --stdout -j" "$KOMPOSE_ROOT/script/test/fixtures/service-name-change/output-os.json" "Unsupported root level volumes key - ignoring"
|
||||||
|
|
||||||
|
# Test regarding validating dockerfilepath
|
||||||
|
convert::expect_failure "kompose -f $KOMPOSE_ROOT/script/test/fixtures/dockerfilepath/docker-compose.yml convert --stdout"
|
||||||
|
|
||||||
######
|
######
|
||||||
# Test the output file behavior of kompose convert
|
# Test the output file behavior of kompose convert
|
||||||
|
|||||||
8
script/test/fixtures/dockerfilepath/docker-compose.yml
vendored
Normal file
8
script/test/fixtures/dockerfilepath/docker-compose.yml
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
version: "2"
|
||||||
|
|
||||||
|
services:
|
||||||
|
foo:
|
||||||
|
build:
|
||||||
|
context: "../../script/test_in_openshift/buildconfig"
|
||||||
|
dockerfile: "/Dockerfile"
|
||||||
|
command: "sleep 120"
|
||||||
Loading…
Reference in New Issue
Block a user