Skip to content

Commit

Permalink
Use updated chart defaults during a Tilt deploy (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkjpryor authored Feb 21, 2024
1 parent f06894d commit 4aeab5b
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions bin/tilt-images-apply
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#!/usr/bin/env python3

import contextlib
import json
import os
import pathlib
import re
import subprocess
import sys

Expand Down Expand Up @@ -61,6 +59,22 @@ if not revision_file.exists():
exec_cmd(["helm", "dependency", "update", os.environ["TILT_CHART_PATH"]])


# Get the current user values
helm_get_values_proc = exec_cmd(
[
"helm",
"get",
"values",
os.environ["TILT_RELEASE_NAME"],
"--namespace",
os.environ["TILT_RELEASE_NAMESPACE"],
],
stdout = subprocess.PIPE
)
current_values = yaml.safe_load(helm_get_values_proc.stdout)
current_values.pop("USER-SUPPLIED VALUES")


# Build and run the Helm upgrade command
# We reuse the values from the previous installation, but overwrite any images
# specified in the Tiltfile
Expand All @@ -71,7 +85,8 @@ helm_upgrade_command = [
os.environ["TILT_CHART_PATH"],
"--namespace",
os.environ["TILT_RELEASE_NAMESPACE"],
"--reuse-values",
"--values",
"-",
]

idx = 0
Expand All @@ -91,7 +106,7 @@ while True:
])
idx = idx + 1

exec_cmd(helm_upgrade_command)
exec_cmd(helm_upgrade_command, input = json.dumps(current_values).encode())


# Finally, print the currently installed manifest so Tilt knows about the resources
Expand Down

0 comments on commit 4aeab5b

Please sign in to comment.