Skip to content

Commit f559233

Browse files
authored
Merge pull request #1122 from kmala/release
fix(release): Don't rollback if there is no build
2 parents 1dd4093 + eb2104a commit f559233

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

rootfs/api/models/app.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,9 @@ def deploy(self, release, force_deploy=False, rollback_on_failure=True): # noqa
498498
try:
499499
async_run(tasks)
500500
except KubeException as e:
501-
if rollback_on_failure:
501+
# Don't rollback if the previous release doesn't have a build which means
502+
# this is the first build and all the previous releases are just config changes.
503+
if rollback_on_failure and release.previous().build is not None:
502504
err = 'There was a problem deploying {}. Rolling back process types to release {}.'.format('v{}'.format(release.version), "v{}".format(release.previous().version)) # noqa
503505
# This goes in the log before the rollback starts
504506
self.log(err, logging.ERROR)

rootfs/api/tests/test_build.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,8 @@ def test_build_deploy_kube_failure(self, mock_requests):
655655
url = "/v2/apps/{app_id}/builds".format(**locals())
656656
body = {'image': 'autotest/example'}
657657
response = self.client.post(url, body)
658+
exp_error = {'detail': '(app::deploy): Boom!'}
659+
self.assertEqual(response.data, exp_error, response.data)
658660
self.assertEqual(response.status_code, 400, response.data)
659661

660662
def test_build_failures(self, mock_requests):

0 commit comments

Comments
 (0)