[FEAT] [CLI] Make Hatchet Lite version configurable#3925
[FEAT] [CLI] Make Hatchet Lite version configurable#3925Ujjwal-Singh-20 wants to merge 2 commits into
Conversation
added two new flags to hatchet server start: --tag (default "latest") to let users pin a specific hatchet-lite image version (e.g. --tag v0.83.1), and --pull-policy (default "always") which accepts "always", "missing", or "never" - aligned with Docker Compose pull_policy semantics. The core change is a new pullImageWithPolicy() method in the Docker driver that replaces the two hardcoded ImagePull calls. With "never" it skips the pull entirely and errors if the image isnt local, with "missing" it checks ImageInspect first and only pulls if needed, and "always" preserves existing behavior. The hatchet-lite image name is now built dynamically from the tag instead of being hardcoded to :latest.
|
@Ujjwal-Singh-20 is attempting to deploy a commit to the Hatchet Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
Adds configurable image tag and pull policy to the hatchet server start CLI command so users can pin the hatchet-lite image version and control Docker pull behavior.
Changes:
- Introduces
PullPolicytype (always,missing,never) plusWithImageTag/WithPullPolicyoption setters and a sharedpullImageWithPolicyhelper in the Docker driver. - Adds
--tagand--pull-policyflags tohatchet server startand threads them throughstartLocalServer. - Updates the no-profile bootstrap call site to pass the existing defaults (
latest,always).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| cmd/hatchet-cli/cli/internal/drivers/docker/hatchet_lite.go | Adds PullPolicy enum, image tag/pull policy options, and centralized pull-with-policy logic used by both postgres and hatchet-lite container startup. |
| cmd/hatchet-cli/cli/server.go | Adds --tag and --pull-policy flags, examples, and forwards them into the driver options. |
| cmd/hatchet-cli/cli/worker.go | Updates the bootstrap path to pass the new default tag/pull-policy arguments to startLocalServer. |
|
Promptless prepared a documentation update related to this change. Triggered by PR #3925 Updated the CLI reference documentation for |
gregfurman
left a comment
There was a problem hiding this comment.
Nice! Have left some comments. Lmk if you can address 😄
| const ( | ||
| // PullPolicyAlways always pulls the image from the registry (default, existing behavior). | ||
| PullPolicyAlways PullPolicy = "always" | ||
| // PullPolicyMissing only pulls if the image is not already available locally. | ||
| PullPolicyMissing PullPolicy = "missing" | ||
| // PullPolicyNever never pulls; the image must already exist locally. | ||
| PullPolicyNever PullPolicy = "never" | ||
| ) | ||
|
|
There was a problem hiding this comment.
IMO we can remove these comments. Perhaps just leave the original on PullPolicy
| } | ||
|
|
||
| // PullPolicy controls when Docker images are pulled, mirroring Docker Compose's pull_policy. | ||
| type PullPolicy string |
There was a problem hiding this comment.
Should PullPolicy be public?
There was a problem hiding this comment.
Sorry for overlooking that, it should not be public, since its only used internally within the docker package
| func (d *DockerDriver) pullImageWithPolicy(ctx context.Context, imageName string, policy PullPolicy) error { | ||
| switch policy { | ||
| case PullPolicyNever: | ||
| // Verify the image exists locally. |
There was a problem hiding this comment.
Can we remove these comments? Would help tighten up the diff!
|
|
||
| // startLocalServer starts a local Hatchet server and returns connection details | ||
| func startLocalServer(cmd *cobra.Command, profileName string, dashboardPort, grpcPort int, projectName string) (*ServerStartResult, error) { | ||
| func startLocalServer(cmd *cobra.Command, profileName string, dashboardPort, grpcPort int, projectName, tag, pullPolicy string) (*ServerStartResult, error) { |
There was a problem hiding this comment.
nit: function signature is getting quite long. Wdyt of passing in a struct here instead? Or perhaps instead replacing all of these with varadic HatchetLiteOpt fns?
There was a problem hiding this comment.
well second option will be better i think, refactored startLocalServer to use the variadic HatchetLiteOpt pattern. Its much cleaner now. Thanks for the tip
| } | ||
| } | ||
|
|
||
| // pullImageWithPolicy pulls an image according to the specified pull policy. |
There was a problem hiding this comment.
super-nit: don't think we need docs IMO -- this is a private + internal function unlikely to be used anywhere else in the codebase.
There was a problem hiding this comment.
Apologies for the over documentation, I was using some AI assistance to ensure the logic was clear but definitely went a bit overboard
addressed, please check |
Description
This PR implements configurable image tags and pull policies for the hatchet server start command. It allows users to pin a specific version of the hatchet-lite image and control when the Docker daemon attempts to pull images from the registry.
Fixes #3911
Type of change
What's Changed