Skip to content

Feature Request: Support AssetArchives via temporary copy directive #777

@hanseltime

Description

@hanseltime

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

Right now, if I want to copy files to the remote, I need to create a path based asset and copy all of those files into a temporary directory. (The directory needs to be referenced as a local path that is relative to my pulumi root so that it works on different machines when it's state is stored).

This leads to lots of boilerplate that I think could be brought into the CopyToRemote Command. Ideally, it would be nice to make use of the AssetArchive class, have that class copied to a temporary directory and then
cleaned afterwards.

    const myArchive = new pulumi.asset.AssetArchive({
         file: new pulumi.asset.StringAsset('This is a dynamically created file'),
         folder: someOtherAssetArchive,
    })

    new remote.CopyToRemote('copy-asset-archive', {
         connection,
         source: myArchive,
         path: '/some/path',
         // Required if the source is not path based
         tmpCopyDir: './tmp',
    })

On the provider side this would look like:

  1. If source is non-path, verify that there is a tmpCopyDir
  2. If the tmpCopyDir is not relative throw an error since that will be non-deterministic on other machines
  3. make <tmpCopyDir>/<id>, if non-empty clear the contents // Needs to be deterministic
  4. iterate assets and create files in <tmpCopyDir>/<id>
  5. perform SFTP upoad
  6. defer rm -rf <tmpCopyDir>/<id>

Affected area/feature

pulumi-command provider

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions