Repository: bentoml/BentoML

Issue:
bentoml retrieve fails after upgrading to 0.10.1
**Describe the bug**
I first upgraded my yatai-service from 0.9.2 to 0.10.1.
Then upgraded my traning pipeline to 0.10.1 - It worked flawlessly and stored newer versions of Model into S3 storage.
I then proceeded to build my BentoService via a custom Docker build.
Note - I use my own Dockerfile - with the command:

`RUN bentoml retrieve Service:latest --target_dir /bentoservice`

The Docker build broke with the following error:
```
|   File "/usr/local/lib/python3.8/site-packages/bentoml/cli/bento_management.py", line 256, in retrieve                                                       
|     yc.repository.download_to_directory(bento_pb, target_dir)                    |
|   File "/usr/local/lib/python3.8/site-packages/bentoml/yatai/client/bento_repository_api.py", line 255, in download_to_directory                             |
|     bento_service_bundle_path = bento_pb.bento.uri.s3_presigned_url              |
| AttributeError: bento                                                            |
| The command '/bin/sh -c bentoml retrieve Service:latest --target_dir /bentoservice' returned a non-zero code: 1                              |
```

**Environment:**
 - Python 3.7.1
 - BentoML-0.10.1
 - 


Discussion:
Ops. I guess just remove the `bento.` and it will work. @yubozhao 
@bojiang - Sorry, I didnt understand - Whhere do I remove the `bento.` ?
@jiyer2016
Sorry for the unclear reply.
I believe it is indeed a bug of bentoml. The comment I just made is for developers.
Thanks for reporting this issue. I will fix it and hopefully we can release a new patch before the holiday with this fix in. 

Resolving patch:
diff --git a/bentoml/yatai/client/bento_repository_api.py b/bentoml/yatai/client/bento_repository_api.py
--- a/bentoml/yatai/client/bento_repository_api.py
+++ b/bentoml/yatai/client/bento_repository_api.py
@@ -252,7 +252,7 @@ def _update_bento_upload_progress(
 
     def download_to_directory(self, bento_pb, target_dir):
         if bento_pb.uri.s3_presigned_url:
-            bento_service_bundle_path = bento_pb.bento.uri.s3_presigned_url
+            bento_service_bundle_path = bento_pb.uri.s3_presigned_url
         elif bento_pb.uri.gcs_presigned_url:
             bento_service_bundle_path = bento_pb.uri.gcs_presigned_url
         else:


Test patch:
diff --git a/ci/s3_bucket_integration_tests.sh b/ci/s3_bucket_integration_tests.sh
new file mode 100755
--- /dev/null
+++ b/ci/s3_bucket_integration_tests.sh
@@ -0,0 +1,19 @@
+set -x
+
+# Set err to 1 if pytest failed.
+error=0
+trap 'error=1' ERR
+
+GIT_ROOT=$(git rev-parse --show-toplevel)
+
+cd "$GIT_ROOT" || exit
+
+python -m pip install -e .
+
+# Install minio
+pip install minio
+
+# Run s3 tests
+python -m pytest -s "$GIT_ROOT"/tests/integration/test_s3.py
+
+test $error = 0 # Return non-zero if pytest failed
diff --git a/tests/integration/test_s3.py b/tests/integration/test_s3.py
new file mode 100644
--- /dev/null
+++ b/tests/integration/test_s3.py
@@ -0,0 +1,55 @@
+import os
+import subprocess
+
+import pytest
+from minio import Minio
+
+from bentoml.utils.tempdir import TempDirectory
+from bentoml.yatai.client import get_yatai_client
+from tests.bento_service_examples.example_bento_service import ExampleBentoService
+
+bucket_name = 'test-repo'
+
+
+@pytest.fixture()
+def minio_address():
+    client = Minio(
+        'localhost:9000',
+        access_key=os.getenv('AWS_ACCESS_KEY'),
+        secret_key=os.getenv('AWS_SECRET_ACCESS_KEY'),
+        secure=False,
+    )
+    client.make_bucket(bucket_name)
+    return 'localhost:9000'
+
+
+@pytest.mark.skip('Unable to connect minio on Github')
+def test_s3(minio_address):
+    yatai_server_command = [
+        'bentoml',
+        'yatai-service-start',
+        '--no-ui',
+        '--grpc-port',
+        '50051',
+        '--repo-base-url',
+        f's3://{bucket_name}/',
+        '--s3-endpoint-url',
+        'localhost:9000',
+    ]
+    proc = subprocess.Popen(
+        yatai_server_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE
+    )
+    yatai_server_url = "localhost:50051"
+    svc = ExampleBentoService()
+    svc.pack('model', {'model': 'abc'})
+    bento_tag = f'{svc.name}:{svc.version}'
+    saved_path = svc.save(yatai_url=yatai_server_url)
+    yc = get_yatai_client(yatai_server_url)
+
+    assert saved_path.startswith('s3://')
+
+    bento_pb = yc.repository.get(bento_tag)
+    with TempDirectory() as temp_dir:
+        yc.repository.download_to_directory(bento_pb, f'{temp_dir}/bundle')
+        assert os.path.exists(f'{temp_dir}/bundle/bentoml.yml')
+    proc.kill()