https://pulumi.com logo
#general
Title
# general
n

numerous-fall-58752

12/05/2023, 10:20 AM
Hi all, what would be the correct way to clone a github repo in Pulumi? e.g. to install a helm chart from file. I'm currently using
local.Command
but I found out it's stored as "created" in the stack which is unexpected since the actual files are obviously local. This means if I go to a different machine
pulumi up
fails.
d

dry-keyboard-94795

12/05/2023, 10:52 AM
I handled this exact case by cloning the repo locally before running pulumi. You can also run the shell commands as part of the stack without a resource. In python, this would be with
subprocess
, or the
sh
package from pypi
There isn't a
git
provider to do the clone from what I found. I also tried with the
helm-git
plugin in the past, but this also didn't work. I actually ended up chucking the chart into an OCI repo in the end.
n

numerous-fall-58752

12/05/2023, 10:59 AM
Cheers yeah I guess one could use https://www.pulumi.com/registry/packages/command/api-docs/local/run/ too... it's just frustrating that there isn't a built-in way to do this.
d

dry-keyboard-94795

12/05/2023, 11:00 AM
Oh I forgot they expose a function to do this as well as a resource. This is the better way
There's an issue here that can be upvoted : https://github.com/pulumi/pulumi-kubernetes/issues/807
n

numerous-fall-58752

12/05/2023, 11:12 AM
I don't get the purpose of https://www.pulumi.com/registry/packages/command/api-docs/local/command/ ? Any output assets will be local but since this is stored as part of the stack state the assets will never be accessible to any other machine... so either I'm missing something or this seems fundamentally broken?
d

dry-keyboard-94795

12/05/2023, 11:25 AM
For helm, yes it wouldn't work as helm always expects the files to be accessible to determine if an update is needed. In other situations, the files aren't always needed, and can get away with using a checksum. The command will only run when its inputs change, and it's assumed the command is pure (same inputs means same outputs). This is for resources like an s3 object, and largely relates to Pulumi's Asset/Archive implementation
n

numerous-fall-58752

12/05/2023, 11:27 AM
I don't follow... https://www.pulumi.com/registry/packages/command/api-docs/local/command/#outputs says "A map of assets found after running the command. The key is the relative path from the command dir" This is talking about local files, not S3 objects? Or maybe the docs are just incorrect?
d

dry-keyboard-94795

12/05/2023, 11:31 AM
They're local files that can then be used to be upload to s3. Pulumi won't try to upload the object unless a change is detected in the command resource. As you found, once the command is "created", it doesn't run again. Any resources depending on it will also not be updated.
n

numerous-fall-58752

12/05/2023, 11:32 AM
ok, thanks 👍 The docs are pretty confusing though, they don't mention any of that...
d

dry-keyboard-94795

12/05/2023, 11:40 AM
Yes, it'd be worth an explicit explanation being added somewhere. It does build on how resource dependencies are expected to work though. It's entirely possible the contents of the files are stored in state too. Would need to dig into it to check
l

little-cartoon-10569

12/05/2023, 6:31 PM
Do you need the entire repository? A single file is accessible from git via the raw URL.