Hi all, what would be the correct way to clone a g...
# general
n
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
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
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
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
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
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
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
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
ok, thanks 👍 The docs are pretty confusing though, they don't mention any of that...
d
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
Do you need the entire repository? A single file is accessible from git via the raw URL.