def is_docker_image_latest_tag(self): if 'demisto/python:1.3-alpine' == f'{self.docker_image_name}:{self.docker_image_tag}': # the docker image is the default one error_message, error_code = Errors.default_docker_error() if self.handle_error(error_message, error_code, file_path=self.file_path): self.is_latest_tag = False return self.is_latest_tag # ignore tag or non-demisto docker issues if self.docker_image_latest_tag == "no-tag-required": return self.is_latest_tag if not self.docker_image_name or not self.docker_image_latest_tag: # If the docker image isn't in the format we expect it to be or we failed fetching the tag # We don't want to print any error msgs to user because they have already been printed # see parse_docker_image for the errors self.is_latest_tag = False return self.is_latest_tag if self.docker_image_latest_tag != self.docker_image_tag: # If docker image tag is not the most updated one that exists in docker-hub error_message, error_code = Errors.docker_not_on_the_latest_tag( self.docker_image_tag, self.docker_image_latest_tag, self.is_iron_bank) suggested_fix = Errors.suggest_docker_fix(self.docker_image_name, self.file_path, self.is_iron_bank) if self.handle_error(error_message, error_code, file_path=self.file_path, suggested_fix=suggested_fix): self.is_latest_tag = False else: # if this error is ignored - do print it as a warning self.handle_error(error_message, error_code, file_path=self.file_path, warning=True) # the most updated tag should be numeric and not labeled "latest" if self.docker_image_latest_tag == "latest": error_message, error_code = Errors.latest_docker_error( self.docker_image_tag, self.docker_image_name) if self.handle_error(error_message, error_code, file_path=self.file_path): self.is_latest_tag = False return self.is_latest_tag
def is_docker_image_latest_tag(self): if 'demisto/python:1.3-alpine' == f'{self.docker_image_name}:{self.docker_image_tag}': # the docker image is the default one error_message, error_code = Errors.default_docker_error() if self.handle_error(error_message, error_code, file_path=self.file_path): self.is_latest_tag = False return self.is_latest_tag # ignore tag or non-demisto docker issues if self.docker_image_latest_tag == "no-tag-required": return self.is_latest_tag if not self.docker_image_name or not self.docker_image_latest_tag: # If the docker image isn't in the format we expect it to be or we failed fetching the tag # We don't want to print any error msgs to user because they have already been printed # see parse_docker_image for the errors self.is_latest_tag = False return self.is_latest_tag if self.docker_image_latest_tag != self.docker_image_tag: # If docker image tag is not the most updated one that exists in docker-hub print_warning( 'The docker image tag is not the latest, please update it.\n' 'The docker image tag in the yml file is: {}\n' 'The latest docker image tag in docker hub is: {}\n' 'You can check for the most updated version of {} here: https://hub.docker.com/r/{}/tags\n' .format(self.docker_image_tag, self.docker_image_latest_tag, self.docker_image_name, self.docker_image_name)) # the most updated tag should be numeric and not labeled "latest" if self.docker_image_latest_tag == "latest": error_message, error_code = Errors.latest_docker_error( self.docker_image_tag, self.docker_image_name) if self.handle_error(error_message, error_code, file_path=self.file_path): self.is_latest_tag = False return self.is_latest_tag