dockerfile: allow required flag to take value

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
docker-19.03
Tonis Tiigi 2019-07-26 16:53:51 -07:00
parent 4eb6eef150
commit add2c8db8a
2 changed files with 9 additions and 1 deletions

View File

@ -29,7 +29,7 @@ func testSecretFileParams(t *testing.T, sb integration.Sandbox) {
dockerfile := []byte(`
FROM busybox
RUN --mount=type=secret,mode=741,uid=100,gid=102,target=/mysecret [ "$(stat -c "%u %g %f" /mysecret)" = "100 102 81e1" ]
RUN --mount=type=secret,required=false,mode=741,uid=100,gid=102,target=/mysecret [ "$(stat -c "%u %g %f" /mysecret)" = "100 102 81e1" ]
`)
dir, err := tmpdir(

View File

@ -176,6 +176,14 @@ func parseMount(value string) (*Mount, error) {
}
m.ReadOnly = !rw
roAuto = false
case "required":
if m.Type == "secret" || m.Type == "ssh" {
v, err := strconv.ParseBool(value)
if err != nil {
return nil, errors.Errorf("invalid value for %s: %s", key, value)
}
m.Required = v
}
case "id":
m.CacheID = value
case "sharing":