rdeploy 0.5.4__tar.gz → 0.5.6__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.
Files changed (28) hide show
  1. rdeploy-0.5.6/CHANGES.txt +302 -0
  2. {rdeploy-0.5.4/rdeploy.egg-info → rdeploy-0.5.6}/PKG-INFO +1 -1
  3. rdeploy-0.5.6/VERSION +1 -0
  4. {rdeploy-0.5.4 → rdeploy-0.5.6}/rdeploy/helm_chart.py +30 -10
  5. {rdeploy-0.5.4 → rdeploy-0.5.6}/rdeploy/tasks.py +11 -5
  6. {rdeploy-0.5.4 → rdeploy-0.5.6/rdeploy.egg-info}/PKG-INFO +1 -1
  7. {rdeploy-0.5.4 → rdeploy-0.5.6}/rdeploy.egg-info/SOURCES.txt +2 -0
  8. rdeploy-0.5.6/requirements.txt +7 -0
  9. {rdeploy-0.5.4 → rdeploy-0.5.6}/tests/test_helm_chart.py +32 -5
  10. rdeploy-0.5.4/VERSION +0 -1
  11. {rdeploy-0.5.4 → rdeploy-0.5.6}/LICENSE +0 -0
  12. {rdeploy-0.5.4 → rdeploy-0.5.6}/README.md +0 -0
  13. {rdeploy-0.5.4 → rdeploy-0.5.6}/pyproject.toml +0 -0
  14. {rdeploy-0.5.4 → rdeploy-0.5.6}/rdeploy/__init__.py +0 -0
  15. {rdeploy-0.5.4 → rdeploy-0.5.6}/rdeploy/exceptions.py +0 -0
  16. {rdeploy-0.5.4 → rdeploy-0.5.6}/rdeploy/gke_auth.py +0 -0
  17. {rdeploy-0.5.4 → rdeploy-0.5.6}/rdeploy/main.py +0 -0
  18. {rdeploy-0.5.4 → rdeploy-0.5.6}/rdeploy/utils.py +0 -0
  19. {rdeploy-0.5.4 → rdeploy-0.5.6}/rdeploy.egg-info/dependency_links.txt +0 -0
  20. {rdeploy-0.5.4 → rdeploy-0.5.6}/rdeploy.egg-info/entry_points.txt +0 -0
  21. {rdeploy-0.5.4 → rdeploy-0.5.6}/rdeploy.egg-info/requires.txt +0 -0
  22. {rdeploy-0.5.4 → rdeploy-0.5.6}/rdeploy.egg-info/top_level.txt +0 -0
  23. {rdeploy-0.5.4 → rdeploy-0.5.6}/setup.cfg +0 -0
  24. {rdeploy-0.5.4 → rdeploy-0.5.6}/tests/test_exceptions.py +0 -0
  25. {rdeploy-0.5.4 → rdeploy-0.5.6}/tests/test_gke_auth.py +0 -0
  26. {rdeploy-0.5.4 → rdeploy-0.5.6}/tests/test_main.py +0 -0
  27. {rdeploy-0.5.4 → rdeploy-0.5.6}/tests/test_tasks.py +0 -0
  28. {rdeploy-0.5.4 → rdeploy-0.5.6}/tests/test_utils.py +0 -0
@@ -0,0 +1,302 @@
1
+ Version 0.5.6, unreleased
2
+ ===============================
3
+ - `rdeploy upload-static`, `rdeploy create-bucket` and
4
+ `rdeploy create-public-bucket` now use `gcloud storage` instead of
5
+ `gsutil`. Under certificate-based access, `gsutil` doesn't send the device
6
+ certificate and Google rejected it with "access_denied: Account
7
+ restricted". `upload-static` still deletes files in the bucket that are no
8
+ longer in `var/www/static`, as `gsutil rsync -d` did.
9
+
10
+ ----
11
+ Version 0.5.5, unreleased
12
+ ===============================
13
+ - `rdeploy install` and `rdeploy upgrade` no longer need the
14
+ `containeranalysis.occurrences.list` permission to download a chart from
15
+ Artifact Registry. They used `gcloud artifacts docker images describe` to
16
+ find the chart's digest, which also queries Container Analysis, and failed
17
+ with "Permission 'containeranalysis.occurrences.list' denied" for anyone
18
+ without it. They now list the chart's versions instead, which only needs
19
+ read access to the repository.
20
+
21
+ ----
22
+ Version 0.5.4, unreleased
23
+ ===============================
24
+ - `rdeploy install` and `rdeploy upgrade` check gcloud's login before
25
+ downloading a chart from Artifact Registry. When the login has expired or
26
+ is missing, they ask before running `gcloud auth login` (Enter means no),
27
+ and without a terminal they stop with the command to run. A password or
28
+ security-key reauthentication is still prompted by gcloud as before.
29
+ - Chart downloads no longer print gcloud's progress boxes; errors still show.
30
+
31
+ ----
32
+ Version 0.5.3, unreleased
33
+ ===============================
34
+ - `rdeploy install` and `rdeploy upgrade` now download charts from Artifact
35
+ Registry (`helm_registry`) with gcloud and pass Helm the local archive,
36
+ checked against the chart's digest. They no longer run `helm registry
37
+ login`, which fails with "401: unauthorized: authentication failed" when
38
+ the organization requires certificate-based access. Charts from other
39
+ Helm repositories are unchanged.
40
+
41
+ ----
42
+ Version 0.5.2, unreleased
43
+ ===============================
44
+ - `rdeploy kubectl-login` now signs gcloud in again when it needs to, before
45
+ reading the OAuth client. A password or security-key reauthentication is
46
+ prompted in the terminal as before; when gcloud's login has expired or
47
+ there is none, it runs `gcloud auth login` (browser) for you instead of
48
+ failing with "please run gcloud auth login".
49
+
50
+ ----
51
+ Version 0.5.1, unreleased
52
+ ===============================
53
+ - `rdeploy kubectl-login` no longer fails when gcloud needs you to
54
+ reauthenticate ("Reauthentication failed. cannot prompt during
55
+ non-interactive execution"). It now lets gcloud's prompts and errors reach
56
+ the terminal, so gcloud can ask for your password, and only captures
57
+ gcloud's output.
58
+
59
+ ----
60
+ Version 0.5.0, Fri 20 Nov 2026
61
+ ===============================
62
+ - New `rdeploy kubectl-login` signs kubectl in to GKE under Google Cloud
63
+ certificate-based access (CBA). It reads a CBA-exempt Desktop OAuth client
64
+ from Secret Manager with your gcloud login, signs in through it (loopback +
65
+ PKCE) asking only for `openid email container.read-only`, writes an
66
+ `authorized_user` credentials file (0600), adds any missing clusters to the
67
+ kubeconfig and points their contexts at a `gke-gcloud-auth-plugin` user
68
+ that uses those credentials. Clusters are discovered with
69
+ `gcloud container clusters list`. The project comes from `--gcp-project`,
70
+ `RDEPLOY_KUBECTL_PROJECT`, the settings saved on the first run, or the
71
+ current directory's `rdeploy.yaml`; the secret from `--secret`,
72
+ `RDEPLOY_KUBECTL_SECRET`, saved settings, or the default
73
+ `kubectl-oauth-client`. Run from a project directory, it needs no flags.
74
+ - `rdeploy kubectl-login --status` checks whether the saved session is still
75
+ valid and prints the command to sign in again if not.
76
+
77
+ ----
78
+ Version 0.4.3, Thu 19 Nov 2026
79
+ ===============================
80
+ - Every kubectl and helm command rdeploy runs now names the config's kube
81
+ context and namespace explicitly (`--context`/`--namespace` for kubectl,
82
+ `--kube-context`/`--namespace` for helm) instead of relying on the
83
+ kubeconfig's current context and namespace. That state is shared by every
84
+ terminal on the machine, so switching namespace elsewhere (e.g. `kubens`)
85
+ while a command ran could send it to the wrong namespace. An atomic
86
+ `helm upgrade` resolves the namespace again when it rolls back, so a
87
+ rollback could recreate the release's objects in another namespace.
88
+ - Covers `upgrade` (and its rollout progress display), `install`, `helm`,
89
+ `live-image`, `upload-secrets`, `decode-secret`, `create-namespace`, and
90
+ the management pod started by `shell` and `manage`.
91
+ - `set-context` still switches your local kubectl to the config's cluster
92
+ and namespace, but rdeploy's own commands no longer depend on it.
93
+
94
+ ----
95
+ ----
96
+ Version 0.4.1, Wed 28 Oct 2026
97
+ ===============================
98
+ - `rdeploy helm-setup` and the local helm path now use the machine's CPU
99
+ architecture, so Apple Silicon Macs get the native `darwin-arm64` build
100
+ instead of the x86_64 one (which fails without Rosetta, e.g. on macOS 27).
101
+ Linux arm64 gets `linux-arm64`. Unsupported architectures raise an error
102
+ instead of falling back to amd64.
103
+ - `rdeploy helm-setup` now runs `helm version` on the binary it installed and
104
+ fails with the error if it can't run, instead of printing
105
+ "Successfully installed".
106
+
107
+ UPGRADE NOTES:
108
+ - On Apple Silicon, run `rdeploy helm-setup <config>` once to download the
109
+ arm64 binary to `opt/helm-v<version>/darwin-arm64/`. The old
110
+ `opt/helm-v<version>/darwin-amd64/` directory is no longer used and can be
111
+ deleted.
112
+
113
+ ----
114
+ Version 0.4.0, Fri 10 Jul 2026
115
+ ===============================
116
+ - `rdeploy upgrade` now shows live rollout progress while the atomic helm
117
+ upgrade waits: it polls `kubectl get pods` and shows the pod status table
118
+ (prefixed with `[rollout]`), so you can watch pods being created, pulled,
119
+ started and terminated (including helm hook pods such as migration jobs)
120
+ instead of blocking silently. On a terminal the table is pinned to the
121
+ bottom of the screen and updates in place while helm's output scrolls
122
+ above it; on a non-TTY (e.g. CI logs) it prints the table once, then any
123
+ row that changes.
124
+ - Added `--no-progress` to disable the live progress display. The display is
125
+ purely informational and runs concurrently with helm; helm `--atomic`
126
+ remains the sole arbiter of success, failure and rollback, and the watcher
127
+ never affects the command's exit code.
128
+
129
+ ----
130
+ Version 0.3.0, Thu 09 Jul 2026
131
+ ===============================
132
+ - `rdeploy upgrade` now runs helm with `--atomic` by default: helm waits for
133
+ the rollout to complete (up to `--timeout`, default 15m) and automatically
134
+ rolls back to the previous release if it fails, and the command exits with
135
+ an error instead of reporting success.
136
+ - Added `--no-atomic` to restore the previous fire-and-forget behaviour and
137
+ `--timeout` to adjust how long helm waits.
138
+
139
+ BREAKING CHANGES:
140
+ - `rdeploy upgrade` now blocks until the rollout completes and exits non-zero
141
+ on failure. Scripts that relied on it returning immediately should pass
142
+ `--no-atomic`.
143
+
144
+ Version 0.2.0, Thu 09 Jul 2026
145
+ ===============================
146
+ - Upgraded all dependencies to current versions: invoke 2.2+/3.x, semver 3.x,
147
+ kubernetes 28+, packaging 23+, python-dotenv 1.0+, requests 2.31+.
148
+ - Migrated packaging from setup.py to pyproject.toml.
149
+ - Replaced deprecated pkg_resources and distutils.strtobool (removed in
150
+ Python 3.12) with importlib.metadata and a local implementation.
151
+ - Added a test suite (pytest).
152
+ - Removed all Azure support. rdeploy now targets GCP exclusively. Commands
153
+ fail with a clear error when rdeploy.yaml specifies a non-gcp provider.
154
+ - Fixed latest-prerelease regex to escape the version argument.
155
+
156
+ BREAKING CHANGES:
157
+ - Azure support removed: set-cluster, set-context, set-project and cloudbuild
158
+ no longer work with `cloud_provider.name: azure` configs, and the
159
+ `container_registry_provider: azure` setting is no longer honoured.
160
+ - `rdeploy upgrade` named argument renamed: `--version` is now `--tag`
161
+ (positional usage, e.g. `rdeploy upgrade prod 1.2.3`, is unchanged).
162
+ - The `bash` alias for the `shell` command was removed; use `rdeploy shell`.
163
+ - `rdeploy latest-prerelease` named argument renamed: `--version` is now
164
+ `--ver`. The misspelled `latest-prerelese` alias was removed.
165
+ - Requires Python 3.9+.
166
+
167
+ Version 0.1.9, Tue 30 Apr 2024
168
+ ===============================
169
+ - Fix bug in Google Artifact Registry for helm charts handling
170
+
171
+ Version 0.1.8, Tue 30 Apr 2024
172
+ ===============================
173
+ - Added support for Google Artifact Registry for helm charts.
174
+
175
+ Version 0.0.30, Mon 4 Jan 2020
176
+ ===============================
177
+ - Update helm stable repo url to new version.
178
+
179
+ Version 0.0.26, Wed 14 Jul 2020
180
+ ===============================
181
+ - Add decode-secret command
182
+ - Fix MANIFEST.in
183
+
184
+ Version 0.0.25, Wed 25 Mar 2020
185
+ ===============================
186
+
187
+ - Migrated to use kubectl run command. Currently supporting the
188
+ ExtensionsV1beta1/deployment
189
+
190
+ a8a490a updated working management pod spec and command definition for both manage and shell commands
191
+ 78d207c Created a command for building the management command
192
+
193
+ Version 0.0.24, Tue 11 Feb 2020
194
+ ===============================
195
+ - Fix bug in helm install command version parsing.
196
+
197
+ Version 0.0.22, Mon 10 Feb 2020
198
+ ===============================
199
+ - New rdeploy.yaml format, added rdeploy.example.yaml.
200
+ - Added support for Azure in the set_context, and cloudbuild commands. Azure details to be provided in the `cloud_provider` field in rdeploy.yaml.
201
+ - Added support for helm 3 in the `install` and `upgrade` commands.
202
+ - Added helm_setup command which installs a specific helm version in a local opt directory. This can be enabled by specifying `use_system_helm: false` and `helm_version` in rdeploy.yaml.
203
+ - Added a new `helm` command.
204
+ - Added aliases for all commands with underscores. I.e. `rdeploy set-context` is now equivalent to `rdeploy set_context`
205
+ - Renamed the `bash` to `shell`, keeping `bash` as an alias.
206
+
207
+ Version 0.0.18, Fri 13 Sep 2019
208
+ ===============================
209
+
210
+ 0a1a8ff preference placed on bash instead of bourne shell (Mwangi)
211
+ 9dbee31 explicitly added the separator for the command in the kubectl exec command (Mwangi)
212
+ 41e48c7 added docs for the force flag (Mwangi)
213
+ e7f11bf removed redundant prefix \venv\bin for future changes to our docker images (Mwangi)
214
+ a9a5ac1 added a build option for git release (Mwangi)
215
+ dee9af8 removed input option for confirm changes have been committed (Mwangi)
216
+
217
+ Version 0.0.17, Mon 05 Aug 2019
218
+ ===============================
219
+
220
+ 0283cd1 Added gcs-log-dir option to the cloudbuild methods (Mwangi)
221
+ 9efa2c9 fixed the YAML Loader (Mwangi)
222
+ 7e98584 Refactoring the tasks file (Mwangi)
223
+
224
+ Version 0.0.16, Thu 19 Jul 2019
225
+ ===============================
226
+
227
+ 7b8bd11 Merge pull request #19 from rehive/feature/18-tiller-migration (Mwangi)
228
+ 3a16ae3 Tested the template_install (Mwangi)
229
+ 35f082d split install and template_install (Mwangi)
230
+ 6868aac WIP Added the helm fetch and helm template commands (Mwangi)
231
+ c3deaee Default ACL set to private for non-static buckets (Mwangi)
232
+
233
+ Version 0.0.15, Fri 5 Jul 2019
234
+ ==============================
235
+
236
+ 31b94f0944 Bumped version to 0.0.15 (Mwangi)
237
+ ede64320fa Formatting fixes, bug fixes and deprecations (Mwangi)
238
+ - Fixed formatting for readability
239
+ - removed create_volume_claim action as it is deprecated
240
+ - updated gsutil commands to be bucketPolicy only
241
+ - updated bucket actions to be set on current project and not cluster
242
+ - removed proxy action due to kubectl deprecation
243
+ - Fixed initial versioning bug i.e when project has no tag
244
+ d8cd0ea6fa Install flags fixed for Helm v3.0.1-alpha (Mwangi)
245
+ 1c350ce854 Merging with master (Mwangi)
246
+
247
+
248
+ Version 0.0.14, Mon 21 Jan 2019
249
+ ================================
250
+
251
+ eb44a57bc2 Hotfix yet another silly bug (Michail Brynard)
252
+
253
+
254
+ Version 0.0.13, Mon 21 Jan 2019
255
+ ================================
256
+
257
+ fb181839a6 Hotfix: dictionary bug (Michail Brynard)
258
+
259
+
260
+ Version 0.0.12, Mon 21 Jan 2019
261
+ ================================
262
+
263
+ 1c8bd5b220 Fix typo (Michail Brynard)
264
+
265
+
266
+ Version 0.0.11, Mon 21 Jan 2019
267
+ ================================
268
+
269
+ fa6eec9b42 Version bump to 0.0.10 and updating CHANGES.txt (Michail Brynard)
270
+ 666f6b5b87 Update formatting (Michail Brynard)
271
+ 025548a9dc Add support for specifying zone or region in rdeploy.yaml. (Michail Brynard)
272
+
273
+
274
+ Version 0.0.10, Mon 21 Jan 2019
275
+ ================================
276
+
277
+ 666f6b5b87 Update formatting (Michail Brynard)
278
+ 025548a9dc Add support for specifying zone or region in rdeploy.yaml. (Michail Brynard)
279
+
280
+
281
+ Version 0.0.7, Tue 05 Jun 2018
282
+ ===============================
283
+
284
+
285
+
286
+ Version 0.0.6, Tue 05 Jun 2018
287
+ ===============================
288
+
289
+ 91352e57ae Version bump to 0.0.5 and updating CHANGES.txt (Michail Brynard)
290
+
291
+
292
+ Version 0.0.5, Tue 05 Jun 2018
293
+ ===============================
294
+
295
+ 5419c2fb42 Fix static upload command (Michail Brynard)
296
+
297
+
298
+ Version 0.0.5, Tue 05 Jun 2018
299
+ ===============================
300
+
301
+ 5419c2fb42 Fix static upload command (Michail Brynard)
302
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rdeploy
3
- Version: 0.5.4
3
+ Version: 0.5.6
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.5.6/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.5.6
@@ -69,16 +69,36 @@ def sha256_file(path):
69
69
 
70
70
 
71
71
  def resolve_digest(host, project, repository, package, chart_version):
72
- image = '{host}/{project}/{repository}/{package}:{version}'.format(
73
- host=host, project=project, repository=repository, package=package,
74
- version=chart_version)
75
- digest = run_gcloud([
76
- 'gcloud', 'artifacts', 'docker', 'images', 'describe', image,
77
- '--format=value(image_summary.digest)',
78
- ]).strip()
79
- if not digest.startswith('sha256:'):
80
- raise ChartFetchError('Could not resolve {image} to a digest.'.format(image=image))
81
- return digest
72
+ """
73
+ Return the manifest digest the chart's version tag points to.
74
+
75
+ This lists the package's versions rather than running `gcloud artifacts
76
+ docker images describe`, which always queries Container Analysis as well
77
+ and so needs `containeranalysis.occurrences.list`, a permission deployers
78
+ may not have. Listing only needs read access to Artifact Registry.
79
+ """
80
+ package_path = '{host}/{project}/{repository}/{package}'.format(
81
+ host=host, project=project, repository=repository, package=package)
82
+ output = run_gcloud([
83
+ 'gcloud', 'artifacts', 'docker', 'images', 'list', package_path,
84
+ '--include-tags',
85
+ '--format=json(version,tags)',
86
+ ])
87
+ try:
88
+ images = json.loads(output or '[]')
89
+ except ValueError:
90
+ raise ChartFetchError('Could not read the versions of {package}.'.format(
91
+ package=package_path))
92
+ for image in images:
93
+ tags = image.get('tags') or []
94
+ if isinstance(tags, str):
95
+ tags = [tag.strip() for tag in tags.split(',')]
96
+ if chart_version in tags:
97
+ digest = image.get('version') or ''
98
+ if digest.startswith('sha256:'):
99
+ return digest
100
+ raise ChartFetchError('Could not resolve {package}:{version} to a digest.'.format(
101
+ package=package_path, version=chart_version))
82
102
 
83
103
 
84
104
  def download_file(project, location, repository, name, destination, filename):
@@ -318,7 +318,9 @@ def upload_static(ctx, config, bucket_name):
318
318
  set_project(ctx, config)
319
319
 
320
320
  ctx.run('echo "yes\n" | python src/manage.py collectstatic')
321
- ctx.run('gsutil -m rsync -d -r var/www/static gs://{bucket_name}'
321
+ ctx.run('gcloud storage rsync --recursive'
322
+ ' --delete-unmatched-destination-objects'
323
+ ' var/www/static gs://{bucket_name}'
322
324
  .format(bucket_name=bucket_name), echo=False)
323
325
 
324
326
 
@@ -327,9 +329,10 @@ def create_bucket(ctx, config, bucket_name):
327
329
  """Creates a private gcloud bucket"""
328
330
  set_project(ctx, config)
329
331
 
330
- ctx.run('gsutil mb gs://{bucket_name}'
332
+ ctx.run('gcloud storage buckets create gs://{bucket_name}'
331
333
  .format(bucket_name=bucket_name), echo=False)
332
- ctx.run('gsutil defacl set private gs://{bucket_name}'
334
+ ctx.run('gcloud storage buckets update gs://{bucket_name}'
335
+ ' --predefined-default-object-acl=private'
333
336
  .format(bucket_name=bucket_name), echo=False)
334
337
 
335
338
 
@@ -338,8 +341,11 @@ def create_public_bucket(ctx, config, bucket_name):
338
341
  """Creates a public gcloud bucket"""
339
342
  set_project(ctx, config)
340
343
 
341
- ctx.run('gsutil mb -b on gs://{bucket_name}'.format(bucket_name=bucket_name))
342
- ctx.run('gsutil iam ch allUsers:objectViewer gs://{bucket_name}'
344
+ ctx.run('gcloud storage buckets create gs://{bucket_name}'
345
+ ' --uniform-bucket-level-access'
346
+ .format(bucket_name=bucket_name))
347
+ ctx.run('gcloud storage buckets add-iam-policy-binding gs://{bucket_name}'
348
+ ' --member=allUsers --role=roles/storage.objectViewer'
343
349
  .format(bucket_name=bucket_name))
344
350
 
345
351
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rdeploy
3
- Version: 0.5.4
3
+ Version: 0.5.6
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,7 +1,9 @@
1
+ CHANGES.txt
1
2
  LICENSE
2
3
  README.md
3
4
  VERSION
4
5
  pyproject.toml
6
+ requirements.txt
5
7
  rdeploy/__init__.py
6
8
  rdeploy/exceptions.py
7
9
  rdeploy/gke_auth.py
@@ -0,0 +1,7 @@
1
+ invoke>=2.2,<4
2
+ kubernetes>=28,<36
3
+ packaging>=23
4
+ python-dotenv>=1.0
5
+ PyYAML>=6.0
6
+ semver>=3.0,<4
7
+ requests>=2.31
@@ -33,12 +33,13 @@ MANIFEST_DIGEST = 'sha256:' + hashlib.sha256(MANIFEST).hexdigest()
33
33
  class FakeGcloud:
34
34
  """Stands in for gcloud: resolves the tag and serves the stored files."""
35
35
 
36
- def __init__(self, files=None, digest=MANIFEST_DIGEST, fail=False):
36
+ def __init__(self, files=None, digest=MANIFEST_DIGEST, tags=('1.2.0',), fail=False):
37
37
  self.files = files if files is not None else {
38
38
  'rehive-service/manifests/' + MANIFEST_DIGEST: MANIFEST,
39
39
  CHART_DIGEST: CHART,
40
40
  }
41
41
  self.digest = digest
42
+ self.tags = list(tags)
42
43
  self.fail = fail
43
44
  self.calls = []
44
45
 
@@ -46,8 +47,12 @@ class FakeGcloud:
46
47
  self.calls.append(cmd)
47
48
  if self.fail:
48
49
  return MagicMock(returncode=1, stdout='')
49
- if cmd[1:5] == ['artifacts', 'docker', 'images', 'describe']:
50
- return MagicMock(returncode=0, stdout=self.digest + '\n')
50
+ if cmd[1:5] == ['artifacts', 'docker', 'images', 'list']:
51
+ images = [
52
+ {'version': 'sha256:' + 'a' * 64, 'tags': ['1.2.0-rc1', '1.1.0']},
53
+ {'version': self.digest, 'tags': self.tags},
54
+ ]
55
+ return MagicMock(returncode=0, stdout=json.dumps(images))
51
56
  if cmd[1:4] == ['artifacts', 'files', 'download']:
52
57
  name = cmd[4]
53
58
  flags = dict(arg[2:].split('=', 1) for arg in cmd[5:] if '=' in arg)
@@ -120,8 +125,9 @@ class TestFetchChart:
120
125
  def test_gcloud_calls(self, tmp_path):
121
126
  gcloud = FakeGcloud()
122
127
  fetch(tmp_path, gcloud)
123
- describe, manifest, chart = gcloud.calls
124
- assert describe[5] == 'europe-west4-docker.pkg.dev/my-project/my-charts/rehive-service:1.2.0'
128
+ listing, manifest, chart = gcloud.calls
129
+ assert listing[5] == 'europe-west4-docker.pkg.dev/my-project/my-charts/rehive-service'
130
+ assert '--include-tags' in listing
125
131
  assert manifest[4] == 'rehive-service/manifests/' + MANIFEST_DIGEST
126
132
  assert chart[4] == CHART_DIGEST
127
133
  for call in (manifest, chart):
@@ -174,10 +180,31 @@ class TestFetchChart:
174
180
  with pytest.raises(ChartFetchError, match='Manifest digest mismatch'):
175
181
  fetch(tmp_path, gcloud)
176
182
 
183
+ def test_never_queries_container_analysis(self, tmp_path):
184
+ # `images describe` needs containeranalysis.occurrences.list.
185
+ gcloud = FakeGcloud()
186
+ fetch(tmp_path, gcloud)
187
+ assert not any(call[1:5] == ['artifacts', 'docker', 'images', 'describe']
188
+ for call in gcloud.calls)
189
+ assert not any('--show-occurrences' in call for call in gcloud.calls)
190
+
191
+ def test_matches_tag_exactly(self, tmp_path):
192
+ gcloud = FakeGcloud(tags=['1.2.0-rc2', '1.2.0'])
193
+ assert fetch(tmp_path, gcloud).endswith('rehive-service-1.2.0.tgz')
194
+
195
+ def test_accepts_comma_separated_tags(self, tmp_path):
196
+ gcloud = FakeGcloud()
197
+ gcloud.tags = 'latest, 1.2.0'
198
+ assert fetch(tmp_path, gcloud).endswith('rehive-service-1.2.0.tgz')
199
+
177
200
  def test_unresolved_tag(self, tmp_path):
178
201
  with pytest.raises(ChartFetchError, match='digest'):
179
202
  fetch(tmp_path, FakeGcloud(digest=''))
180
203
 
204
+ def test_missing_tag(self, tmp_path):
205
+ with pytest.raises(ChartFetchError, match='1.2.0 to a digest'):
206
+ fetch(tmp_path, FakeGcloud(tags=['1.2.0-rc1']))
207
+
181
208
  def test_gcloud_failure(self, tmp_path):
182
209
  with pytest.raises(ChartFetchError, match='gcloud failed'):
183
210
  fetch(tmp_path, FakeGcloud(fail=True))
rdeploy-0.5.4/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.5.4
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
File without changes
File without changes
File without changes