I'm having a lot of trouble bundling a Helm chart ...
# general
b
I'm having a lot of trouble bundling a Helm chart into a PEX and I'd appreciate any pointers to a solution. My initial attempt was by just declaring the Helm chart as a dependency but that didn't work. I then managed to find my way to
experimental_wrap_as_resources()
which sounds like it's the right thing to use for what I'm trying to do but somehow doesn't work:
Copy code
experimental_wrap_as_resources(
    name='resources',
    inputs=[
        "helm/my-product",
    ],
)

python_sources(
    resolve="python-scripts",
    sources=[
        "./installer.py",
    ],
)

pex_binary(
    name="installer",
    sh_boot=True,
    emit_warnings=False,
    entry_point="installer.py",
    resolve="python-scripts",
    dependencies=[
        ":resources",
        ":scripts",
    ],
)
Thanks a lot!
b
So I understand the question: Is
helm/my-product
a directory or file that exists "directly" in your repository (e.g. checked in to git)? And you're trying to include those extra files in the pex?
b
it's a Helm chart built through Pants:
Copy code
helm_chart(              
    sources=[            
        ...
    ],                   
)
the behavior I'm after is for Pants to include that Pants-generated Helm chart into the PEX so that I can provide a PEX installer to get our customers kickstarted with their installation
the installer is actually transpiling to a Docker Compose setup for that specific use-case, but it's beyond the scope of this 🙂
b
ah, okay, I don't know enough about pants' helm integration to provide useful feedback. Maybe @careful-address-89803 can help?
c
First guess is that you'd like
wrap_as_resources
to package the chart into a .tar.gz and embed that into the PEX, but instead it's just slurping all the loose files. IIRC
wrap_as_resources
pulls in source files. Lemme see if I can think of something
Oh, and the source files included are just the Chart.yaml itself, not any of the "actual" files, because of the way the Helm backend pulls in its files. It's the same issue as https://github.com/pantsbuild/pants/issues/21140 .
I've hacked together a dirty plugin to
package
dependencies and wrap them as resources https://gist.github.com/lilatomic/bc2d63dc5c6f1a517aa5f8dc42596ab1 . It's a gross combination of the
wrap_as_resources
and the code from
python_test
that handles
runtime_package_dependencies
. It worked at least twice, so maybe it'll work for you. (note the file paths, Gist won't let me use folders)
b
Hey, thanks for your reply ! We'll avoid relying on plugins (we've been there in the past and got burned) and choose not to bundle a Helm chart with the installer.