-
Notifications
You must be signed in to change notification settings - Fork 690
Kong CLI parity via shared command logic #3047
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
Draft
markphelps
wants to merge
20
commits into
kong
Choose a base branch
from
kong-cli-parity
base: kong
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
9075ab5
fix: mount weights in cog serve like cog run does (#3044)
markphelps a1b710a
Bump version to 0.21.0-rc.2 (#3045)
markphelps 9b9f310
chore: regen lockfile
markphelps 8428257
ci: pin mise version in release workflows (#3046)
markphelps b5c8563
test: cover kong command registration and root globals
markphelps 127e8b1
refactor: share build command logic between cobra and kong
markphelps 957c924
refactor: share push command logic between cobra and kong
markphelps 95b223e
feat: add kong serve and exec parity via shared runtime runners
markphelps 1477b1f
feat: add kong init, login, doctor, debug parity
markphelps 1f1b4c4
feat: add kong predict, run, and train parity via shared runners
markphelps 89a4b4f
feat: add kong weights command parity and fix version short-flag coll…
markphelps acff164
feat: add kong base-image command parity and remove stubs
markphelps 92f0237
test: verify kong cli parity and clean up unused cobra helpers
markphelps 63c65df
feat: support JSON-native union inputs (#3048)
markphelps 2ab4cc4
test: fuzz schema generation for union inputs + docs fixup (#3049)
markphelps d6c2b70
Bump version to 0.21.0-rc.3 (#3050)
markphelps 4c0596d
Merge remote-tracking branch 'origin/main' into kong-cli-parity
markphelps bf8a249
fix: hide kong predict/train/weights/debug and drop dead os.Exit
markphelps f83efb3
fix: close kong/cobra CLI parity gaps from review
markphelps 89369f1
fix: address Kong/Cobra CLI parity review feedback
markphelps File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 0.21.0-rc.1 | ||
| 0.21.0-rc.3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/replicate/cog/pkg/cli" | ||
| "github.com/replicate/cog/pkg/docker/command" | ||
| ) | ||
|
|
||
| // BaseImageCmd implements the experimental "cog base-image" command group. | ||
| type BaseImageCmd struct { | ||
| Dockerfile BaseImageDockerfileCmd `cmd:"" help:"Display Cog base image Dockerfile."` | ||
| Build BaseImageBuildCmd `cmd:"" help:"Build Cog base image."` | ||
| GenerateMatrix BaseImageGenerateMatrixCmd `cmd:"" name:"generate-matrix" help:"Generate a matrix of Cog base image versions (JSON)."` | ||
| } | ||
|
|
||
| // baseImageVersionFlags groups the version-selecting flags shared by the | ||
| // base-image subcommands. | ||
| type baseImageVersionFlags struct { | ||
| CUDA string `name:"cuda" help:"CUDA version."` | ||
| Python string `name:"python" help:"Python version."` | ||
| Torch string `name:"torch" help:"Torch version."` | ||
|
|
||
| // Hidden flags for parity with the Cobra base-image command. | ||
| BreakSystemPackages bool `name:"break-system-packages" hidden:"" help:"Allow pip to modify uv-managed Python installs."` | ||
| BuildContextDir string `name:"build-context-dir" hidden:"" help:"Directory for generated Docker build context artifacts."` | ||
| Timestamp int64 `name:"timestamp" hidden:"" default:"-1" help:"Number of seconds since Epoch to use for the build timestamp."` | ||
| } | ||
|
|
||
| func (f baseImageVersionFlags) options() cli.BaseImageOptions { | ||
| return cli.BaseImageOptions{ | ||
| CUDAVersion: f.CUDA, | ||
| PythonVersion: f.Python, | ||
| TorchVersion: f.Torch, | ||
| BreakSystemPackages: f.BreakSystemPackages, | ||
| BuildContextDir: f.BuildContextDir, | ||
| Timestamp: f.Timestamp, | ||
| } | ||
| } | ||
|
|
||
| // BaseImageDockerfileCmd implements "cog base-image dockerfile". | ||
| type BaseImageDockerfileCmd struct { | ||
| baseImageVersionFlags `embed:""` | ||
|
|
||
| NoCache bool `name:"no-cache" help:"Do not use cache when building the image."` | ||
| Progress string `name:"progress" default:"${progress_default}" enum:"auto,plain,tty,quiet" help:"Set type of build progress output: ${enum}."` | ||
| } | ||
|
|
||
| func (cmd *BaseImageDockerfileCmd) Run(ctx context.Context) error { | ||
| opts := cmd.options() | ||
| opts.NoCache = cmd.NoCache | ||
| opts.ProgressOutput = cmd.Progress | ||
| return cli.RunBaseImageDockerfile(ctx, opts) | ||
| } | ||
|
|
||
| // BaseImageBuildCmd implements "cog base-image build". | ||
| type BaseImageBuildCmd struct { | ||
| baseImageVersionFlags `embed:""` | ||
| } | ||
|
|
||
| func (cmd *BaseImageBuildCmd) Run(ctx context.Context, dockerClient command.Command) error { | ||
| return cli.RunBaseImageBuild(ctx, dockerClient, cmd.options()) | ||
| } | ||
|
|
||
| // BaseImageGenerateMatrixCmd implements "cog base-image generate-matrix". | ||
| type BaseImageGenerateMatrixCmd struct { | ||
| baseImageVersionFlags `embed:""` | ||
| } | ||
|
|
||
| func (cmd *BaseImageGenerateMatrixCmd) Run() error { | ||
| return cli.RunBaseImageGenerateMatrix(cmd.options()) | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.