|
|
|
@ -49,6 +49,9 @@ var (
|
|
|
|
|
|
|
|
|
|
// SupportedOS is the list of operating system names that the worker supports.
|
|
|
|
|
SupportedOS = []string{"debian", "ubuntu", "centos"}
|
|
|
|
|
|
|
|
|
|
// SupportedImageFormat is the list of image formats that the worker supports.
|
|
|
|
|
SupportedImageFormat = []string{"Docker", "ACI"}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Process detects the OS of a layer, the packages it installs/removes, and
|
|
|
|
@ -60,8 +63,22 @@ func Process(ID, parentID, path string, imageFormat string) error {
|
|
|
|
|
if path == "" {
|
|
|
|
|
return cerrors.NewBadRequestError("could not process a layer which does not have a path")
|
|
|
|
|
}
|
|
|
|
|
if imageFormat == "" {
|
|
|
|
|
return cerrors.NewBadRequestError("could not process a layer which does not have a specified format")
|
|
|
|
|
} else {
|
|
|
|
|
isSupported := false
|
|
|
|
|
for _, format := range SupportedImageFormat {
|
|
|
|
|
if strings.EqualFold(imageFormat, format) {
|
|
|
|
|
isSupported = true
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if !isSupported {
|
|
|
|
|
return cerrors.NewBadRequestError("could not process a layer which does not have a supported format")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log.Debugf("layer %s: processing (Location: %s, Engine version: %d, Parent: %s, format: %s)", ID, utils.CleanURL(path), Version, parentID, imageFormat)
|
|
|
|
|
log.Debugf("layer %s: processing (Location: %s, Engine version: %d, Parent: %s, Format: %s)", ID, utils.CleanURL(path), Version, parentID, imageFormat)
|
|
|
|
|
|
|
|
|
|
// Check to see if the layer is already in the database.
|
|
|
|
|
layer, err := database.FindOneLayerByID(ID, []string{database.FieldLayerEngineVersion})
|
|
|
|
|