rdeploy 0.2.0__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,18 @@
1
1
  ----
2
+ Version 0.3.0, Thu 09 Jul 2026
3
+ ===============================
4
+ - `rdeploy upgrade` now runs helm with `--atomic` by default: helm waits for
5
+ the rollout to complete (up to `--timeout`, default 15m) and automatically
6
+ rolls back to the previous release if it fails, and the command exits with
7
+ an error instead of reporting success.
8
+ - Added `--no-atomic` to restore the previous fire-and-forget behaviour and
9
+ `--timeout` to adjust how long helm waits.
10
+
11
+ BREAKING CHANGES:
12
+ - `rdeploy upgrade` now blocks until the rollout completes and exits non-zero
13
+ on failure. Scripts that relied on it returning immediately should pass
14
+ `--no-atomic`.
15
+
2
16
  Version 0.2.0, Thu 09 Jul 2026
3
17
  ===============================
4
18
  - Upgraded all dependencies to current versions: invoke 2.2+/3.x, semver 3.x,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rdeploy
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: CLI that makes it easy to build and deploy an application to k8s.
5
5
  Author-email: Rehive <info@rehive.com>
6
6
  License: MIT
@@ -73,7 +73,7 @@ rdeploy git-release patch
73
73
  | `set-context` | Switch cluster and namespace context |
74
74
  | `activate` | Fetch and set project, cluster, and namespace |
75
75
  | `install` | Install a Helm chart deployment |
76
- | `upgrade` | Upgrade a Helm deployment to a new image tag |
76
+ | `upgrade` | Upgrade a Helm deployment to a new image tag (atomic by default: waits for the rollout and rolls back on failure; use `--no-atomic` to skip, `--timeout` to adjust the wait, default `15m`) |
77
77
  | `helm` | Run arbitrary Helm commands |
78
78
  | `helm-setup` | Download and configure a local Helm binary |
79
79
  | `git-release` | Bump version and push a git tag |
@@ -36,7 +36,7 @@ rdeploy git-release patch
36
36
  | `set-context` | Switch cluster and namespace context |
37
37
  | `activate` | Fetch and set project, cluster, and namespace |
38
38
  | `install` | Install a Helm chart deployment |
39
- | `upgrade` | Upgrade a Helm deployment to a new image tag |
39
+ | `upgrade` | Upgrade a Helm deployment to a new image tag (atomic by default: waits for the rollout and rolls back on failure; use `--no-atomic` to skip, `--timeout` to adjust the wait, default `15m`) |
40
40
  | `helm` | Run arbitrary Helm commands |
41
41
  | `helm-setup` | Download and configure a local Helm binary |
42
42
  | `git-release` | Bump version and push a git tag |
rdeploy-0.3.0/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.3.0
@@ -371,9 +371,14 @@ def install(ctx, config):
371
371
 
372
372
 
373
373
  @task
374
- def upgrade(ctx, config, tag):
374
+ def upgrade(ctx, config, tag, atomic=True, timeout='15m'):
375
375
  """
376
376
  Upgrades kubernetes deployment
377
+
378
+ By default the upgrade runs atomically: helm waits for the rollout to
379
+ complete and rolls back to the previous release if it fails, and the
380
+ task exits with an error. Use --no-atomic to restore the old
381
+ fire-and-forget behaviour, and --timeout to change how long helm waits.
377
382
  """
378
383
 
379
384
  settings_dict = get_settings()
@@ -391,17 +396,31 @@ def upgrade(ctx, config, tag):
391
396
  else:
392
397
  helm_chart = config_dict['helm_chart']
393
398
 
394
- ctx.run('{helm_bin} upgrade {project_name} '
395
- '--values {helm_values_path} '
396
- '--set image.tag={version} '
397
- '--version {helm_chart_version} {helm_chart}'
398
- .format(helm_bin=helm_bin,
399
- project_name=config_dict['project_name'],
400
- helm_chart=helm_chart,
401
- helm_values_path=config_dict['helm_values_path'],
402
- version=tag,
403
- helm_chart_version=config_dict['helm_chart_version']),
404
- echo=True)
399
+ atomic_flags = ' --atomic --timeout {timeout}'.format(timeout=timeout) if atomic else ''
400
+
401
+ result = ctx.run('{helm_bin} upgrade {project_name} '
402
+ '--values {helm_values_path} '
403
+ '--set image.tag={version} '
404
+ '--version {helm_chart_version}{atomic_flags} {helm_chart}'
405
+ .format(helm_bin=helm_bin,
406
+ project_name=config_dict['project_name'],
407
+ helm_chart=helm_chart,
408
+ helm_values_path=config_dict['helm_values_path'],
409
+ version=tag,
410
+ helm_chart_version=config_dict['helm_chart_version'],
411
+ atomic_flags=atomic_flags),
412
+ echo=True, warn=True)
413
+
414
+ if result.failed:
415
+ if atomic:
416
+ sys.exit('Upgrade of {project_name} to {version} failed.'
417
+ ' Helm rolled the release back to the previous version.'
418
+ .format(project_name=config_dict['project_name'],
419
+ version=tag))
420
+ else:
421
+ sys.exit('Upgrade of {project_name} to {version} failed.'
422
+ .format(project_name=config_dict['project_name'],
423
+ version=tag))
405
424
 
406
425
 
407
426
  @task
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rdeploy
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: CLI that makes it easy to build and deploy an application to k8s.
5
5
  Author-email: Rehive <info@rehive.com>
6
6
  License: MIT
@@ -73,7 +73,7 @@ rdeploy git-release patch
73
73
  | `set-context` | Switch cluster and namespace context |
74
74
  | `activate` | Fetch and set project, cluster, and namespace |
75
75
  | `install` | Install a Helm chart deployment |
76
- | `upgrade` | Upgrade a Helm deployment to a new image tag |
76
+ | `upgrade` | Upgrade a Helm deployment to a new image tag (atomic by default: waits for the rollout and rolls back on failure; use `--no-atomic` to skip, `--timeout` to adjust the wait, default `15m`) |
77
77
  | `helm` | Run arbitrary Helm commands |
78
78
  | `helm-setup` | Download and configure a local Helm binary |
79
79
  | `git-release` | Bump version and push a git tag |
@@ -15,6 +15,7 @@ from rdeploy.tasks import (
15
15
  set_context,
16
16
  create_namespace,
17
17
  git_release,
18
+ upgrade,
18
19
  )
19
20
  from rdeploy.exceptions import ReleaseError
20
21
 
@@ -277,6 +278,50 @@ class TestCreateNamespace:
277
278
  assert 'kubectl create namespace staging-ns' in call_args
278
279
 
279
280
 
281
+ class TestUpgrade:
282
+ def test_atomic_by_default(self, mock_ctx, sample_settings_v3):
283
+ mock_ctx.run.return_value = MagicMock(failed=False)
284
+ with patch('rdeploy.tasks.get_settings', return_value=yaml.safe_load(open(sample_settings_v3))):
285
+ with patch('rdeploy.tasks.set_context'):
286
+ upgrade(mock_ctx, 'staging', tag='1.2.3')
287
+ call_args = mock_ctx.run.call_args[0][0]
288
+ assert 'helm upgrade my-project' in call_args
289
+ assert '--set image.tag=1.2.3' in call_args
290
+ assert '--atomic --timeout 15m' in call_args
291
+
292
+ def test_custom_timeout(self, mock_ctx, sample_settings_v3):
293
+ mock_ctx.run.return_value = MagicMock(failed=False)
294
+ with patch('rdeploy.tasks.get_settings', return_value=yaml.safe_load(open(sample_settings_v3))):
295
+ with patch('rdeploy.tasks.set_context'):
296
+ upgrade(mock_ctx, 'staging', tag='1.2.3', timeout='15m')
297
+ call_args = mock_ctx.run.call_args[0][0]
298
+ assert '--atomic --timeout 15m' in call_args
299
+
300
+ def test_no_atomic_opt_out(self, mock_ctx, sample_settings_v3):
301
+ mock_ctx.run.return_value = MagicMock(failed=False)
302
+ with patch('rdeploy.tasks.get_settings', return_value=yaml.safe_load(open(sample_settings_v3))):
303
+ with patch('rdeploy.tasks.set_context'):
304
+ upgrade(mock_ctx, 'staging', tag='1.2.3', atomic=False)
305
+ call_args = mock_ctx.run.call_args[0][0]
306
+ assert '--atomic' not in call_args
307
+ assert '--timeout' not in call_args
308
+
309
+ def test_failed_upgrade_exits_with_rollback_message(self, mock_ctx, sample_settings_v3):
310
+ mock_ctx.run.return_value = MagicMock(failed=True)
311
+ with patch('rdeploy.tasks.get_settings', return_value=yaml.safe_load(open(sample_settings_v3))):
312
+ with patch('rdeploy.tasks.set_context'):
313
+ with pytest.raises(SystemExit, match='rolled the release back'):
314
+ upgrade(mock_ctx, 'staging', tag='1.2.3')
315
+
316
+ def test_failed_non_atomic_upgrade_exits(self, mock_ctx, sample_settings_v3):
317
+ mock_ctx.run.return_value = MagicMock(failed=True)
318
+ with patch('rdeploy.tasks.get_settings', return_value=yaml.safe_load(open(sample_settings_v3))):
319
+ with patch('rdeploy.tasks.set_context'):
320
+ with pytest.raises(SystemExit, match='failed') as exc_info:
321
+ upgrade(mock_ctx, 'staging', tag='1.2.3', atomic=False)
322
+ assert 'rolled the release back' not in str(exc_info.value)
323
+
324
+
280
325
  class TestGitRelease:
281
326
  def test_creates_and_pushes_tag(self, mock_ctx):
282
327
  with patch('rdeploy.tasks.confirm'):
rdeploy-0.2.0/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.2.0
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes