Skip to content

Speedup Tilt Pulumi extension by skipping the preview #627

@lukasholzer

Description

@lukasholzer

I would propose making the tilt-extensions pulumi faster by adding the --skip-preview flag by that it will directly start applying the necessary changes without first planning them.

https://github.com/tilt-dev/tilt-extensions/blob/master/pulumi/pulumi-apply-helper.py#L14

import os
import subprocess
import sys

stack = os.environ.get('STACK', '')
extension_dir = os.path.dirname(sys.argv[0])
image_configs = sys.argv[1:]

- apply_cmd = ['pulumi', 'up', '--refresh', '-y']
+ apply_cmd = ['pulumi', 'up', '--refresh', '--skip-preview', '-y']
for i in range(len(image_configs)):
  config = image_configs[i]
  image = os.environ['TILT_IMAGE_%s' % i]
  apply_cmd.extend(['--config', '%s=%s' % (config, image)])

get_cmd = ['python3', os.path.join(extension_dir, 'pulumi-get.py')]
if stack:
  apply_cmd.extend(['--stack', stack])
  get_cmd.extend([stack])

subprocess.check_call(apply_cmd, stdout=sys.stderr)
subprocess.check_call(get_cmd)

I think for local dev the speed benefit would be a huge improvement.

Cons

Possible downside is that it might can lead to corrupted states but this can be resolved locally really well. (invalid schema configuration can lead to resources being created)

Solution make it configureable on the pulumi resource:

  pulumi_resource(
    'infra',
    stack='dev',
    dir='_infra/',
    deps=glob("_infra/src/**"),

    # proposed setting
    skipPreview=True,
  )

By that it would not be breaking and instead just a feature that got added

I'm happy to provide a PR with the necessary changes if you folks think it's a good idea!
Pinging @nicks here as the author and owner of the extension.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions