<#21773 json serialization error for work units of...
# github-notifications
c
#21773 json serialization error for work units of linting helm charts Issue created by cburroughs Describe the bug
Copy code
cd $(mktemp -d)

cat > pants.toml <<EOF
[GLOBAL]
pants_version = "2.23.0"
backend_packages = [
  "pants.backend.experimental.helm",
  "pants.backend.experimental.tools.workunit_logger",

]
[helm]
lint_strict = true
EOF

mkdir -p src/helm/foo/

cat > src/helm/foo/Chart.yaml <<EOF
apiVersion: v2
description: Foo Helm chart
name: foo
version: 0.1.0
EOF

cat > src/helm/foo/BUILD <<EOF
helm_chart()
EOF

PANTS_WORKUNIT_LOGGER_ENABLED=true pants --no-pantsd lint ::
error log:
Copy code
7:08:00.73 [INFO] Completed: Lint Helm charts - helm succeeded.
Partition: foo
==> Linting foo
[INFO] Chart.yaml: icon is recommended
[INFO] values.yaml: file does not exist

1 chart(s) linted, 0 chart(s) failed


āœ“ helm succeeded.
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/home/ecsb/.cache/nce/67912efc04f9156d8f5b48a0348983defb964de043b8c13ddc6cc8a002f8e691/cpython-3.9.18+20240107-x86_64-unknown-linux-gnu-install_only.tar.gz/python/lib/python3.9/threading.py", line 980, in _bootstrap_inner
    self.run()
  File "/home/ecsb/.cache/nce/ab1acf935c4cc43338c604ae7d0f6aa2419f2415d94eb9cae381601dbba70a61/bindings/venvs/2.23.0/lib/python3.9/site-packages/pants/engine/streaming_workunit_handler.py", line 323, in run
    self.poll_workunits(finished=True)
  File "/home/ecsb/.cache/nce/ab1acf935c4cc43338c604ae7d0f6aa2419f2415d94eb9cae381601dbba70a61/bindings/venvs/2.23.0/lib/python3.9/site-packages/pants/engine/streaming_workunit_handler.py", line 306, in poll_workunits
    callback(
  File "/home/ecsb/.cache/nce/ab1acf935c4cc43338c604ae7d0f6aa2419f2415d94eb9cae381601dbba70a61/bindings/venvs/2.23.0/lib/python3.9/site-packages/pants/backend/tools/workunit_logger/rules.py", line 71, in __call__
    json.dump(just_dump_map(self._completed_workunits), f)
  File "/home/ecsb/.cache/nce/67912efc04f9156d8f5b48a0348983defb964de043b8c13ddc6cc8a002f8e691/cpython-3.9.18+20240107-x86_64-unknown-linux-gnu-install_only.tar.gz/python/lib/python3.9/json/__init__.py", line 179, in dump
    for chunk in iterable:
  File "/home/ecsb/.cache/nce/67912efc04f9156d8f5b48a0348983defb964de043b8c13ddc6cc8a002f8e691/cpython-3.9.18+20240107-x86_64-unknown-linux-gnu-install_only.tar.gz/python/lib/python3.9/json/encoder.py", line 429, in _iterencode
    yield from _iterencode_list(o, _current_indent_level)
  File "/home/ecsb/.cache/nce/67912efc04f9156d8f5b48a0348983defb964de043b8c13ddc6cc8a002f8e691/cpython-3.9.18+20240107-x86_64-unknown-linux-gnu-install_only.tar.gz/python/lib/python3.9/json/encoder.py", line 325, in _iterencode_list
    yield from chunks
  File "/home/ecsb/.cache/nce/67912efc04f9156d8f5b48a0348983defb964de043b8c13ddc6cc8a002f8e691/cpython-3.9.18+20240107-x86_64-unknown-linux-gnu-install_only.tar.gz/python/lib/python3.9/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/home/ecsb/.cache/nce/67912efc04f9156d8f5b48a0348983defb964de043b8c13ddc6cc8a002f8e691/cpython-3.9.18+20240107-x86_64-unknown-linux-gnu-install_only.tar.gz/python/lib/python3.9/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/home/ecsb/.cache/nce/67912efc04f9156d8f5b48a0348983defb964de043b8c13ddc6cc8a002f8e691/cpython-3.9.18+20240107-x86_64-unknown-linux-gnu-install_only.tar.gz/python/lib/python3.9/json/encoder.py", line 438, in _iterencode
    o = _default(o)
  File "/home/ecsb/.cache/nce/67912efc04f9156d8f5b48a0348983defb964de043b8c13ddc6cc8a002f8e691/cpython-3.9.18+20240107-x86_64-unknown-linux-gnu-install_only.tar.gz/python/lib/python3.9/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type Platform is not JSON serializable
Pants version 2.23.0 and
main
pantsbuild/pants