rdeploy 0.4.0__tar.gz → 0.4.1__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,3 +1,21 @@
1
+ ----
2
+ Version 0.4.1, Wed 28 Oct 2026
3
+ ===============================
4
+ - `rdeploy helm-setup` and the local helm path now use the machine's CPU
5
+ architecture, so Apple Silicon Macs get the native `darwin-arm64` build
6
+ instead of the x86_64 one (which fails without Rosetta, e.g. on macOS 27).
7
+ Linux arm64 gets `linux-arm64`. Unsupported architectures raise an error
8
+ instead of falling back to amd64.
9
+ - `rdeploy helm-setup` now runs `helm version` on the binary it installed and
10
+ fails with the error if it can't run, instead of printing
11
+ "Successfully installed".
12
+
13
+ UPGRADE NOTES:
14
+ - On Apple Silicon, run `rdeploy helm-setup <config>` once to download the
15
+ arm64 binary to `opt/helm-v<version>/darwin-arm64/`. The old
16
+ `opt/helm-v<version>/darwin-amd64/` directory is no longer used and can be
17
+ deleted.
18
+
1
19
  ----
2
20
  Version 0.4.0, Fri 10 Jul 2026
3
21
  ===============================
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rdeploy
3
- Version: 0.4.0
3
+ Version: 0.4.1
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
rdeploy-0.4.1/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.4.1
@@ -14,9 +14,9 @@ import json
14
14
  import re
15
15
 
16
16
  from packaging import version
17
- from rdeploy.exceptions import ReleaseError
17
+ from rdeploy.exceptions import ReleaseError, ExecuteError
18
18
 
19
- from rdeploy.utils import get_settings, confirm, get_helm_bin, yaml_decode_data_fields, build_management_cmd
19
+ from rdeploy.utils import get_settings, confirm, get_helm_bin, get_helm_os_string, yaml_decode_data_fields, build_management_cmd
20
20
 
21
21
  # Cluster Activation:
22
22
  #####################
@@ -677,15 +677,11 @@ def helm_setup(ctx, config):
677
677
  'use_system_helm: false')
678
678
  return
679
679
 
680
- if sys.platform == 'linux' or sys.platform == 'linux2':
681
- os_string = 'linux-amd64'
682
- archive_tool = tarfile
683
- elif sys.platform == 'darwin':
684
- os_string = 'darwin-amd64'
685
- archive_tool = tarfile
686
- elif sys.platform == 'win32':
687
- os_string = 'windows-amd64'
680
+ os_string = get_helm_os_string()
681
+ if sys.platform == 'win32':
688
682
  archive_tool = zipfile
683
+ else:
684
+ archive_tool = tarfile
689
685
 
690
686
  url = 'https://get.helm.sh/helm-v{version}-{os_string}.tar.gz'.format(version=helm_version,
691
687
  os_string=os_string)
@@ -695,6 +691,13 @@ def helm_setup(ctx, config):
695
691
 
696
692
  helm_bin = get_helm_bin(config_dict)
697
693
 
694
+ # Make sure the extracted binary actually runs on this machine (e.g. an
695
+ # x86_64 build on Apple Silicon without Rosetta) before reporting success.
696
+ result = ctx.run('{helm_bin} version'.format(helm_bin=helm_bin), warn=True, hide='both')
697
+ if result.failed:
698
+ raise ExecuteError('Installed helm binary at {helm_bin} failed to run:\n{error}'.format(
699
+ helm_bin=helm_bin, error=(result.stderr or result.stdout).strip()))
700
+
698
701
  provider = config_dict.get('cloud_provider')
699
702
  helm_registry = provider.get('helm_registry')
700
703
  if not helm_registry:
@@ -2,6 +2,7 @@ import os
2
2
  import yaml
3
3
  import json
4
4
  import base64
5
+ import platform as py_platform
5
6
 
6
7
 
7
8
  try:
@@ -65,20 +66,45 @@ def confirm(prompt='Continue?\n', failure_prompt='User cancelled task'):
65
66
  raise ParseError(failure_prompt)
66
67
 
67
68
 
69
+ def get_helm_arch() -> str:
70
+ """
71
+ Return the Helm release architecture for this machine ('amd64' or
72
+ 'arm64').
73
+ """
74
+ machine = py_platform.machine().lower()
75
+ if machine in ('arm64', 'aarch64'):
76
+ return 'arm64'
77
+ elif machine in ('x86_64', 'amd64'):
78
+ return 'amd64'
79
+ raise ExecuteError(f'Unsupported machine architecture for helm: {machine!r}')
80
+
81
+
82
+ def get_helm_os_string() -> str:
83
+ """
84
+ Return the Helm release '<os>-<arch>' string for this machine, e.g.
85
+ 'darwin-arm64'. It is used in the download URL and is also the name of
86
+ the folder the release archive extracts to.
87
+ """
88
+ if platform == 'linux' or platform == 'linux2':
89
+ os_name = 'linux'
90
+ elif platform == 'darwin':
91
+ os_name = 'darwin'
92
+ elif platform == 'win32':
93
+ os_name = 'windows'
94
+ else:
95
+ raise ExecuteError(f'Unsupported platform for helm: {platform!r}')
96
+
97
+ return f'{os_name}-{get_helm_arch()}'
98
+
99
+
68
100
  def get_helm_bin(config_dict: dict) -> str:
69
101
  if config_dict.get('use_system_helm', True):
70
102
  helm_bin = 'helm'
71
103
  else:
72
104
  helm_version = config_dict['helm_version']
73
- if platform == 'linux' or platform == 'linux2':
74
- folder = 'linux-amd64'
75
- helm_bin = f'opt/helm-v{helm_version}/{folder}/helm'
76
- elif platform == 'darwin':
77
- folder = 'darwin-amd64'
78
- helm_bin = f'opt/helm-v{helm_version}/{folder}/helm'
79
- elif platform == 'win32':
80
- folder = 'windows-amd64'
81
- helm_bin = f'opt/helm-v{helm_version}/{folder}/helm.exe'
105
+ folder = get_helm_os_string()
106
+ binary = 'helm.exe' if platform == 'win32' else 'helm'
107
+ helm_bin = f'opt/helm-v{helm_version}/{folder}/{binary}'
82
108
 
83
109
  return helm_bin
84
110
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rdeploy
3
- Version: 0.4.0
3
+ Version: 0.4.1
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
@@ -1,3 +1,2 @@
1
- build
2
1
  dist
3
2
  rdeploy
@@ -16,8 +16,9 @@ from rdeploy.tasks import (
16
16
  create_namespace,
17
17
  git_release,
18
18
  upgrade,
19
+ helm_setup,
19
20
  )
20
- from rdeploy.exceptions import ReleaseError
21
+ from rdeploy.exceptions import ReleaseError, ExecuteError
21
22
 
22
23
 
23
24
  @pytest.fixture
@@ -278,6 +279,62 @@ class TestCreateNamespace:
278
279
  assert 'kubectl create namespace staging-ns' in call_args
279
280
 
280
281
 
282
+ class TestHelmSetup:
283
+ # The download and extraction are mocked so nothing is fetched or
284
+ # written to disk.
285
+ @staticmethod
286
+ def settings():
287
+ return {
288
+ "configs": {
289
+ "staging": {
290
+ "helm_version": "3.12.0",
291
+ "use_system_helm": False,
292
+ "cloud_provider": {"name": "gcp", "helm_registry": None},
293
+ }
294
+ }
295
+ }
296
+
297
+ @pytest.mark.parametrize("sys_platform,machine,os_string", [
298
+ ("darwin", "arm64", "darwin-arm64"),
299
+ ("darwin", "x86_64", "darwin-amd64"),
300
+ ("linux", "aarch64", "linux-arm64"),
301
+ ("linux", "x86_64", "linux-amd64"),
302
+ ])
303
+ def test_download_url_matches_helm_bin(self, mock_ctx, sys_platform, machine, os_string):
304
+ mock_ctx.run.return_value = MagicMock(failed=False)
305
+ with patch('rdeploy.tasks.get_settings', return_value=self.settings()), \
306
+ patch('rdeploy.utils.platform', sys_platform), \
307
+ patch('rdeploy.tasks.sys.platform', sys_platform), \
308
+ patch('rdeploy.utils.py_platform.machine', return_value=machine), \
309
+ patch('rdeploy.tasks.urllib.request.urlretrieve', return_value=('/tmp/helm.tgz', None)) as mock_retrieve, \
310
+ patch('rdeploy.tasks.tarfile.open') as mock_tar_open:
311
+ helm_setup(mock_ctx, 'staging')
312
+
313
+ mock_retrieve.assert_called_once_with(
314
+ 'https://get.helm.sh/helm-v3.12.0-{}.tar.gz'.format(os_string), filename=None)
315
+ mock_tar_open.return_value.extractall.assert_called_once_with('./opt/helm-v3.12.0')
316
+ version_call = mock_ctx.run.call_args_list[0][0][0]
317
+ assert version_call == 'opt/helm-v3.12.0/{}/helm version'.format(os_string)
318
+ repo_call = mock_ctx.run.call_args_list[1][0][0]
319
+ assert repo_call.startswith('opt/helm-v3.12.0/{}/helm '.format(os_string))
320
+
321
+ def test_fails_when_binary_cannot_run(self, mock_ctx, capsys):
322
+ mock_ctx.run.return_value = MagicMock(
323
+ failed=True, stdout='', stderr='bash: opt/helm-v3.12.0/darwin-amd64/helm: Bad CPU type in executable\n')
324
+ with patch('rdeploy.tasks.get_settings', return_value=self.settings()), \
325
+ patch('rdeploy.utils.platform', 'darwin'), \
326
+ patch('rdeploy.tasks.sys.platform', 'darwin'), \
327
+ patch('rdeploy.utils.py_platform.machine', return_value='x86_64'), \
328
+ patch('rdeploy.tasks.urllib.request.urlretrieve', return_value=('/tmp/helm.tgz', None)), \
329
+ patch('rdeploy.tasks.tarfile.open'):
330
+ with pytest.raises(ExecuteError, match='Bad CPU type'):
331
+ helm_setup(mock_ctx, 'staging')
332
+
333
+ # Stops before adding repos and never reports success.
334
+ mock_ctx.run.assert_called_once()
335
+ assert 'Successfully installed' not in capsys.readouterr().out
336
+
337
+
281
338
  class TestUpgrade:
282
339
  # _watch_rollout is patched in every test so the progress watcher thread
283
340
  # never shells out to a real kubectl (and whatever cluster the local
@@ -2,16 +2,20 @@ import base64
2
2
  import json
3
3
  import os
4
4
  import tempfile
5
+ from unittest.mock import patch
5
6
 
6
7
  import pytest
7
8
  import yaml
8
9
 
10
+ from rdeploy.exceptions import ExecuteError
9
11
  from rdeploy.utils import (
10
12
  strtobool,
11
13
  get_path,
12
14
  format_yaml,
13
15
  get_settings,
14
16
  get_helm_bin,
17
+ get_helm_arch,
18
+ get_helm_os_string,
15
19
  decode_data_value,
16
20
  decode_data_fields,
17
21
  json_decode_data_fields,
@@ -93,6 +97,52 @@ class TestGetHelmBin:
93
97
  assert "3.12.0" in result
94
98
  assert "helm" in result
95
99
 
100
+ @pytest.mark.parametrize("sys_platform,machine,expected", [
101
+ ("darwin", "arm64", "opt/helm-v3.12.0/darwin-arm64/helm"),
102
+ ("darwin", "x86_64", "opt/helm-v3.12.0/darwin-amd64/helm"),
103
+ ("linux", "aarch64", "opt/helm-v3.12.0/linux-arm64/helm"),
104
+ ("linux", "x86_64", "opt/helm-v3.12.0/linux-amd64/helm"),
105
+ ("win32", "AMD64", "opt/helm-v3.12.0/windows-amd64/helm.exe"),
106
+ ])
107
+ def test_local_helm_path_per_platform(self, sys_platform, machine, expected):
108
+ config = {"use_system_helm": False, "helm_version": "3.12.0"}
109
+ with patch("rdeploy.utils.platform", sys_platform), \
110
+ patch("rdeploy.utils.py_platform.machine", return_value=machine):
111
+ assert get_helm_bin(config) == expected
112
+
113
+
114
+ class TestGetHelmOsString:
115
+ @pytest.mark.parametrize("machine,expected", [
116
+ ("arm64", "arm64"),
117
+ ("aarch64", "arm64"),
118
+ ("x86_64", "amd64"),
119
+ ("AMD64", "amd64"),
120
+ ])
121
+ def test_arch(self, machine, expected):
122
+ with patch("rdeploy.utils.py_platform.machine", return_value=machine):
123
+ assert get_helm_arch() == expected
124
+
125
+ def test_unsupported_arch_raises(self):
126
+ with patch("rdeploy.utils.py_platform.machine", return_value="mips"):
127
+ with pytest.raises(ExecuteError):
128
+ get_helm_arch()
129
+
130
+ @pytest.mark.parametrize("sys_platform,expected", [
131
+ ("linux", "linux-arm64"),
132
+ ("linux2", "linux-arm64"),
133
+ ("darwin", "darwin-arm64"),
134
+ ("win32", "windows-arm64"),
135
+ ])
136
+ def test_os_string(self, sys_platform, expected):
137
+ with patch("rdeploy.utils.platform", sys_platform), \
138
+ patch("rdeploy.utils.py_platform.machine", return_value="arm64"):
139
+ assert get_helm_os_string() == expected
140
+
141
+ def test_unsupported_platform_raises(self):
142
+ with patch("rdeploy.utils.platform", "sunos5"):
143
+ with pytest.raises(ExecuteError):
144
+ get_helm_os_string()
145
+
96
146
 
97
147
  class TestDecodeDataValue:
98
148
  def test_decodes_plain_string(self):
rdeploy-0.4.0/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.4.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