( ctx context.Context, container appext.Container, flags *flags, )
| 300 | } |
| 301 | |
| 302 | func getBuildableWorkspace( |
| 303 | ctx context.Context, |
| 304 | container appext.Container, |
| 305 | flags *flags, |
| 306 | ) (bufworkspace.Workspace, error) { |
| 307 | source, err := bufcli.GetInputValue(container, flags.InputHashtag, ".") |
| 308 | if err != nil { |
| 309 | return nil, err |
| 310 | } |
| 311 | controller, err := bufcli.NewController( |
| 312 | container, |
| 313 | bufctl.WithDisableSymlinks(flags.DisableSymlinks), |
| 314 | bufctl.WithFileAnnotationErrorFormat(flags.ErrorFormat), |
| 315 | ) |
| 316 | if err != nil { |
| 317 | return nil, err |
| 318 | } |
| 319 | workspace, err := controller.GetWorkspace( |
| 320 | ctx, |
| 321 | source, |
| 322 | // We actually could make it so that buf push would work with buf.work.yamls and push |
| 323 | // v1 workspaces as well, but this may have unintended (and potentially breaking) consequences |
| 324 | // that we don't want to deal with. If we have a v1 workspace, just outlaw pushing the whole |
| 325 | // workspace, and force people into the pre-refactor behavior. |
| 326 | bufctl.WithIgnoreAndDisallowV1BufWorkYAMLs(), |
| 327 | ) |
| 328 | if err != nil { |
| 329 | return nil, err |
| 330 | } |
| 331 | // Make sure the workspace builds. |
| 332 | if _, err := controller.GetImageForWorkspace( |
| 333 | ctx, |
| 334 | workspace, |
| 335 | bufctl.WithImageExcludeSourceInfo(true), |
| 336 | ); err != nil { |
| 337 | return nil, err |
| 338 | } |
| 339 | return workspace, nil |
| 340 | } |
| 341 | |
| 342 | func validateFlags(flags *flags) error { |
| 343 | if err := validateCreateFlags(flags); err != nil { |
no test coverage detected
searching dependent graphs…