cnabio / duffle

CNAB installer
https://duffle.sh
MIT License
375 stars 54 forks source link

duffle export should only try to export 'docker' and 'oci' images #733

Open radu-matei opened 5 years ago

radu-matei commented 5 years ago

Trying to export a test bundle that also contains an image type that is neither docker, nor oci results in an error:

Error: Error preparing artifacts: Error pulling image c: Error response from daemon: pull access denied for c, repository does not exist or may require 'docker login'

Test bundle:

{
  "name": "testrelocate",
  "version": "0.1",
  "description": "a bundle with images",
  "invocationImages": [
    {
      "image": "technosophos/helloworld:0.1.0",
      "imageType": "docker"
    }
  ],
  "images": {
    "a": {
      "description": "digested oci",
      "image": "deislabs/duffle@sha256:4d41eeb38fb14266b7c0461ef1ef0b2f8c05f41cd544987a259a9d92cdad2540",
      "digest": "sha256:4d41eeb38fb14266b7c0461ef1ef0b2f8c05f41cd544987a259a9d92cdad2540",
      "imageType": "oci"
    },
    "b": {
      "description": "tagged docker",
      "image": "deislabs/duffle:0.1.0-ralpha.5-englishrose",
      "digest": "sha256:14d6134d892aeccb7e142557fe746ccd0a8f736a747c195ef04c9f3f0f0bbd49",
      "imageType": "docker"
    },
    "c": {
      "description": "neither oci nor docker",
      "image": "c",
      "imageType": "c"
    }
  }
}
glyn commented 5 years ago

If duffle was to ignore images with types other than oci and docker, then the exported bundle would be incomplete, so I suggest the safest fix to this issue is to fail with an error "unsupported image type: c". That would also allow for support for other image types to be added in the future without breaking backwards compatibility .