pulumi / pulumi-synced-folder

A Pulumi component that synchronizes a local folder to Amazon S3, Azure Blob Storage, or Google Cloud Storage.
Apache License 2.0
3 stars 2 forks source link

Trailing slash in relative source path produces strange destination path #55

Open wpietri opened 9 months ago

wpietri commented 9 months ago

What happened?

New to Pulumi, I am doing something like the Pulumi static web site example, which is meant to upload a folder of output from another project.

Example

If I have something like:

synced_folder = synced_folder.GoogleCloudFolder(
    "synced-folder", path="../../webbuilder/output/", bucket_name=bucket.name
)

and that output directory contains index.html, then doing pulumi up proposes to do something like this:

     pulumi:pulumi:Stack                       my-dev                                            
     └─ synced-folder:index:GoogleCloudFolder  synced-folder                                        
 +      ├─ gcp:storage:BucketObject            synced-folder-../../webbuilder/output/index.html  create     

Note that the proposed path contains ../.. plus two other directories that shouldn't be uploaded. If Pulumi's run continues, the index.html file will end up not at the root of the bucket, but 4 levels deep.

Removing the / from the end of the path fixes it.

Output of pulumi about

$ pulumi about
CLI          
Version      3.96.0
Go Version   go1.21.4
Go Compiler  gc

Plugins
NAME           VERSION
gcp            7.2.1
python         unknown
synced-folder  0.11.1

Host     
OS       debian
Version  bookworm/sid
Arch     x86_64

This project is written in python: executable='[redacted]/bin/python3' version='3.10.12'

Current Stack: [redacted]//dev

TYPE                                                   URN
pulumi:pulumi:Stack                                    urn:pulumi:dev::[redacted]/::pulumi:pulumi:Stack::[redacted]/-dev
pulumi:providers:gcp                                   urn:pulumi:dev::[redacted]/::pulumi:providers:gcp::default_7_2_1
gcp:compute/globalAddress:GlobalAddress                urn:pulumi:dev::[redacted]/::gcp:compute/globalAddress:GlobalAddress::ip
gcp:storage/bucket:Bucket                              urn:pulumi:dev::[redacted]/::gcp:storage/bucket:Bucket::[redacted]/
gcp:storage/bucketIAMBinding:BucketIAMBinding          urn:pulumi:dev::[redacted]/::gcp:storage/bucketIAMBinding:BucketIAMBinding::bucket-iam-binding
gcp:compute/backendBucket:BackendBucket                urn:pulumi:dev::[redacted]/::gcp:compute/backendBucket:BackendBucket::backend-bucket
pulumi:providers:synced-folder                         urn:pulumi:dev::[redacted]/::pulumi:providers:synced-folder::default_0_11_1
gcp:compute/uRLMap:URLMap                              urn:pulumi:dev::[redacted]/::gcp:compute/uRLMap:URLMap::url-map
gcp:compute/targetHttpProxy:TargetHttpProxy            urn:pulumi:dev::[redacted]/::gcp:compute/targetHttpProxy:TargetHttpProxy::http-proxy
gcp:compute/globalForwardingRule:GlobalForwardingRule  urn:pulumi:dev::[redacted]/::gcp:compute/globalForwardingRule:GlobalForwardingRule::http-forwarding-rule
synced-folder:index:GoogleCloudFolder                  urn:pulumi:dev::[redacted]/::synced-folder:index:GoogleCloudFolder::synced-folder
pulumi:providers:gcp                                   urn:pulumi:dev::[redacted]/::pulumi:providers:gcp::default_6_62_0
gcp:storage/bucketObject:BucketObject                  urn:pulumi:dev::[redacted]/::synced-folder:index:GoogleCloudFolder$gcp:storage/bucketObject:BucketObject::synced-folder-gpt2.html

Found no pending operations associated with [redacted]//dev

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/[redacted]/
User           [redacted]/
Organizations  [redacted]/
Token type     personal

Dependencies:
NAME                  VERSION
pip                   23.3.1
pulumi-gcp            7.2.1
pulumi-synced-folder  0.11.1
setuptools            68.2.2
wheel                 0.41.3

Pulumi locates its logs in /tmp by default

Additional context

As somebody new to Pulumi, this was quite mysterious.

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).