Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add jina version info to docker image name #1341

Merged
merged 1 commit into from
Nov 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jina/docker/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def remove_control_characters(s):


def safe_url_name(s):
return s.lower().replace('-', '--').replace('_', '__').replace(' ', '_')
return s.lower().replace('_', '__').replace(' ', '_')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a unittest on what is expected here? why did we remove that part?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was never used before and it was unnecessary (as discussed with @hanxiao ). The unittest in https://github.com/jina-ai/jina/pull/1341/files#diff-e63749458c2c70804a69ac37c0a560e869b070408233b988a219514a8df6cf31R55 covers it (the name format)



def get_exist_path(directory, s):
Expand Down
4 changes: 3 additions & 1 deletion jina/docker/hubio.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import webbrowser
from typing import Dict, Any

from jina import __version__ as jina_version
from .checker import *
from .helper import credentials_file
from .hubapi import _list, _register_to_mongodb, _list_local
Expand Down Expand Up @@ -488,7 +489,8 @@ def _check_completeness(self) -> Dict:

self.manifest = self._read_manifest(self.manifest_path)
self.dockerfile_path_revised = self._get_revised_dockerfile(self.dockerfile_path, self.manifest)
self.tag = safe_url_name(f'{self.args.repository}/' + '{type}.{kind}.{name}:{version}'.format(**self.manifest))
self.manifest['jina_version'] = jina_version
self.tag = safe_url_name(f'{self.args.repository}/' + '{type}.{kind}.{name}:{version}-{jina_version}'.format(**self.manifest))
self.canonical_name = safe_url_name(f'{self.args.repository}/' + '{type}.{kind}.{name}'.format(**self.manifest))
return completeness

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/hub_usage/test_hub_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import pytest

from jina import __version__ as jina_version
from jina.docker.hubio import HubIO
from jina.excepts import PeaFailToStart, HubBuilderError
from jina.executors import BaseExecutor
Expand Down Expand Up @@ -51,8 +52,7 @@ def test_use_from_local_dir_flow_container_level():
args = set_hub_build_parser().parse_args(
[os.path.join(cur_dir, 'dummyhub'), '--test-uses', '--raise-error'])
HubIO(args).build()

with Flow().add(uses='jinahub/pod.crafter.dummyhubexecutor:0.0.0'):
with Flow().add(uses=f'jinahub/pod.crafter.dummyhubexecutor:0.0.0-{jina_version}'):
pass


Expand Down