Upgrading to JS templates from Handlebars

Airplane previously used Handlebars for templating, but switched to JS templates to allow for more complex and expressive interpolation. The vast majority of tasks were seamlessly upgraded to the new experience, but in a few cases there were backwards compatibility issues which require users to manually update tasks to support the new templating format.

What changed

  • 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.
export default async function (params) {
// previously downloadFile(params.file)
Then, re-deploy your task with --jst:
airplane deploy /path/to/task.py --jst
That's it!