forked from LaconicNetwork/kompose
Updated Vendoring
This commit is contained in:
1 parent
5de4aa85f8
commit
b3f2134cec
298 files changed
+27729
-66945
No files matched your search
+13
-2
@@ -8,7 +8,6 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/cli/cli/compose/interpolation"
|
||||
"github.com/docker/cli/cli/compose/schema"
|
||||
"github.com/docker/cli/cli/compose/template"
|
||||
@@ -19,6 +18,7 @@ import (
|
||||
shellwords "github.com/mattn/go-shellwords"
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
@@ -221,6 +221,7 @@ func createTransformHook() mapstructure.DecodeHookFuncType {
|
||||
reflect.TypeOf(types.Labels{}): transformMappingOrListFunc("=", false),
|
||||
reflect.TypeOf(types.MappingWithColon{}): transformMappingOrListFunc(":", false),
|
||||
reflect.TypeOf(types.ServiceVolumeConfig{}): transformServiceVolumeConfig,
|
||||
reflect.TypeOf(types.BuildConfig{}): transformBuildConfig,
|
||||
}
|
||||
|
||||
return func(_ reflect.Type, target reflect.Type, data interface{}) (interface{}, error) {
|
||||
@@ -563,6 +564,17 @@ func transformStringSourceMap(data interface{}) (interface{}, error) {
|
||||
}
|
||||
}
|
||||
|
||||
func transformBuildConfig(data interface{}) (interface{}, error) {
|
||||
switch value := data.(type) {
|
||||
case string:
|
||||
return map[string]interface{}{"context": value}, nil
|
||||
case map[string]interface{}:
|
||||
return data, nil
|
||||
default:
|
||||
return data, errors.Errorf("invalid type %T for service build", value)
|
||||
}
|
||||
}
|
||||
|
||||
func transformServiceVolumeConfig(data interface{}) (interface{}, error) {
|
||||
switch value := data.(type) {
|
||||
case string:
|
||||
@@ -572,7 +584,6 @@ func transformServiceVolumeConfig(data interface{}) (interface{}, error) {
|
||||
default:
|
||||
return data, errors.Errorf("invalid type %T for service volume", value)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func transformServiceNetworkMap(value interface{}) (interface{}, error) {
|
||||
|
||||
+5
@@ -112,6 +112,11 @@ func isFilePath(source string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// windows named pipes
|
||||
if strings.HasPrefix(source, `\\`) {
|
||||
return true
|
||||
}
|
||||
|
||||
first, nextIndex := utf8.DecodeRuneInString(source)
|
||||
return isWindowsDrive([]rune{first}, rune(source[nextIndex]))
|
||||
}
|
||||
+1
-1
@@ -152,7 +152,7 @@ func dataConfig_schema_v33Json() (*asset, error) {
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _dataConfig_schema_v34Json = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x5b\x4f\x73\xdb\x3a\x0e\xbf\xfb\x53\x68\xf4\xde\xad\x76\xd2\x99\xed\xec\xcc\xf6\xb6\xc7\x3d\xed\x9e\x37\xe3\x6a\x68\x0a\xb6\xd9\x50\x24\x0b\x52\x4e\xdc\x4e\xbe\xfb\x8e\xfe\x5a\x7f\x28\x92\xb2\x95\x26\xdd\xd7\x53\x62\x09\x00\x09\x80\xf8\x01\x20\xa9\x1f\xab\x28\x8a\xff\xd4\xf4\x08\x19\x89\x3f\x47\xf1\xd1\x18\xf5\xf9\xfe\xfe\xab\x96\x62\x53\x3d\xbd\x93\x78\xb8\x4f\x91\xec\xcd\xe6\xe3\xa7\xfb\xea\xd9\x1f\xf1\xba\xe0\x63\x69\xc1\x42\xa5\xd8\xb3\x43\x52\xbd\x49\x4e\x7f\xbb\xfb\x74\x57\xb0\x57\x24\xe6\xac\xa0\x20\x92\xbb\xaf\x40\x4d\xf5\x0c\xe1\x5b\xce\x10\x0a\xe6\x87\xf8\x04\xa8\x99\x14\xf1\x76\xbd\x2a\xde\x29\x94\x0a\xd0\x30\xd0\xf1\xe7\xa8\x98\x5c\x14\xb5\x24\xcd\x83\x8e\x58\x6d\x90\x89\x43\x5c\x3e\x7e\x29\x25\x44\x51\xac\x01\x4f\x8c\x76\x24\xb4\x53\xfd\xe3\xfe\x22\xff\xbe\x25\x5b\x0f\xa5\x76\x26\x5b\x3e\x57\xc4\x18\x40\xf1\x9f\xf1\xdc\xca\xd7\x5f\x1e\xc8\xe6\xfb\x3f\x37\xff\xfd\xb8\xf9\xc7\x5d\xb2\xd9\x7e\xf8\xb3\xf7\xba\xb0\x2f\xc2\xbe\x1a\x3e\x85\x3d\x13\xcc\x30\x29\xda\xf1\xe3\x96\xf2\xa5\xfe\xef\xa5\x1d\x98\xa4\x69\x49\x4c\x78\x6f\xec\x3d\xe1\x1a\xfa\x3a\x0b\x30\x4f\x12\x1f\x7d\x3a\xb7\x64\x6f\xa4\x73\x3d\xbe\x45\xe7\xbe\x3a\x27\xc9\xf3\xcc\xeb\xc1\x86\xea\x8d\x94\xa9\x86\x5f\xc6\x7f\x1a\x28\x82\xf1\x2f\xd9\x8a\xea\xcd\x56\x6c\x31\xfc\x32\x0a\x57\xa8\xe1\x53\xb8\xa1\x7a\x23\x85\xab\xe1\x6f\x53\x78\xd5\x28\x6d\x9f\x63\xfc\xe5\x79\x53\xfc\x7d\x29\x65\x3a\xe5\x55\x52\x3a\xf3\x2b\x95\xe8\x61\x9e\xcd\x9c\x36\xcc\x99\xb6\x67\x6b\xd0\x09\x4b\xa6\xa0\xb8\x3c\x97\x33\xb7\xdb\xac\x22\xc8\x40\x98\xb8\x35\x53\x14\xc5\xbb\x9c\xf1\x74\x68\x75\x29\xe0\xdf\x85\x88\x87\xce\xc3\x28\xfa\x31\x84\xf7\x8e\x9c\xf2\x7d\xef\xd7\xf4\xa2\x68\xdf\x4f\xe8\xd2\xbe\xa7\x52\x18\x78\x36\xa5\x52\xee\xa1\x2b\x13\x48\xfa\x08\xb8\x67\x1c\x42\x39\x08\x56\x2b\x7d\xc2\x64\x9c\x69\x93\x48\x4c\x52\x46\x8d\x95\x9f\x93\x1d\xf0\x9b\x24\x50\x42\x8f\x90\xec\x51\x66\x5e\x29\xfb\xa4\xd2\x44\x5b\x05\x35\x08\x1e\xa8\xb9\x21\x78\x00\xbb\x65\x07\xc4\x23\x6e\x7f\x6c\xb5\xac\x9d\x5f\xdb\x95\x45\x60\x4c\x89\x4a\x48\x9a\xf6\xe6\x41\x10\xc9\x39\x5e\x47\x31\x33\x90\x69\xbb\x42\x51\x9c\x0b\xf6\x2d\x87\x7f\xd5\x24\x06\x73\x18\xca\x4d\x51\xaa\xe5\x05\x1f\x50\xe6\x2a\x51\x04\x8b\x40\x72\x1b\x3b\xa6\x32\xcb\x88\x58\x2a\xba\xe6\xe8\x11\x60\xf9\x11\xce\x47\xdd\x90\xad\xc7\xe8\xbe\x6a\x47\xeb\x4d\x6b\x42\x1b\xbf\x3e\x63\xbc\xf0\x23\x86\x1f\x33\x0a\xc8\x95\x39\xd2\x50\x08\x70\x87\x82\x95\x3e\x67\x69\x38\xf1\x61\x0e\x71\x26\xd3\xfe\xbc\x45\x9e\xed\x00\x47\x21\xd9\x8f\xac\xf1\xef\xed\xca\xf6\x66\xe0\x7d\x43\x98\x00\x4c\x04\xc9\x7c\xb6\x8a\x29\x42\x0a\xc2\x30\xc2\x13\xad\x80\xf6\xc8\x1b\x4f\x39\x3c\x13\x07\x41\x72\x8c\x70\x60\xda\xe0\xd9\x0d\x4a\x2f\xdd\x89\xa5\xa0\x40\xa4\x3a\xa9\x9a\x90\xf9\xe8\x19\xa7\xd0\x76\x24\x8b\xc2\x44\x2a\x5c\x59\xa1\x12\x53\xe4\x85\x62\x6e\xf1\x80\x31\xd1\x40\x90\x1e\xaf\xe4\x97\x19\x61\x22\xc4\xa9\x20\x0c\x9e\x95\x64\x15\x8c\xbd\x3b\x7c\x02\x71\x4a\xda\x75\x33\xdb\x0c\x20\x4e\x0c\xa5\xc8\x1a\x90\x0e\xcb\xce\x1d\xfe\x67\x25\x35\xdc\x0e\x8e\x35\xc7\x43\xa3\xf8\xba\x8d\xe9\x6d\xdf\x7a\xf1\x5e\x62\x46\x8a\xc9\x36\x63\x77\x63\xb8\x37\xd4\x78\xe5\x75\x0d\xd8\xd5\xa1\xa8\x6a\x09\x4f\x38\x13\x8f\xcb\x2f\x71\x78\x36\x48\x92\xa3\xd4\xe6\x9a\x02\x28\x3e\x02\xe1\xe6\x48\x8f\x40\x1f\x1d\xec\x5d\xaa\x1e\xb7\xd4\x26\x64\x91\xb3\x8c\x1c\xfc\x44\x8a\xfa\x48\xae\x2e\xf4\xe2\x45\x8d\xdf\x11\x2b\x0f\x87\x82\x74\x6a\xc5\x8d\x1a\x87\xfa\xb5\xaf\xe4\x4e\x91\x9d\x00\x43\xab\x48\xa9\x2e\xfd\xce\xf0\x65\x48\x36\xf7\x36\x88\x3d\xd2\x2f\x77\x55\x7f\xe8\x88\xaa\xf2\x3f\xce\xe3\xed\x38\x65\x8e\x93\xe6\xf0\xc9\x40\xc3\xb0\x3a\xb7\xe7\x95\x8c\xd0\xa2\x9c\x45\xd0\x13\x7e\xbd\x90\xd6\xf5\x7a\x32\xca\xf9\x17\xda\x11\xf1\x28\xb1\x4e\x21\xf5\x55\x6d\xc4\xfc\xf6\x2d\xc8\x75\xde\x1e\xdf\xa3\xcd\xd4\xf4\x42\xa7\x79\x99\xae\x7f\x89\x95\x74\x84\x33\xa2\xc1\x1f\xec\xce\x7e\xac\x95\xc6\xd4\xe9\x53\xe0\x9a\xb0\xf1\xfe\xdd\xc9\x3b\xc1\x3a\x29\x33\xbc\x75\xf3\x88\xea\x96\xa8\x9c\x5b\x27\xb2\xf5\x17\xad\xaf\xd9\x59\xaa\x7e\xe1\xdd\xc7\x8a\x12\x21\xba\x01\xa6\x24\x9a\x9f\xd2\x0b\x5d\x70\xea\x92\xf0\xab\xc1\xc7\xed\xd1\xd0\xdd\x41\x4c\xaf\xd3\x53\x39\x50\xca\x42\x6d\xe9\xa8\x98\x30\x70\x28\x5a\x19\x7b\x12\xc8\x77\x9c\xe9\x23\xa4\x73\x78\x50\x1a\x49\x25\x0f\x0b\x0c\xeb\xee\x4f\x78\x30\x38\xfa\xab\xab\x6a\x33\x85\xec\xc4\x38\x1c\x06\x1a\xef\xa4\xe4\x40\x44\x2f\x51\x20\x90\x34\x91\x82\x9f\x03\x28\xb5\x21\xe8\xdd\x95\xd0\x40\x73\x64\xe6\x9c\x48\x65\x16\xaf\x0a\xf5\x31\x4b\x34\xfb\x0e\xfd\xd8\xbb\xac\xfa\x5a\xd0\x76\x30\xa1\xc1\x1e\x7b\xf4\x7b\x2b\xe2\x2f\xb3\x15\xa1\xcf\x9a\x9a\xeb\x6a\x6b\x6d\x52\x26\x12\xa9\x40\x78\x63\x43\x1b\xa9\x92\x03\x12\x0a\x89\x02\x64\xd2\x6a\x8a\x1e\xc0\xa6\x39\x92\x62\xfc\xb1\x18\xcd\x0e\x82\xd8\x71\xa7\x43\x6a\x32\xb5\xbf\x72\x13\xc0\x18\x7f\xb0\xe7\x9c\x65\x6c\x3a\x68\x2c\xab\x36\xa0\x5e\xab\x6a\x35\x7b\x89\xe6\x28\xcf\x82\x20\xdb\xd1\x21\xb8\x1b\x84\x80\xce\xe0\x48\x70\x46\xea\x28\x03\x73\x3f\x91\x9f\x6c\x7d\x83\x75\x5e\xbd\xd3\xf2\x52\xde\xba\x9e\xc8\xd6\x4a\x3f\xab\xf4\x1a\x4e\x63\xLine truncated
|
||||
var _dataConfig_schema_v34Json = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x5b\x4f\x73\xdb\x3a\x0e\xbf\xfb\x53\x68\xf4\xde\xad\x76\xd2\x99\xed\xec\xcc\xf6\xb6\xc7\x3d\xed\x9e\x37\xe3\x6a\x68\x0a\xb6\xd9\x50\x24\x0b\x52\x4e\xdc\x4e\xbe\xfb\x8e\xfe\x9a\x92\x28\x91\xb2\x95\x26\xdd\xd7\x53\x62\x09\x00\x09\x10\xf8\x01\x20\xa9\x1f\xab\x28\x8a\xff\xd4\xf4\x08\x19\x89\x3f\x47\xf1\xd1\x18\xf5\xf9\xfe\xfe\xab\x96\x62\x53\x3d\xbd\x93\x78\xb8\x4f\x91\xec\xcd\xe6\xe3\xa7\xfb\xea\xd9\x1f\xf1\xba\xe0\x63\x69\xc1\x42\xa5\xd8\xb3\x43\x52\xbd\x49\x4e\x7f\xbb\xfb\x74\x57\xb0\x57\x24\xe6\xac\xa0\x20\x92\xbb\xaf\x40\x4d\xf5\x0c\xe1\x5b\xce\x10\x0a\xe6\x87\xf8\x04\xa8\x99\x14\xf1\x76\xbd\x2a\xde\x29\x94\x0a\xd0\x30\xd0\xf1\xe7\xa8\x98\x5c\x14\xb5\x24\xcd\x03\x4b\xac\x36\xc8\xc4\x21\x2e\x1f\xbf\x94\x12\xa2\x28\xd6\x80\x27\x46\x2d\x09\xed\x54\xff\xb8\xbf\xc8\xbf\x6f\xc9\xd6\x7d\xa9\xd6\x64\xcb\xe7\x8a\x18\x03\x28\xfe\x33\x9c\x5b\xf9\xfa\xcb\x03\xd9\x7c\xff\xe7\xe6\xbf\x1f\x37\xff\xb8\x4b\x36\xdb\x0f\x7f\x76\x5e\x17\xf6\x45\xd8\x57\xc3\xa7\xb0\x67\x82\x19\x26\x45\x3b\x7e\xdc\x52\xbe\xd4\xff\xbd\xb4\x03\x93\x34\x2d\x89\x09\xef\x8c\xbd\x27\x5c\x43\x57\x67\x01\xe6\x49\xe2\xa3\x4f\xe7\x96\xec\x8d\x74\xae\xc7\x77\xe8\xdc\x55\xe7\x24\x79\x9e\x79\x57\xb0\xa1\x7a\x23\x65\xaa\xe1\x97\x59\x3f\x0d\x14\xc1\xf8\x5d\xb6\xa2\x7a\x33\x8f\x2d\x86\x5f\x46\xe1\x0a\x35\x7c\x0a\x37\x54\x6f\xa4\x70\x35\xfc\x6d\x0a\xaf\x1a\xa5\xdd\x73\x8c\xbf\x3c\x6f\x8a\xbf\x2f\xa5\xcc\x49\x79\x95\x14\x6b\x7e\xa5\x12\x1d\xcc\x73\x99\xd3\x85\x39\xe3\xf6\x6c\x0d\x3a\x62\xc9\x14\x14\x97\xe7\x72\xe6\x6e\x9b\x55\x04\x19\x08\x13\xb7\x66\x8a\xa2\x78\x97\x33\x9e\xf6\xad\x2e\x05\xfc\xbb\x10\xf1\x60\x3d\x8c\xa2\x1f\x7d\x78\xb7\xe4\x94\xef\x3b\xbf\xc6\x9d\xa2\x7d\x3f\xa2\x4b\xfb\x9e\x4a\x61\xe0\xd9\x94\x4a\x4d\x0f\x5d\x99\x40\xd2\x47\xc0\x3d\xe3\x10\xca\x41\xb0\xf2\xf4\x11\x93\x71\xa6\x4d\x22\x31\x49\x19\x35\x4e\x7e\x4e\x76\xc0\x6f\x92\x40\x09\x3d\x42\xb2\x47\x99\x79\xa5\xec\x93\x4a\x13\xed\x14\xd4\x20\x78\xa0\xe6\x86\xe0\x01\xdc\x96\xed\x11\x0f\xb8\xfd\xb1\xd5\xb2\x5a\xbf\xb6\x2b\x87\xc0\x98\x12\x95\x90\x34\xed\xcc\x83\x20\x92\x73\xbc\x8e\x62\x66\x20\xd3\x6e\x85\xa2\x38\x17\xec\x5b\x0e\xff\xaa\x49\x0c\xe6\xd0\x97\x9b\xa2\x54\xcb\x0b\x3e\xa0\xcc\x55\xa2\x08\x16\x81\x34\x6d\xec\x98\xca\x2c\x23\x62\xa9\xe8\x9a\xa3\x47\x80\xe5\x07\x38\x1f\xd9\x21\x5b\x8f\x61\xbf\x6a\x47\xeb\x4c\x6b\x44\x1b\xbf\x3e\x43\xbc\xf0\x23\x86\x1f\x33\x0a\xc8\x95\x39\xd2\x50\x08\x98\x0e\x05\x27\x7d\xce\xd2\x70\xe2\xc3\x1c\xe2\x4c\xa6\xdd\x79\x8b\x3c\xdb\x01\x0e\x42\xb2\x1b\x59\xc3\xdf\xdb\x95\xeb\x4d\x6f\xf5\x0d\x61\x02\x30\x11\x24\xf3\xd9\x2a\xa6\x08\x29\x08\xc3\x08\x4f\xb4\x02\xda\x21\x6f\x56\x6a\x62\x65\xe2\x20\x48\x8e\x11\x0e\x4c\x1b\x3c\x4f\x83\xd2\x8b\x3d\xb1\x14\x14\x88\x54\x27\x55\x13\x32\x1f\x3d\xe3\x14\xda\x8e\x64\x51\x98\x48\xc5\x54\x56\xa8\xc4\x14\x79\xa1\x98\x5b\xdc\x63\x4c\x34\x10\xa4\xc7\x2b\xf9\x65\x46\x98\x08\x59\x54\x10\x06\xcf\x4a\xb2\x0a\xc6\xde\x1d\x3e\x81\x38\x25\xad\xdf\xcc\x36\x03\x88\x13\x43\x29\xb2\x06\xa4\xc3\xb2\xb3\xc5\xff\xac\xa4\x86\xdb\xc1\xb1\xe6\x78\x68\x14\x5f\xb7\x31\xbd\xed\x5a\x2f\xde\x4b\xcc\x48\x31\xd9\x66\x6c\x3b\x86\x3b\x43\x0d\x3d\xcf\x36\xa0\xad\x43\x51\xd5\x12\x9e\x70\x26\x1e\x97\x77\x71\x78\x36\x48\x92\xa3\xd4\xe6\x9a\x02\x28\x3e\x02\xe1\xe6\x48\x8f\x40\x1f\x27\xd8\x6d\xaa\x0e\xb7\xd4\x26\xc4\xc9\x59\x46\x0e\x7e\x22\x45\x7d\x24\x57\x17\x7a\xf1\xa2\xc6\xb7\xc4\xca\xc3\xa1\x20\x1d\xf3\xb8\x41\xe3\x50\xbf\xf6\x95\xdc\x29\xb2\x13\x60\x68\x15\x29\xd5\xa5\xdf\xe9\xbf\x0c\xc9\xe6\xde\x06\xb1\x43\xfa\xe5\xae\xea\x0f\x27\xa2\xaa\xfc\x8f\xf3\x78\x3b\x4c\x99\xc3\xa4\xd9\x7f\xd2\xd3\x30\xac\xce\xed\xac\x4a\x46\x68\x51\xce\x22\xe8\x91\x75\xbd\x90\xd6\xf5\x7a\x32\xc8\xf9\x17\xda\x01\xf1\x20\xb1\x8e\x21\xf5\x55\x6d\xc4\xfc\xf6\x2d\x68\xe9\xbc\x3d\xbe\x47\x9b\xb1\xe9\x85\x4e\xf3\x32\x5d\xbf\x8b\x95\x74\x84\x33\xa2\xc1\x1f\xec\x93\xfd\x58\x2b\x8d\xa9\xd3\xa7\x40\x9f\x70\xf1\xfe\x7d\x92\x77\x84\x75\x54\x66\x78\xeb\xe6\x11\x65\x97\xa8\x9c\x3b\x27\xb2\xf5\x17\xad\xaf\xd9\x59\xaa\x6e\xe1\xdd\xc5\x8a\x12\x21\xec\x00\x53\x12\xcd\x4f\xe9\x85\x2e\x38\x75\x49\xf8\xd5\xe0\xc3\xf6\xa8\xbf\xdc\x41\x4c\xaf\xd3\x53\x4d\xa0\x94\x83\xda\xd1\x51\x31\x61\xe0\x50\xb4\x32\xee\x24\x90\xef\x38\xd3\x47\x48\xe7\xf0\xa0\x34\x92\x4a\x1e\x16\x18\xce\xdd\x9f\xf0\x60\x98\xe8\xaf\xae\xaa\xcd\x14\xb2\x13\xe3\x70\xe8\x69\xbc\x93\x92\x03\x11\x9d\x44\x81\x40\xd2\x44\x0a\x7e\x0e\xa0\xd4\x86\xa0\x77\x57\x42\x03\xcd\x91\x99\x73\x22\x95\x59\xbc\x2a\xd4\xc7\x2c\xd1\xec\x3b\x74\x63\xef\xe2\xf5\xb5\xa0\x6d\x6f\x42\xbd\x3d\xf6\xe8\xf7\x56\xc4\x5f\x66\x2b\x42\x9f\x35\x35\xd7\xd5\xd6\xda\xa4\x4c\x24\x52\x81\xf0\xc6\x86\x36\x52\x25\x07\x24\x14\x12\x05\xc8\xa4\xd3\x14\x1d\x80\x4d\x73\x24\xc5\xf8\x43\x31\x9a\x1d\x04\x71\xe3\x8e\x45\x6a\x32\xb5\xbf\x72\x13\xc0\x18\x7f\xb0\xe7\x9c\x65\x6c\x3c\x68\x1c\x5e\x1b\x50\xaf\x55\xb5\x9a\xbb\x44\x9b\x28\xcf\x82\x20\x7b\xa2\x43\x98\x6e\x10\x02\x3a\x83\x23\xc1\x19\xa9\xa3\x0c\xcc\xfd\x48\x7e\x72\xf5\x0d\xce\x79\x75\x4e\xcb\x4b\x79\xeb\x7a\x22\x5b\x27\xfd\xac\xd2\xab\x3f\x8d\xed\xLine truncated
|
||||
|
||||
func dataConfig_schema_v34JsonBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
|
||||
+4
-3
@@ -23,6 +23,7 @@ var UnsupportedProperties = []string{
|
||||
"shm_size",
|
||||
"sysctls",
|
||||
"tmpfs",
|
||||
"ulimits",
|
||||
"userns_mode",
|
||||
}
|
||||
|
||||
@@ -182,10 +183,10 @@ type DeployConfig struct {
|
||||
// HealthCheckConfig the healthcheck configuration for a service
|
||||
type HealthCheckConfig struct {
|
||||
Test HealthCheckTest
|
||||
Timeout string
|
||||
Interval string
|
||||
Timeout *time.Duration
|
||||
Interval *time.Duration
|
||||
Retries *uint64
|
||||
StartPeriod string
|
||||
StartPeriod *time.Duration `mapstructure:"start_period"`
|
||||
Disable bool
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -95,12 +95,12 @@ func (n *NetworkOpt) String() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func parseDriverOpt(driverOpt string) (key string, value string, err error) {
|
||||
func parseDriverOpt(driverOpt string) (string, string, error) {
|
||||
parts := strings.SplitN(driverOpt, "=", 2)
|
||||
if len(parts) != 2 {
|
||||
err = fmt.Errorf("invalid key value pair format in driver options")
|
||||
return "", "", fmt.Errorf("invalid key value pair format in driver options")
|
||||
}
|
||||
key = strings.TrimSpace(strings.ToLower(parts[0]))
|
||||
value = strings.TrimSpace(strings.ToLower(parts[1]))
|
||||
return
|
||||
key := strings.TrimSpace(strings.ToLower(parts[0]))
|
||||
value := strings.TrimSpace(strings.ToLower(parts[1]))
|
||||
return key, value, nil
|
||||
}
|
||||
-81
@@ -1,81 +0,0 @@
|
||||
package opts
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"unicode"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
// ParseEnvFile reads a file with environment variables enumerated by lines
|
||||
//
|
||||
// ``Environment variable names used by the utilities in the Shell and
|
||||
// Utilities volume of IEEE Std 1003.1-2001 consist solely of uppercase
|
||||
// letters, digits, and the '_' (underscore) from the characters defined in
|
||||
// Portable Character Set and do not begin with a digit. *But*, other
|
||||
// characters may be permitted by an implementation; applications shall
|
||||
// tolerate the presence of such names.''
|
||||
// -- http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html
|
||||
//
|
||||
// As of #16585, it's up to application inside docker to validate or not
|
||||
// environment variables, that's why we just strip leading whitespace and
|
||||
// nothing more.
|
||||
func ParseEnvFile(filename string) ([]string, error) {
|
||||
fh, err := os.Open(filename)
|
||||
if err != nil {
|
||||
return []string{}, err
|
||||
}
|
||||
defer fh.Close()
|
||||
|
||||
lines := []string{}
|
||||
scanner := bufio.NewScanner(fh)
|
||||
currentLine := 0
|
||||
utf8bom := []byte{0xEF, 0xBB, 0xBF}
|
||||
for scanner.Scan() {
|
||||
scannedBytes := scanner.Bytes()
|
||||
if !utf8.Valid(scannedBytes) {
|
||||
return []string{}, fmt.Errorf("env file %s contains invalid utf8 bytes at line %d: %v", filename, currentLine+1, scannedBytes)
|
||||
}
|
||||
// We trim UTF8 BOM
|
||||
if currentLine == 0 {
|
||||
scannedBytes = bytes.TrimPrefix(scannedBytes, utf8bom)
|
||||
}
|
||||
// trim the line from all leading whitespace first
|
||||
line := strings.TrimLeftFunc(string(scannedBytes), unicode.IsSpace)
|
||||
currentLine++
|
||||
// line is not empty, and not starting with '#'
|
||||
if len(line) > 0 && !strings.HasPrefix(line, "#") {
|
||||
data := strings.SplitN(line, "=", 2)
|
||||
|
||||
// trim the front of a variable, but nothing else
|
||||
variable := strings.TrimLeft(data[0], whiteSpaces)
|
||||
if strings.ContainsAny(variable, whiteSpaces) {
|
||||
return []string{}, ErrBadEnvVariable{fmt.Sprintf("variable '%s' has white spaces", variable)}
|
||||
}
|
||||
|
||||
if len(data) > 1 {
|
||||
|
||||
// pass the value through, no trimming
|
||||
lines = append(lines, fmt.Sprintf("%s=%s", variable, data[1]))
|
||||
} else {
|
||||
// if only a pass-through variable is given, clean it up.
|
||||
lines = append(lines, fmt.Sprintf("%s=%s", strings.TrimSpace(line), os.Getenv(line)))
|
||||
}
|
||||
}
|
||||
}
|
||||
return lines, scanner.Err()
|
||||
}
|
||||
|
||||
var whiteSpaces = " \t"
|
||||
|
||||
// ErrBadEnvVariable typed error for bad environment variable
|
||||
type ErrBadEnvVariable struct {
|
||||
msg string
|
||||
}
|
||||
|
||||
func (e ErrBadEnvVariable) Error() string {
|
||||
return fmt.Sprintf("poorly formatted environment: %s", e.msg)
|
||||
}
|
||||
-87
@@ -1,87 +0,0 @@
|
||||
package opts
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/api/types/container"
|
||||
)
|
||||
|
||||
// ReadKVStrings reads a file of line terminated key=value pairs, and overrides any keys
|
||||
// present in the file with additional pairs specified in the override parameter
|
||||
func ReadKVStrings(files []string, override []string) ([]string, error) {
|
||||
envVariables := []string{}
|
||||
for _, ef := range files {
|
||||
parsedVars, err := ParseEnvFile(ef)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
envVariables = append(envVariables, parsedVars...)
|
||||
}
|
||||
// parse the '-e' and '--env' after, to allow override
|
||||
envVariables = append(envVariables, override...)
|
||||
|
||||
return envVariables, nil
|
||||
}
|
||||
|
||||
// ConvertKVStringsToMap converts ["key=value"] to {"key":"value"}
|
||||
func ConvertKVStringsToMap(values []string) map[string]string {
|
||||
result := make(map[string]string, len(values))
|
||||
for _, value := range values {
|
||||
kv := strings.SplitN(value, "=", 2)
|
||||
if len(kv) == 1 {
|
||||
result[kv[0]] = ""
|
||||
} else {
|
||||
result[kv[0]] = kv[1]
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// ConvertKVStringsToMapWithNil converts ["key=value"] to {"key":"value"}
|
||||
// but set unset keys to nil - meaning the ones with no "=" in them.
|
||||
// We use this in cases where we need to distinguish between
|
||||
// FOO= and FOO
|
||||
// where the latter case just means FOO was mentioned but not given a value
|
||||
func ConvertKVStringsToMapWithNil(values []string) map[string]*string {
|
||||
result := make(map[string]*string, len(values))
|
||||
for _, value := range values {
|
||||
kv := strings.SplitN(value, "=", 2)
|
||||
if len(kv) == 1 {
|
||||
result[kv[0]] = nil
|
||||
} else {
|
||||
result[kv[0]] = &kv[1]
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// ParseRestartPolicy returns the parsed policy or an error indicating what is incorrect
|
||||
func ParseRestartPolicy(policy string) (container.RestartPolicy, error) {
|
||||
p := container.RestartPolicy{}
|
||||
|
||||
if policy == "" {
|
||||
return p, nil
|
||||
}
|
||||
|
||||
parts := strings.Split(policy, ":")
|
||||
|
||||
if len(parts) > 2 {
|
||||
return p, fmt.Errorf("invalid restart policy format")
|
||||
}
|
||||
if len(parts) == 2 {
|
||||
count, err := strconv.Atoi(parts[1])
|
||||
if err != nil {
|
||||
return p, fmt.Errorf("maximum retry count must be an integer")
|
||||
}
|
||||
|
||||
p.MaximumRetryCount = count
|
||||
}
|
||||
|
||||
p.Name = parts[0]
|
||||
|
||||
return p, nil
|
||||
}
|
||||
+5
-1
@@ -86,8 +86,12 @@ func GetServiceHash(name string, config *ServiceConfig) string {
|
||||
for _, sliceKey := range sliceKeys {
|
||||
io.WriteString(hash, fmt.Sprintf("%s, ", sliceKey))
|
||||
}
|
||||
case *yaml.Networks:
|
||||
io.WriteString(hash, fmt.Sprintf("%s, ", s.HashString()))
|
||||
case *yaml.Volumes:
|
||||
io.WriteString(hash, fmt.Sprintf("%s, ", s.HashString()))
|
||||
default:
|
||||
io.WriteString(hash, fmt.Sprintf("%v", serviceValue))
|
||||
io.WriteString(hash, fmt.Sprintf("%v, ", serviceValue))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+44
-2
@@ -5,13 +5,19 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var defaultValues = make(map[string]string)
|
||||
|
||||
func isNum(c uint8) bool {
|
||||
return c >= '0' && c <= '9'
|
||||
}
|
||||
|
||||
func validVariableDefault(c uint8, line string, pos int) bool {
|
||||
return (c == ':' && line[pos+1] == '-') || (c == '-')
|
||||
}
|
||||
|
||||
func validVariableNameChar(c uint8) bool {
|
||||
return c == '_' ||
|
||||
c >= 'A' && c <= 'Z' ||
|
||||
@@ -36,6 +42,30 @@ func parseVariable(line string, pos int, mapping func(string) string) (string, i
|
||||
return mapping(buffer.String()), pos, true
|
||||
}
|
||||
|
||||
func parseDefaultValue(line string, pos int) (string, int, bool) {
|
||||
var buffer bytes.Buffer
|
||||
|
||||
// only skip :, :- and - at the beginning
|
||||
for ; pos < len(line); pos++ {
|
||||
c := line[pos]
|
||||
if c == ':' || c == '-' {
|
||||
continue
|
||||
}
|
||||
break
|
||||
}
|
||||
for ; pos < len(line); pos++ {
|
||||
c := line[pos]
|
||||
if c == '}' {
|
||||
return buffer.String(), pos - 1, true
|
||||
}
|
||||
err := buffer.WriteByte(c)
|
||||
if err != nil {
|
||||
return "", pos, false
|
||||
}
|
||||
}
|
||||
return "", 0, false
|
||||
}
|
||||
|
||||
func parseVariableWithBraces(line string, pos int, mapping func(string) string) (string, int, bool) {
|
||||
var buffer bytes.Buffer
|
||||
|
||||
@@ -49,10 +79,13 @@ func parseVariableWithBraces(line string, pos int, mapping func(string) string)
|
||||
if bufferString == "" {
|
||||
return "", 0, false
|
||||
}
|
||||
|
||||
return mapping(buffer.String()), pos, true
|
||||
case validVariableNameChar(c):
|
||||
buffer.WriteByte(c)
|
||||
case validVariableDefault(c, line, pos):
|
||||
defaultValue := ""
|
||||
defaultValue, pos, _ = parseDefaultValue(line, pos)
|
||||
defaultValues[buffer.String()] = defaultValue
|
||||
default:
|
||||
return "", 0, false
|
||||
}
|
||||
@@ -143,10 +176,19 @@ func Interpolate(key string, data *interface{}, environmentLookup EnvironmentLoo
|
||||
values := environmentLookup.Lookup(s, nil)
|
||||
|
||||
if len(values) == 0 {
|
||||
if val, ok := defaultValues[s]; ok {
|
||||
return val
|
||||
}
|
||||
logrus.Warnf("The %s variable is not set. Substituting a blank string.", s)
|
||||
return ""
|
||||
}
|
||||
|
||||
if strings.SplitN(values[0], "=", 2)[1] == "" {
|
||||
if val, ok := defaultValues[s]; ok {
|
||||
return val
|
||||
}
|
||||
}
|
||||
|
||||
// Use first result if many are given
|
||||
value := values[0]
|
||||
|
||||
|
||||
+2
-9
@@ -6,11 +6,12 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"reflect"
|
||||
|
||||
"github.com/docker/docker/pkg/urlutil"
|
||||
"github.com/docker/libcompose/utils"
|
||||
composeYaml "github.com/docker/libcompose/yaml"
|
||||
"gopkg.in/yaml.v2"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -229,19 +230,11 @@ func readEnvFile(resourceLookup ResourceLookup, inFile string, serviceData RawSe
|
||||
|
||||
serviceData["environment"] = vars
|
||||
|
||||
delete(serviceData, "env_file")
|
||||
|
||||
return serviceData, nil
|
||||
}
|
||||
|
||||
func mergeConfig(baseService, serviceData RawService) RawService {
|
||||
for k, v := range serviceData {
|
||||
// Image and build are mutually exclusive in merge
|
||||
if k == "image" {
|
||||
delete(baseService, "build")
|
||||
} else if k == "build" {
|
||||
delete(baseService, "image")
|
||||
}
|
||||
existing, ok := baseService[k]
|
||||
if ok {
|
||||
baseService[k] = merge(existing, v)
|
||||
|
||||
+22
-3
@@ -4,8 +4,8 @@ import (
|
||||
"fmt"
|
||||
"path"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/libcompose/utils"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// MergeServicesV1 merges a v1 compose file into an existing set of service configs
|
||||
@@ -29,7 +29,7 @@ func MergeServicesV1(existingServices *ServiceConfigs, environmentLookup Environ
|
||||
return nil, err
|
||||
}
|
||||
|
||||
data = mergeConfig(rawExistingService, data)
|
||||
data = mergeConfigV1(rawExistingService, data)
|
||||
}
|
||||
|
||||
datas[name] = data
|
||||
@@ -148,7 +148,7 @@ func parseV1(resourceLookup ResourceLookup, environmentLookup EnvironmentLookup,
|
||||
}
|
||||
}
|
||||
|
||||
baseService = mergeConfig(baseService, serviceData)
|
||||
baseService = mergeConfigV1(baseService, serviceData)
|
||||
|
||||
logrus.Debugf("Merged result %#v", baseService)
|
||||
|
||||
@@ -177,3 +177,22 @@ func resolveContextV1(inFile string, serviceData RawService) RawService {
|
||||
|
||||
return serviceData
|
||||
}
|
||||
|
||||
func mergeConfigV1(baseService, serviceData RawService) RawService {
|
||||
for k, v := range serviceData {
|
||||
// Image and build are mutually exclusive in merge
|
||||
if k == "image" {
|
||||
delete(baseService, "build")
|
||||
} else if k == "build" {
|
||||
delete(baseService, "image")
|
||||
}
|
||||
existing, ok := baseService[k]
|
||||
if ok {
|
||||
baseService[k] = merge(existing, v)
|
||||
} else {
|
||||
baseService[k] = v
|
||||
}
|
||||
}
|
||||
|
||||
return baseService
|
||||
}
|
||||
+1
-1
@@ -5,8 +5,8 @@ import (
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/libcompose/utils"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// MergeServicesV2 merges a v2 compose file into an existing set of service configs
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package lookup
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/runconfig/opts"
|
||||
"github.com/docker/cli/opts"
|
||||
"github.com/docker/libcompose/config"
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// relativePath returns the proper relative path for the given file path. If
|
||||
|
||||
+1
-1
@@ -9,9 +9,9 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/libcompose/config"
|
||||
"github.com/docker/libcompose/logger"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var projectRegexp = regexp.MustCompile("[^a-zA-Z0-9_.-]")
|
||||
|
||||
+1
-1
@@ -3,8 +3,8 @@ package project
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/libcompose/project/events"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
+2
-1
@@ -30,7 +30,8 @@ type Create struct {
|
||||
|
||||
// Run holds options of compose run.
|
||||
type Run struct {
|
||||
Detached bool
|
||||
Detached bool
|
||||
DisableTty bool
|
||||
}
|
||||
|
||||
// Up holds options of compose up.
|
||||
|
||||
+1
-1
@@ -10,13 +10,13 @@ import (
|
||||
|
||||
"golang.org/x/net/context"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/libcompose/config"
|
||||
"github.com/docker/libcompose/logger"
|
||||
"github.com/docker/libcompose/lookup"
|
||||
"github.com/docker/libcompose/project/events"
|
||||
"github.com/docker/libcompose/utils"
|
||||
"github.com/docker/libcompose/yaml"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// ComposeVersion is name of docker-compose.yml file syntax supported version
|
||||
|
||||
+5
@@ -2,6 +2,7 @@ package project
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
|
||||
@@ -12,6 +13,8 @@ import (
|
||||
// the Filter struct.
|
||||
func (p *Project) Containers(ctx context.Context, filter Filter, services ...string) ([]string, error) {
|
||||
containers := []string{}
|
||||
var lock sync.Mutex
|
||||
|
||||
err := p.forEach(services, wrapperAction(func(wrapper *serviceWrapper, wrappers map[string]*serviceWrapper) {
|
||||
wrapper.Do(nil, events.NoEvent, events.NoEvent, func(service Service) error {
|
||||
serviceContainers, innerErr := service.Containers(ctx)
|
||||
@@ -37,7 +40,9 @@ func (p *Project) Containers(ctx context.Context, filter Filter, services ...str
|
||||
return fmt.Errorf("Invalid container filter: %s", filter.State)
|
||||
}
|
||||
containerID := container.ID()
|
||||
lock.Lock()
|
||||
containers = append(containers, containerID)
|
||||
lock.Unlock()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import (
|
||||
|
||||
"golang.org/x/net/context"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// Scale scales the specified services.
|
||||
|
||||
+1
-1
@@ -3,8 +3,8 @@ package project
|
||||
import (
|
||||
"sync"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/libcompose/project/events"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type serviceWrapper struct {
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
+31
@@ -3,6 +3,8 @@ package yaml
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Networks represents a list of service networks in compose file.
|
||||
@@ -20,6 +22,35 @@ type Network struct {
|
||||
IPv6Address string `yaml:"ipv6_address,omitempty"`
|
||||
}
|
||||
|
||||
// Generate a hash string to detect service network config changes
|
||||
func (n *Networks) HashString() string {
|
||||
if n == nil {
|
||||
return ""
|
||||
}
|
||||
result := []string{}
|
||||
for _, net := range n.Networks {
|
||||
result = append(result, net.HashString())
|
||||
}
|
||||
sort.Strings(result)
|
||||
return strings.Join(result, ",")
|
||||
}
|
||||
|
||||
// Generate a hash string to detect service network config changes
|
||||
func (n *Network) HashString() string {
|
||||
if n == nil {
|
||||
return ""
|
||||
}
|
||||
result := []string{}
|
||||
result = append(result, n.Name)
|
||||
result = append(result, n.RealName)
|
||||
sort.Strings(n.Aliases)
|
||||
result = append(result, strings.Join(n.Aliases, ","))
|
||||
result = append(result, n.IPv4Address)
|
||||
result = append(result, n.IPv6Address)
|
||||
sort.Strings(result)
|
||||
return strings.Join(result, ",")
|
||||
}
|
||||
|
||||
// MarshalYAML implements the Marshaller interface.
|
||||
func (n Networks) MarshalYAML() (interface{}, error) {
|
||||
m := map[string]*Network{}
|
||||
|
||||
+14
@@ -3,6 +3,7 @@ package yaml
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -19,6 +20,19 @@ type Volume struct {
|
||||
AccessMode string `yaml:"-"`
|
||||
}
|
||||
|
||||
// Generate a hash string to detect service volume config changes
|
||||
func (v *Volumes) HashString() string {
|
||||
if v == nil {
|
||||
return ""
|
||||
}
|
||||
result := []string{}
|
||||
for _, vol := range v.Volumes {
|
||||
result = append(result, vol.String())
|
||||
}
|
||||
sort.Strings(result)
|
||||
return strings.Join(result, ",")
|
||||
}
|
||||
|
||||
// String implements the Stringer interface.
|
||||
func (v *Volume) String() string {
|
||||
var paths []string
|
||||
|
||||
Reference in new issue
Block a user