tryretool / retool-helm

MIT License
45 stars 57 forks source link

add default image tag for code executor #148

Closed avimoondra closed 6 months ago

avimoondra commented 6 months ago

Follow up from https://github.com/tryretool/retool-helm/pull/145

Adds default image tag for code executor that's based on backend's image tag (after 3.20.15)

Tests

Inputs

echo "\n\n\n ====== Running tests for code-executor (helm) ======";
helm version

echo "TEST: (no tag)"
helm template -f ~/retool-helm/charts/retool/values.yaml foo ~/retool-helm/charts/retool --set config.encryptionKey="foo" | grep code-executor;
echo "No CE";
echo "\n";

echo "TEST: --set image.tag=3.20.16"
helm template -f ~/retool-helm/charts/retool/values.yaml foo ~/retool-helm/charts/retool --set config.encryptionKey="foo" --set image.tag="3.20.16" | grep code-executor;
echo "Expecting CE (3.20.16)";
echo "\n";

echo "TEST: --set image.tag=3.20.16 --set codeExecutor.enabled=true"
helm template -f ~/retool-helm/charts/retool/values.yaml foo ~/retool-helm/charts/retool --set config.encryptionKey="foo" --set image.tag="3.20.16" --set codeExecutor.enabled=true | grep code-executor;
echo "Expecting CE (3.20.16)";
echo "\n";

echo "TEST: --set image.tag=3.20.14"
helm template -f ~/retool-helm/charts/retool/values.yaml foo ~/retool-helm/charts/retool --set config.encryptionKey="foo" --set image.tag="3.20.14" | grep code-executor;
echo "No CE";
echo "\n";

echo "TEST: --set image.tag=3.20.14 --set codeExecutor.image.tag=3.20.14"
helm template -f ~/retool-helm/charts/retool/values.yaml foo ~/retool-helm/charts/retool --set config.encryptionKey="foo" --set image.tag="3.20.14" --set codeExecutor.image.tag="3.20.14" | grep code-executor;
echo "No CE";
echo "\n";

echo "TEST: --set image.tag=3.20.14 --set codeExecutor.enabled=true"
helm template -f ~/retool-helm/charts/retool/values.yaml foo ~/retool-helm/charts/retool --set config.encryptionKey="foo" --set image.tag="3.20.14" --set codeExecutor.enabled=true | grep code-executor;
echo "Expecting CE (1.1.0)";
echo "\n";

echo "TEST: --set image.tag=3.20.14 --set codeExecutor.image.tag=2.2.0 --set codeExecutor.enabled=true"
helm template -f ~/retool-helm/charts/retool/values.yaml foo ~/retool-helm/charts/retool --set config.encryptionKey="foo" --set image.tag="3.20.14" --set codeExecutor.image.tag="2.2.0" --set codeExecutor.enabled=true | grep code-executor;
echo "Expecting CE (2.2.0)";
echo "\n";

echo "TEST: --set image.tag=latest"
helm template -f ~/retool-helm/charts/retool/values.yaml foo ~/retool-helm/charts/retool --set config.encryptionKey="foo" --set image.tag="latest" | grep code-executor;
echo "No CE";
echo "\n";

echo "TEST: --set image.tag=latest --set codeExecutor.enabled=true"
helm template -f ~/retool-helm/charts/retool/values.yaml foo ~/retool-helm/charts/retool --set config.encryptionKey="foo" --set image.tag="latest" --set codeExecutor.enabled=true | grep code-executor;
echo "No CE";
echo "\n";

Outputs

 ====== Running tests for code-executor (helm) ======
version.BuildInfo{Version:"v3.10.3", GitCommit:"835b7334cfe2e5e27870ab3ed4135f136eecc704", GitTreeState:"clean", GoVersion:"go1.19.4"}
TEST: (no tag)
Error: execution error at (retool/templates/deployment_jobs.yaml:51:50): Please set a value for .Values.image.tag

Use --debug flag to render out invalid YAML
No CE

TEST: --set image.tag=3.20.16
  name: foo-retool-code-executor
    retoolService: foo-retool-code-executor
            value: http://foo-retool-code-executor
  name: foo-retool-code-executor
    retoolService: foo-retool-code-executor
      retoolService: foo-retool-code-executor
        prometheus.io/job: foo-retool-code-executor
        retoolService: foo-retool-code-executor
        image: "tryretool/code-executor-service:3.20.16"
            value: http://foo-retool-code-executor
Expecting CE (3.20.16)

TEST: --set image.tag=3.20.16 --set codeExecutor.enabled=true
  name: foo-retool-code-executor
    retoolService: foo-retool-code-executor
            value: http://foo-retool-code-executor
  name: foo-retool-code-executor
    retoolService: foo-retool-code-executor
      retoolService: foo-retool-code-executor
        prometheus.io/job: foo-retool-code-executor
        retoolService: foo-retool-code-executor
        image: "tryretool/code-executor-service:3.20.16"
            value: http://foo-retool-code-executor
            value: http://foo-retool-code-executor
Expecting CE (3.20.16)

TEST: --set image.tag=3.20.14
No CE

TEST: --set image.tag=3.20.14 --set codeExecutor.image.tag=3.20.14
No CE

TEST: --set image.tag=3.20.14 --set codeExecutor.enabled=true
  name: foo-retool-code-executor
    retoolService: foo-retool-code-executor
            value: http://foo-retool-code-executor
  name: foo-retool-code-executor
    retoolService: foo-retool-code-executor
      retoolService: foo-retool-code-executor
        prometheus.io/job: foo-retool-code-executor
        retoolService: foo-retool-code-executor
        image: "tryretool/code-executor-service:1.1.0"
            value: http://foo-retool-code-executor
            value: http://foo-retool-code-executor
Expecting CE (1.1.0)

TEST: --set image.tag=3.20.14 --set codeExecutor.image.tag=2.2.0 --set codeExecutor.enabled=true
  name: foo-retool-code-executor
    retoolService: foo-retool-code-executor
            value: http://foo-retool-code-executor
  name: foo-retool-code-executor
    retoolService: foo-retool-code-executor
      retoolService: foo-retool-code-executor
        prometheus.io/job: foo-retool-code-executor
        retoolService: foo-retool-code-executor
        image: "tryretool/code-executor-service:2.2.0"
            value: http://foo-retool-code-executor
            value: http://foo-retool-code-executor
Expecting CE (2.2.0)

TEST: --set image.tag=latest
No CE

TEST: --set image.tag=latest --set codeExecutor.enabled=true
Error: execution error at (retool/templates/deployment_code_executor.yaml:53:63): If using image.tag=latest (not recommended, select an explicit tag instead) and enabling codeExecutor, explicitly set codeExecutor.image.tag

Use --debug flag to render out invalid YAML
No CE

Also tested w/ Helm 3.7 👍 ✅