Update docker images utils
@@ -38,16 +38,35 @@ def get_notebook_image_info(project: 'Project', job: Any) -> Tuple[str, str]:
return image_name, LATEST_IMAGE_TAG
-def get_image_name(build_job: 'BuildJob') -> str:
+def get_project_image_name(project_name: str, project_id: int) -> str:
return '{}/{}_{}'.format(conf.get('REGISTRY_HOST'),
- build_job.project.name.lower(),
- build_job.project.id)
+ project_name.lower(),
+ project_id)
+
+
+def get_project_image_info(project_name: str, project_id: int, image_tag: str) -> Tuple[str, str]:
+ return get_project_image_name(project_name=project_name, project_id=project_id), image_tag
+
+
+def get_project_tagged_image(project_name: str, project_id: int, image_tag: str) -> str:
+ image_name, image_tag = get_project_image_info(project_name=project_name,
+ project_id=project_id,
+ image_tag=image_tag)
+ return '{}:{}'.format(image_name, image_tag)
+
+
+def get_image_name(build_job: 'BuildJob') -> str:
+ return get_project_image_name(project_name=build_job.project.name,
+ project_id=build_job.project.id)
def get_image_info(build_job: 'BuildJob') -> Tuple[str, str]:
- return get_image_name(build_job=build_job), build_job.uuid.hex
+ return get_project_image_info(project_name=build_job.project.name,
+ project_id=build_job.project.id,
+ image_tag=build_job.uuid.hex)
def get_tagged_image(build_job: 'BuildJob') -> str:
- image_name, image_tag = get_image_info(build_job)
- return '{}:{}'.format(image_name, image_tag)
+ return get_project_tagged_image(project_name=build_job.project.name,
+ project_id=build_job.project.id,
+ image_tag=build_job.uuid.hex)
