Skip to content
This repository has been archived by the owner on Apr 4, 2019. It is now read-only.

Commit

Permalink
feat: add rollback command
Browse files Browse the repository at this point in the history
  • Loading branch information
Ladislav Prskavec committed Jun 12, 2018
1 parent deb040c commit e907e83
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
12 changes: 12 additions & 0 deletions blackbelt/commands/rollback.py
@@ -0,0 +1,12 @@
import click

from blackbelt.deployment import (
rollback_production
)


@click.group(invoke_without_command=True, help="""
Rollback latest version from production environments (prod, pre, qa)
""")
def cli():
rollback_production()
14 changes: 11 additions & 3 deletions blackbelt/deployment.py
Expand Up @@ -15,9 +15,9 @@ def deploy_production():
post_message("Deploying to production", "#deploy-queue")

slug_creaction_return_code = run_grunt_in_parallel((
['grunt', 'create-slug'],
['grunt', 'create-slug', '--app=apiary-staging-pre'],
['grunt', 'create-slug', '--app=apiary-staging-qa'],
['grunt', 'deploy-slug'],
['grunt', 'deploy-slug', '--app=apiary-staging-pre'],
['grunt', 'deploy-slug', '--app=apiary-staging-qa'],
))

if slug_creaction_return_code != 0:
Expand All @@ -27,3 +27,11 @@ def deploy_production():
check_output(['grunt', 'deploy-slug', '--app=apiary-staging-qa'])
check_output(['grunt', 'deploy-slug', '--app=apiary-staging-pre'])
check_output(['grunt', 'deploy-slug'])

def rollback_production():

post_message("Rollback production for all environments (prod, qa, pre)", "#deploy-queue")

check_call(['grunt', 'rollback', '--app=apiary-staging-qa'])
check_call(['grunt', 'rollback', '--app=apiary-staging-pre'])
check_call(['grunt', 'rollback'])

0 comments on commit e907e83

Please sign in to comment.