Big News!  Tilt is joining Docker
Photo by Michael Dziedzic on Unsplash

More customizable Tiltfiles with Extensions

Contribute an extension; grow the Tilt community

In Tilt, you declare your dev environment in Starlark, a subset of Python. But Starlark is missing a big feature: there’s no package manager! Starlark doesn’t have built-in ways to share code.

The Tilt community noticed! We’ve seen people:

  • Copy and paste “best practices” for different languages
  • Struggle to share Tiltfiles across multiple repos
  • Send each other Tiltfile snippets

To address this gap, as a first step toward a multi-service dev package manager, we’ve created Tilt extensions.

Tilt extensions are available starting in v0.12.11. (Click here to upgrade!)

What’s an extension, exactly? And how do you use it?

An extension is an approved and packaged function containing functionality written and shared by (probably another) Tilt community member, that you can remotely import into your own Tiltfile.

For example, to use the hi function from the hello_world extension, first load() it by including this command in your Tiltfile:

load('ext://hello_world', 'hi')

Then call hi() later in your Tiltfile to print “Hello World!”.

Read the docs for additional details and look at the tilt-extensions repo for a list of available and approved extensions.

We’ve already seen the Tilt community activey share ideas, especially in Slack #tilt. We hope that by providing a more structured platform, community members can even more effectively collaborate and leverage the benefits of shared Tiltfile functionality. Users can take advantage of solutions that contributors have already worked through. And contributors can see their work being scaled to other organizations.

I want to contribute an extension

If you’re interested in contributing an extension, follow the instructions in Contribute an Extension to submit a pull request. You’d likely write some Go in order to contribute to Tilt. Contributing an extension, however, means writing in Starlark, similar to editing your Tiltfile.

If you’ve already defined a function in your Tiltfile, we’ve designed extensions to create a clear path for you to:

  • Take an existing function in your Tiltfile
  • Publish that function to the tilt-extensions repo
  • Replace that function in your Tiltfile with the published version

Some extensions that we think would be interesting include:

  • kubectl commands exposed as extensions
  • Validate certain tools (and their required versions) exist on the machine
  • Change namespace of a Kubernetes yaml file

Appreciation

If you submit an extension within the month of April 2020, and it’s accepted and published, we’ll send you a Tilt t-shirt (as long as you’re in the United States, to simplify shipping). We think extensions will be a great way to further build the Tilt community, and we want to especially express our thanks to early adopters (contributors) in this way.

The t-shirts look really awesome!

Related

Already have a Dockerfile and a Kubernetes config?

You’ll be able to setup Tilt in no time and start getting things done. Check out the docs! 

Having trouble developing your servers in Kubernetes?