Upgrading to JS templates

Airplane is upgrading its interpolation engine from Handlebars to JavaScript templates, which allows for more complex and expressive interpolation. The vast majority of tasks will be seamlessly upgraded to the new experience, but in a few cases there are backwards compatibility issues where users will need to manually upgrade their tasks.

What's changing

  • Parameter values are no longer referenced as {{slug}}; instead, they should be referenced as {{params.slug}}.
  • The full parameter values object (previously {{JSON}}) should be referenced as {{JSON.stringify(params)}}.
  • The value for upload parameters was previously just a signed URL where the file could be downloaded from. Now, the values are objects with a url property that is the signed URL and an __airplaneType property that is always upload. Using {{params.slug.url}} will result in just the signed URL being passed; using {{params.slug}} will yield a JSON-serialized version of the object. If you use {{JSON.stringify(params)}} with an upload parameter, the value for the upload parameter will be the object described above.

Manual upgrade

If you need to manually upgrade your task, it's likely because you're using {{JSON}} as an argument to a task with an upload parameter. To upgrade, you should update your task to support the new format of upload parameter values.

python
Copied
1
def main(params):
2
# previously downloadFile(params['file'])
3
downloadFile(params['file']['url'])

Then, re-deploy your task with --jst:

shell
Copied
1
airplane deploy /path/to/task.py --jst

That's it!