elegant-florist-94385
11/14/2024, 9:08 PMhelm package <path> --app-version="my_app_version"
. I can't seem to find a way to set this using pants.elegant-florist-94385
11/14/2024, 9:09 PMpants package <path>:: --helm-args='["--app-version=myspecialappversion"]'
but this doesn't work because the app-version arg is not allowed to be passed throughelegant-florist-94385
11/14/2024, 9:10 PMluke@luke-dev:~/git/operations-core$ pants package src/helm/operations/:: --helm-args='["--app-version=myspecialappversion"]'
14:07:00.25 [ERROR] 1 Exception encountered:
Engine traceback:
in root
..
in pants.core.goals.package.package_asset
`package` goal
Traceback (most recent call last):
File "/home/luke/.cache/nce/ab1acf935c4cc43338c604ae7d0f6aa2419f2415d94eb9cae381601dbba70a61/bindings/venvs/2.22.0/lib/python3.9/site-packages/pants/core/goals/package.py", line 165, in package_asset
packages = await MultiGet(
File "/home/luke/.cache/nce/ab1acf935c4cc43338c604ae7d0f6aa2419f2415d94eb9cae381601dbba70a61/bindings/venvs/2.22.0/lib/python3.9/site-packages/pants/engine/internals/selectors.py", line 376, in MultiGet
return await _MultiGet(tuple(__arg0))
File "/home/luke/.cache/nce/ab1acf935c4cc43338c604ae7d0f6aa2419f2415d94eb9cae381601dbba70a61/bindings/venvs/2.22.0/lib/python3.9/site-packages/pants/engine/internals/selectors.py", line 174, in __await__
result = yield self.gets
File "/home/luke/.cache/nce/ab1acf935c4cc43338c604ae7d0f6aa2419f2415d94eb9cae381601dbba70a61/bindings/venvs/2.22.0/lib/python3.9/site-packages/pants/core/goals/package.py", line 116, in environment_aware_package
package = await Get(
File "/home/luke/.cache/nce/ab1acf935c4cc43338c604ae7d0f6aa2419f2415d94eb9cae381601dbba70a61/bindings/venvs/2.22.0/lib/python3.9/site-packages/pants/engine/internals/selectors.py", line 124, in __await__
result = yield self
File "/home/luke/.cache/nce/ab1acf935c4cc43338c604ae7d0f6aa2419f2415d94eb9cae381601dbba70a61/bindings/venvs/2.22.0/lib/python3.9/site-packages/pants/backend/helm/goals/package.py", line 53, in run_helm_package
process_result = await Get(
File "/home/luke/.cache/nce/ab1acf935c4cc43338c604ae7d0f6aa2419f2415d94eb9cae381601dbba70a61/bindings/venvs/2.22.0/lib/python3.9/site-packages/pants/engine/internals/selectors.py", line 124, in __await__
result = yield self
File "/home/luke/.cache/nce/ab1acf935c4cc43338c604ae7d0f6aa2419f2415d94eb9cae381601dbba70a61/bindings/venvs/2.22.0/lib/python3.9/site-packages/pants/backend/helm/util_rules/tool.py", line 467, in helm_process
debug_requested = "--debug" in helm_subsystem.valid_args() or (
File "/home/luke/.cache/nce/ab1acf935c4cc43338c604ae7d0f6aa2419f2415d94eb9cae381601dbba70a61/bindings/venvs/2.22.0/lib/python3.9/site-packages/pants/util/memo.py", line 123, in memoize
result = func(*args, **kwargs)
File "/home/luke/.cache/nce/ab1acf935c4cc43338c604ae7d0f6aa2419f2415d94eb9cae381601dbba70a61/bindings/venvs/2.22.0/lib/python3.9/site-packages/pants/backend/helm/subsystems/helm.py", line 200, in valid_args
raise InvalidHelmPassthroughArgs(invalid, extra_help=extra_help)
pants.backend.helm.subsystems.helm.InvalidHelmPassthroughArgs: The following command line arguments are not valid: --app-version=myspecialappversion.
Only the following passthrough arguments are allowed:
* --atomic
* --cleanup-on-fail
* --create-namespace
* --debug
* --force
* --wait
* --wait-for-jobs
* --kubeconfig
* --kube-context
* --kube-apiserver
* --kube-as-group
* --kube-as-user
* --kube-ca-file
* --kube-token
* --timeout
elegant-florist-94385
11/14/2024, 10:31 PMyq
to inject the app version into the Chart.yaml
file and then depend on that shell command, but it didn't seem to work.
It seemed that there was an issue between which Chart.yaml ended up in the helm process sandbox. The "raw" one from the repo was used. Maybe I don't quite understand how to use shell_command
to modify/replace a file before it goes into helm_chart
elegant-florist-94385
11/18/2024, 11:40 AMhelm_chart
target's chart
field must always refer to a file in the repository and cannot be modified by depending on a shell command.
In the end, I just let my CI agent run yq
to modify the raw`Chart.yaml` file in the repository before calling pants package
.
Would love to get this behavior native in pants when I have some time to take a look and understand the source, but for now, settling for a practical solution.careful-address-89803
12/05/2024, 1:53 AMcareful-address-89803
12/05/2024, 1:55 AM[helm]
option scope).careful-address-89803
12/05/2024, 1:57 AMcareful-address-89803
12/05/2024, 2:04 AMhelm_chart.chart
field is of type HelmChartMetaSourceField
which is a SingleSourceField
. That means it's looking for files on disk, which is why the output of a shell_command
can't be used for it.)elegant-florist-94385
12/05/2024, 2:32 PMenv(...)
). my thought with having a passthrough arg was that my workflow is such that I want to always tag all my helm charts with the same version (eg. to match a git tag) and release all my products in version lockstep, but I could see why this may not be the general case.
I do agree it ought to be essentially a duplicate of the version
field.