def generate_service_bump_commit_message(repo, service_name, env, tag, author=None):
"""Generates an appropriate service bump commit message.
Args:
repo (git.objects.Repo): The git repository to commit against
service_name (str): The service/app you're bumping
env (str): The infrastructure you're bumping against
tag (str): The service/app artifact tag (e.g. Docker tag)
author (Optional[git.objects.Actor]): Commit author, host user by default
Returns:
str: The formatted bump commit message
"""
env_name = env or 'default' # Show 'default' if a repo does not have a default environment
author = author if author else helpers.get_host_author(repo)
return '\n'.join([
'chore(tfvars): bump %s#%s "%s"' % (service_name, tag[:7], env_name,),
'\n'
'committed-by: %s <%s>' % (author.name, author.email,),
'service-name: %s' % (service_name,),
'service-tag: %s' % (tag,),
'environment: %s' % (env_name,),
'\n'
'Committed via Mimiron v%s (https://github.com/ImageIntelligence/mimiron)' % (__version__,),
])
评论列表
文章目录