8000 Speedup Tilt Pulumi extension by skipping the preview · Issue #627 · tilt-dev/tilt-extensions · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Speedup Tilt Pulumi extension by skipping the preview #627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lukasholzer opened this issue Feb 17, 2025 · 2 comments
Open

Speedup Tilt Pulumi extension by skipping the preview #627

lukasholzer opened this issue Feb 17, 2025 · 2 comments

Comments

@lukasholzer
Copy link
lukasholzer commented Feb 17, 2025

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.

@nicks
Copy link
Member
nicks commented Feb 17, 2025

seems reasonable to me!

@nicks
Copy link
Member
nicks commented Feb 18, 2025

I would probably lean towards making --skip-preview the default, we can make it an option if anybody complains

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0