Skip to content

Commit d8e9353

Browse files
authored
Remove --x-localimage experimental feature (#2670)
Remove the --x-localimage flag and all associated code that was never shipped. This includes: - CLI flag from build, push, predict, run, debug, and serve commands - LocalImage field from BuildOptions and log contexts - localImage parameter from dockerfile generators - FillInWeightsManifestVolumes and WeightManifest (dead code) - CogWeightsManifestLabelKey label constant - Integration tests for the feature
1 parent 22536d7 commit d8e9353

25 files changed

+38
-407
lines changed

integration-tests/tests/build_localimage.txtar

Lines changed: 0 additions & 37 deletions
This file was deleted.

integration-tests/tests/predict_localimage.txtar

Lines changed: 0 additions & 38 deletions
This file was deleted.

pkg/cli/build.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ var buildUseCogBaseImage bool
2929
var buildStrip bool
3030
var buildPrecompile bool
3131
var buildFast bool
32-
var buildLocalImage bool
3332
var configFilename string
3433

3534
const useCogBaseImageFlagKey = "use-cog-base-image"
@@ -54,7 +53,6 @@ func newBuildCommand() *cobra.Command {
5453
addStripFlag(cmd)
5554
addPrecompileFlag(cmd)
5655
addFastFlag(cmd)
57-
addLocalImage(cmd)
5856
addConfigFlag(cmd)
5957
addPipelineImage(cmd)
6058
cmd.Flags().StringVarP(&buildTag, "tag", "t", "", "A name for the built image in the form 'repository:tag'")
@@ -74,7 +72,7 @@ func buildCommand(cmd *cobra.Command, args []string) error {
7472
return err
7573
}
7674
logClient := coglog.NewClient(client)
77-
logCtx := logClient.StartBuild(buildLocalImage)
75+
logCtx := logClient.StartBuild()
7876

7977
src, err := model.NewSource(configFilename)
8078
if err != nil {
@@ -186,12 +184,6 @@ func addFastFlag(cmd *cobra.Command) {
186184
_ = cmd.Flags().MarkHidden(fastFlag)
187185
}
188186

189-
func addLocalImage(cmd *cobra.Command) {
190-
const localImage = "x-localimage"
191-
cmd.Flags().BoolVar(&buildLocalImage, localImage, false, "Whether to use the experimental local image features")
192-
_ = cmd.Flags().MarkHidden(localImage)
193-
}
194-
195187
func addConfigFlag(cmd *cobra.Command) {
196188
cmd.Flags().StringVarP(&configFilename, "file", "f", "cog.yaml", "The name of the config file.")
197189
}
@@ -237,7 +229,6 @@ func buildOptionsFromFlags(cmd *cobra.Command, imageName string, fast bool, anno
237229
Precompile: buildPrecompile,
238230
Fast: fast,
239231
Annotations: annotations,
240-
LocalImage: buildLocalImage,
241232
PipelinesImage: pipelinesImage,
242233
}
243234
}

pkg/cli/debug.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ func newDebugCommand() *cobra.Command {
2828
addUseCogBaseImageFlag(cmd)
2929
addBuildTimestampFlag(cmd)
3030
addFastFlag(cmd)
31-
addLocalImage(cmd)
3231
addConfigFlag(cmd)
3332
cmd.Flags().StringVarP(&imageName, "image-name", "", "", "The image name to use for the generated Dockerfile")
3433

@@ -49,7 +48,7 @@ func cmdDockerfile(cmd *cobra.Command, args []string) error {
4948
}
5049

5150
client := registry.NewRegistryClient()
52-
generator, err := dockerfile.NewGenerator(cfg, projectDir, buildFast, dockerClient, buildLocalImage, client, true)
51+
generator, err := dockerfile.NewGenerator(cfg, projectDir, buildFast, dockerClient, client, true)
5352
if err != nil {
5453
return fmt.Errorf("Error creating Dockerfile generator: %w", err)
5554
}

pkg/cli/predict.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ the prediction on that.`,
6666
addGpusFlag(cmd)
6767
addSetupTimeoutFlag(cmd)
6868
addFastFlag(cmd)
69-
addLocalImage(cmd)
7069
addConfigFlag(cmd)
7170
addPipelineImage(cmd)
7271

pkg/cli/push.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ func newPushCommand() *cobra.Command {
4040
addStripFlag(cmd)
4141
addPrecompileFlag(cmd)
4242
addFastFlag(cmd)
43-
addLocalImage(cmd)
4443
addConfigFlag(cmd)
4544
addPipelineImage(cmd)
4645

@@ -60,7 +59,7 @@ func push(cmd *cobra.Command, args []string) error {
6059
return err
6160
}
6261
logClient := coglog.NewClient(client)
63-
logCtx := logClient.StartPush(buildLocalImage)
62+
logCtx := logClient.StartPush()
6463

6564
src, err := model.NewSource(configFilename)
6665
if err != nil {
@@ -90,11 +89,6 @@ func push(cmd *cobra.Command, args []string) error {
9089
}
9190

9291
replicatePrefix := fmt.Sprintf("%s/", global.ReplicateRegistryHost)
93-
if !strings.HasPrefix(imageName, replicatePrefix) && buildLocalImage {
94-
err = fmt.Errorf("Unable to push a local image model to a non replicate host, please disable the local image flag before pushing to this host.")
95-
logClient.EndPush(ctx, err, logCtx)
96-
return err
97-
}
9892

9993
annotations := map[string]string{}
10094
buildID, err := uuid.NewV7()

pkg/cli/run.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ func newRunCommand() *cobra.Command {
3737
addUseCogBaseImageFlag(cmd)
3838
addGpusFlag(cmd)
3939
addFastFlag(cmd)
40-
addLocalImage(cmd)
4140
addConfigFlag(cmd)
4241
addPipelineImage(cmd)
4342

@@ -103,10 +102,6 @@ func run(cmd *cobra.Command, args []string) error {
103102
Volumes: []command.Volume{{Source: src.ProjectDir, Destination: "/src"}},
104103
Workdir: "/src",
105104
}
106-
runOptions, err = docker.FillInWeightsManifestVolumes(ctx, dockerClient, runOptions)
107-
if err != nil {
108-
return err
109-
}
110105

111106
for _, portString := range runPorts {
112107
port, err := strconv.Atoi(portString)

pkg/cli/serve.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ func cmdServe(cmd *cobra.Command, arg []string) error {
9292
Volumes: []command.Volume{{Source: src.ProjectDir, Destination: "/src"}},
9393
Workdir: "/src",
9494
}
95-
runOptions, err = docker.FillInWeightsManifestVolumes(ctx, dockerClient, runOptions)
96-
if err != nil {
97-
return err
98-
}
9995

10096
runOptions.Ports = append(runOptions.Ports, command.Port{HostPort: port, ContainerPort: 5000})
10197

pkg/coglog/build_log_context.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ type BuildLogContext struct {
66
started time.Time
77
Fast bool
88
CogRuntime bool
9-
localImage bool
109
}

pkg/coglog/client.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,13 @@ type buildLog struct {
2424
BuildError *string `json:"error"`
2525
Fast bool `json:"fast"`
2626
CogRuntime bool `json:"cog_runtime"`
27-
LocalImage bool `json:"local_image"`
2827
}
2928

3029
type pushLog struct {
3130
DurationMs float32 `json:"length_ms"`
3231
BuildError *string `json:"error"`
3332
Fast bool `json:"fast"`
3433
CogRuntime bool `json:"cog_runtime"`
35-
LocalImage bool `json:"local_image"`
3634
}
3735

3836
type pullLog struct {
@@ -46,10 +44,9 @@ func NewClient(client *http.Client) *Client {
4644
}
4745
}
4846

49-
func (c *Client) StartBuild(localImage bool) BuildLogContext {
47+
func (c *Client) StartBuild() BuildLogContext {
5048
logContext := BuildLogContext{
51-
started: time.Now(),
52-
localImage: localImage,
49+
started: time.Now(),
5350
}
5451
return logContext
5552
}
@@ -65,7 +62,6 @@ func (c *Client) EndBuild(ctx context.Context, err error, logContext BuildLogCon
6562
BuildError: errorStr,
6663
Fast: logContext.Fast,
6764
CogRuntime: logContext.CogRuntime,
68-
LocalImage: logContext.localImage,
6965
}
7066

7167
jsonData, err := json.Marshal(buildLog)
@@ -83,10 +79,9 @@ func (c *Client) EndBuild(ctx context.Context, err error, logContext BuildLogCon
8379
return true
8480
}
8581

86-
func (c *Client) StartPush(localImage bool) PushLogContext {
82+
func (c *Client) StartPush() PushLogContext {
8783
logContext := PushLogContext{
88-
started: time.Now(),
89-
localImage: localImage,
84+
started: time.Now(),
9085
}
9186
return logContext
9287
}
@@ -102,7 +97,6 @@ func (c *Client) EndPush(ctx context.Context, err error, logContext PushLogConte
10297
BuildError: errorStr,
10398
Fast: logContext.Fast,
10499
CogRuntime: logContext.CogRuntime,
105-
LocalImage: logContext.localImage,
106100
}
107101

108102
jsonData, err := json.Marshal(pushLog)

0 commit comments

Comments
 (0)