unfurl icon indicating copy to clipboard operation
unfurl copied to clipboard

Enhance the export api to specify a remote unfurl project url to export

Open aszs opened this issue 2 years ago • 1 comments

Follow up for #138. Current the export api only exports the local unfurl ensemble loaded on startup. We also want to support a mode where the api takes a parameter that points to a remote ensemble to export.

This can be accomplished by doing an unfurl clone of the git url and then running export on the local directory it was cloned to. The dashboard project support retrieving its environment variables remotely and so do not need any local state. To enable this, use the equivalent to this command:

unfurl clone --empty https://unfurl.cloud/user/dashboard --var UNFURL_CLOUD_VARS_URL 'https://app.dev.unfurl.cloud/api/v4/projects/62/variables?filter[environment_scope]=${ENVIRONMENT:*}&private_token=uc-XXXXX'

For this to work the UNFURL_CLOUD_VARS_URL would have to be included as an optional parameter in the api ~(but probably should be excluded from the cache key used by flask to cache the api request)~ (on further thought, it probably should include it)

Supporting the "deployment" export format will also require the environment and deployment_path to be sent as api parameters

If the unfurl_home project is set its unfurl.yaml will be updated with record of the cloned project so it can be queried to find out if the remote project has already been cloned (using LocalEnv.find_repository_path_by_url()). If it has, just run export on that local project.

aszs avatar Aug 11 '22 23:08 aszs

To be clear, the code wouldn't actually invoke unfurl clone instead it should invoke the equivalent api (i.e. init.clone())

aszs avatar Aug 11 '22 23:08 aszs

fixed in #143

aszs avatar Sep 03 '22 17:09 aszs