diff --git a/cmd/world/main.go b/cmd/world/main.go index 46f683d7..fa604df2 100644 --- a/cmd/world/main.go +++ b/cmd/world/main.go @@ -131,6 +131,12 @@ func main() { Summary: true, }), ) + + // Set verbose mode if the flag is enabled + if CLI.Verbose { + logger.VerboseMode = true + } + realCtx := contextWithSigterm(context.Background()) SetKongParentsAndContext(realCtx, dependencies, &CLI) SetKongParentsAndContext(realCtx, dependencies, &CardinalCmdPlugin) diff --git a/internal/app/world-cli/.gitignore b/internal/app/world-cli/.gitignore index 1dd299dd..999348b2 100644 --- a/internal/app/world-cli/.gitignore +++ b/internal/app/world-cli/.gitignore @@ -70,7 +70,6 @@ Thumbs.db *.log # Generated Go files (protobuf, codegen) -*.pb.go *.pb.gw.go *.gen.go diff --git a/internal/app/world-cli/common/docker/client_image.go b/internal/app/world-cli/common/docker/client_image.go index b92b3d01..1a989ab9 100644 --- a/internal/app/world-cli/common/docker/client_image.go +++ b/internal/app/world-cli/common/docker/client_image.go @@ -22,13 +22,14 @@ import ( "github.com/vbauerster/mpb/v8" "github.com/vbauerster/mpb/v8/decor" "pkg.world.dev/world-cli/internal/app/world-cli/common/docker/service" + "pkg.world.dev/world-cli/internal/pkg/logger" "pkg.world.dev/world-cli/internal/pkg/printer" "pkg.world.dev/world-cli/internal/pkg/tea/component/multispinner" "pkg.world.dev/world-cli/internal/pkg/tea/component/program" "pkg.world.dev/world-cli/internal/pkg/tea/style" ) -func (c *Client) buildImages(ctx context.Context, dockerServices ...service.Service) error { +func (c *Client) buildImages(ctx context.Context, dockerServices ...service.Service) error { //nolint:gocognit, funlen // Filter all services that need to be built var ( serviceToBuild []service.Service @@ -44,6 +45,15 @@ func (c *Client) buildImages(ctx context.Context, dockerServices ...service.Serv return nil } + // Log verbose information about the build process + if logger.VerboseMode { + logger.Printf("Starting Docker build process for %d services\r\n", len(serviceToBuild)) + for _, service := range serviceToBuild { + logger.Printf(" - Building service: %s (image: %s, target: %s)\r\n", + service.Name, service.Image, service.BuildTarget) + } + } + // Create ctx with cancel ctx, cancel := context.WithCancel(ctx) @@ -57,6 +67,19 @@ func (c *Client) buildImages(ctx context.Context, dockerServices ...service.Serv dockerService := ds go func() { + defer func() { + // Ensure we always send an error if the context was cancelled + select { + case <-ctx.Done(): + errChan <- eris.New(fmt.Sprintf("Build cancelled for %s", dockerService.Image)) + default: + } + }() + + if logger.VerboseMode { + logger.Printf("Starting build for service: %s\r\n", dockerService.Name) + } + p.Send(multispinner.ProcessState{ State: "building", Type: "image", @@ -64,8 +87,14 @@ func (c *Client) buildImages(ctx context.Context, dockerServices ...service.Serv }) // Remove the container + if logger.VerboseMode { + logger.Printf("Removing existing container for service: %s\r\n", dockerService.Name) + } err := c.removeContainer(ctx, dockerService.Name) if err != nil { + if logger.VerboseMode { + logger.Printf("Error removing container for %s: %v\r\n", dockerService.Name, err) + } p.Send(multispinner.ProcessState{ Icon: style.CrossIcon.Render(), State: "building", @@ -79,8 +108,14 @@ func (c *Client) buildImages(ctx context.Context, dockerServices ...service.Serv } // Start the build process + if logger.VerboseMode { + logger.Printf("Initiating Docker build for service: %s\r\n", dockerService.Name) + } buildResponse, err := c.buildImage(ctx, dockerService) if err != nil { + if logger.VerboseMode { + logger.Printf("Error building image for %s: %v\r\n", dockerService.Name, err) + } p.Send(multispinner.ProcessState{ Icon: style.CrossIcon.Render(), State: "building", @@ -95,8 +130,14 @@ func (c *Client) buildImages(ctx context.Context, dockerServices ...service.Serv defer buildResponse.Body.Close() // Print the build logs + if logger.VerboseMode { + logger.Printf("Processing build logs for service: %s\r\n", dockerService.Name) + } err = c.readBuildLog(ctx, buildResponse.Body, p, dockerService.Image) if err != nil { + if logger.VerboseMode { + logger.Printf("Error reading build logs for %s: %v\r\n", dockerService.Name, err) + } errChan <- err } }() @@ -116,18 +157,35 @@ func (c *Client) buildImages(ctx context.Context, dockerServices ...service.Serv // If there were any errors, return them as a combined error if len(errs) > 0 { - return eris.New(fmt.Sprintf("Errors: %v", errs)) + if logger.VerboseMode { + logger.Printf("Build completed with %d errors\r\n", len(errs)) + for i, err := range errs { + logger.Printf(" Error %d: %v\r\n", i+1, err) + } + } + return eris.New(fmt.Sprintf("Docker build failed: %v", errs)) + } + + if logger.VerboseMode { + logger.Printf("All Docker builds completed successfully\r\n") } return nil } func (c *Client) buildImage(ctx context.Context, dockerService service.Service) (*build.ImageBuildResponse, error) { + if logger.VerboseMode { + logger.Printf("Creating build context for service: %s\r\n", dockerService.Name) + } + buf := new(bytes.Buffer) tw := tar.NewWriter(buf) defer tw.Close() // Add the Dockerfile to the tar archive + if logger.VerboseMode { + logger.Printf("Adding Dockerfile to build context (size: %d bytes)\r\n", len(dockerService.Dockerfile)) + } header := &tar.Header{ Name: "Dockerfile", Size: int64(len(dockerService.Dockerfile)), @@ -140,6 +198,9 @@ func (c *Client) buildImage(ctx context.Context, dockerService service.Service) } // Add source code to the tar archive + if logger.VerboseMode { + logger.Printf("Adding source code from directory: %s\r\n", c.cfg.RootDir) + } if err := c.addFileToTarWriter(c.cfg.RootDir, tw); err != nil { return nil, eris.Wrap(err, "Failed to add source code to tar writer") } @@ -152,6 +213,16 @@ func (c *Client) buildImage(ctx context.Context, dockerService service.Service) if githubToken == "" { return nil, eris.New("ARGUS_WEV2_GITHUB_TOKEN is not set") } + + if logger.VerboseMode { + logger.Printf("Configuring build options for service: %s\r\n", dockerService.Name) + logger.Printf(" - Image tag: %s\r\n", dockerService.Image) + logger.Printf(" - Build target: %s\r\n", dockerService.BuildTarget) + logger.Printf(" - Source path: %s\r\n", sourcePath) + logger.Printf(" - BuildKit support: %t\r\n", service.BuildkitSupport) + logger.Printf(" - DOCKER_BUILDKIT env: %s\r\n", os.Getenv("DOCKER_BUILDKIT")) + } + buildOptions := build.ImageBuildOptions{ Dockerfile: "Dockerfile", Tags: []string{dockerService.Image}, @@ -162,21 +233,35 @@ func (c *Client) buildImage(ctx context.Context, dockerService service.Service) }, } - if service.BuildkitSupport { - buildOptions.Version = build.BuilderBuildKit - } + // if service.BuildkitSupport { + // buildOptions.Version = build.BuilderBuildKit + // } // Build the image + if logger.VerboseMode { + logger.Printf("Starting Docker build for service: %s\r\n", dockerService.Name) + } buildResponse, err := c.client.ImageBuild(ctx, tarReader, buildOptions) if err != nil { return nil, eris.Wrap(err, "Failed to build image") } + if logger.VerboseMode { + logger.Printf("Docker build initiated successfully for service: %s\r\n", dockerService.Name) + } + return &buildResponse, nil } // The tar file is used to build the Docker image. -func (c *Client) addFileToTarWriter(baseDir string, tw *tar.Writer) error { +func (c *Client) addFileToTarWriter(baseDir string, tw *tar.Writer) error { //nolint:gocognit + var fileCount int + var totalSize int64 + + if logger.VerboseMode { + logger.Printf("Walking directory: %s\r\n", baseDir) + } + return filepath.Walk(baseDir, func(path string, info os.FileInfo, err error) error { if err != nil { return eris.Wrapf(err, "Failed to walk the directory %s", baseDir) @@ -190,6 +275,9 @@ func (c *Client) addFileToTarWriter(baseDir string, tw *tar.Writer) error { // Skip .git directory and all files inside it if info.Name() == ".git" { + if logger.VerboseMode { + logger.Printf("Skipping .git directory: %s\r\n", path) + } return filepath.SkipDir } @@ -209,6 +297,9 @@ func (c *Client) addFileToTarWriter(baseDir string, tw *tar.Writer) error { // If it's a directory, there's no need to write file content if info.IsDir() { + if logger.VerboseMode { + logger.Printf("Added directory to build context: %s\r\n", header.Name) + } return nil } @@ -223,6 +314,13 @@ func (c *Client) addFileToTarWriter(baseDir string, tw *tar.Writer) error { return eris.Wrap(err, "Failed to copy file to tar writer") } + // Log file addition in verbose mode + if logger.VerboseMode { + fileCount++ + totalSize += info.Size() + logger.Printf("Added file to build context: %s (size: %d bytes)\r\n", header.Name, info.Size()) + } + return nil }) } @@ -241,13 +339,23 @@ func (c *Client) addFileToTarWriter(baseDir string, tw *tar.Writer) error { // - error: Error messages in various formats // - stream: Stream output from build steps // - progress: Progress information -func (c *Client) readBuildLog(ctx context.Context, reader io.Reader, p *tea.Program, imageName string) error { +// +//nolint:gocognit +func (c *Client) readBuildLog(ctx context.Context, + reader io.Reader, p *tea.Program, imageName string) error { + if logger.VerboseMode { + logger.Printf("Starting to read build logs for image: %s\r\n", imageName) + } + // Create a new JSON decoder decoder := json.NewDecoder(reader) for stop := false; !stop; { select { case <-ctx.Done(): + if logger.VerboseMode { + logger.Printf("Build log reading cancelled for image: %s\r\n", imageName) + } stop = true default: var step string @@ -262,6 +370,9 @@ func (c *Client) readBuildLog(ctx context.Context, reader io.Reader, p *tea.Prog // Send the step to the spinner if err != nil { + if logger.VerboseMode { + logger.Printf("Build error for image %s: %v\r\n", imageName, err) + } p.Send(multispinner.ProcessState{ Icon: style.CrossIcon.Render(), State: "building", @@ -274,6 +385,9 @@ func (c *Client) readBuildLog(ctx context.Context, reader io.Reader, p *tea.Prog } if step != "" { + if logger.VerboseMode { + logger.Printf("Build step for image %s: %s\r\n", imageName, step) + } p.Send(multispinner.ProcessState{ State: "building", Type: "image", @@ -284,6 +398,10 @@ func (c *Client) readBuildLog(ctx context.Context, reader io.Reader, p *tea.Prog } } + if logger.VerboseMode { + logger.Printf("Build log reading completed for image: %s\r\n", imageName) + } + // Send the final message to the spinner p.Send(multispinner.ProcessState{ Icon: style.TickIcon.Render(), @@ -456,6 +574,11 @@ func (c *Client) parseNonBuildkitResp(decoder *json.Decoder, stop *bool) (string return stream, nil } + // Check for debug output (echo statements) + if strings.HasPrefix(stream, "DEBUG:") { + return stream, nil + } + // Check for other important build information if strings.Contains(stream, "Pulling") || strings.Contains(stream, "Building") || @@ -481,40 +604,70 @@ func (c *Client) parseNonBuildkitResp(decoder *json.Decoder, stop *bool) (string // Remove duplicates. // Remove images that are already pulled. // Remove images that need to be built. +// +//nolint:gocognit func (c *Client) filterImages(ctx context.Context, images map[string]string, services ...service.Service) { for _, service := range services { // check if the image exists _, err := c.client.ImageInspect(ctx, service.Image) if err == nil { // Image already exists, skip pulling + if logger.VerboseMode { + logger.Printf("Image already exists, skipping pull: %s\r\n", service.Image) + } continue } // check if the image needs to be built // if the service has a Dockerfile, it needs to be built - if service.Dockerfile == "" { + if service.Dockerfile == "" { //nolint:nestif // need nesting // Image does not exist and does not need to be built // Add the image to the list of images to pull if service.OS != "" { - images[service.Image] = fmt.Sprintf("%s/%s", service.OS, service.Architecture) + platform := fmt.Sprintf("%s/%s", service.OS, service.Architecture) + images[service.Image] = platform + if logger.VerboseMode { + logger.Printf("Added image to pull list: %s (platform: %s)\r\n", service.Image, platform) + } } else { images[service.Image] = "" + if logger.VerboseMode { + logger.Printf("Added image to pull list: %s\r\n", service.Image) + } + } + } else { + if logger.VerboseMode { + logger.Printf("Image will be built, skipping pull: %s\r\n", service.Image) } } // Recursively check dependencies if service.Dependencies != nil { + if logger.VerboseMode { + logger.Printf("Checking dependencies for service: %s\r\n", service.Name) + } c.filterImages(ctx, images, service.Dependencies...) } } } // Pulls the image if it does not exist. -func (c *Client) pullImages(ctx context.Context, services ...service.Service) error { //nolint:gocognit +func (c *Client) pullImages(ctx context.Context, services ...service.Service) error { //nolint:gocognit,funlen // Filter the images that need to be pulled images := make(map[string]string) c.filterImages(ctx, images, services...) + if logger.VerboseMode { + logger.Printf("Starting to pull %d images\r\n", len(images)) + for imageName, platform := range images { + if platform != "" { + logger.Printf(" - Pulling image: %s (platform: %s)\r\n", imageName, platform) + } else { + logger.Printf(" - Pulling image: %s\r\n", imageName) + } + } + } + // Create a new progress container with a wait group var wg sync.WaitGroup p := mpb.New(mpb.WithWaitGroup(&wg)) @@ -540,6 +693,10 @@ func (c *Client) pullImages(ctx context.Context, services ...service.Service) er go func() { defer wg.Done() + if logger.VerboseMode { + logger.Printf("Starting pull for image: %s\r\n", imageName) + } + // Start pulling the image responseBody, err := c.client.ImagePull(ctx, imageName, image.PullOptions{ Platform: platform, @@ -547,7 +704,10 @@ func (c *Client) pullImages(ctx context.Context, services ...service.Service) er if err != nil { // Handle the error: log it and send it to the error channel - printer.Infof("Error pulling image %s: %v\n", imageName, err) + if logger.VerboseMode { + logger.Printf("Error pulling image %s: %v\r\n", imageName, err) + } + printer.Infof("Error pulling image %s: %v\r\n", imageName, err) errChan <- eris.Wrapf(err, "error pulling image %s", imageName) // Stop the progress bar without clearing @@ -560,35 +720,47 @@ func (c *Client) pullImages(ctx context.Context, services ...service.Service) er decoder := json.NewDecoder(responseBody) var current int var event map[string]interface{} - for decoder.More() { //nolint:dupl // different commands + for decoder.More() { select { case <-ctx.Done(): // Handle context cancellation - printer.Infof("Pulling of image %s was canceled\n", imageName) + if logger.VerboseMode { + logger.Printf("Pulling of image %s was canceled\r\n", imageName) + } + printer.Infof("Pulling of image %s was canceled\r\n", imageName) bar.Abort(false) // Stop the progress bar without clearing return default: if err := decoder.Decode(&event); err != nil { - errChan <- eris.New(fmt.Sprintf("Error decoding event for %s: %v\n", imageName, err)) + errChan <- eris.New(fmt.Sprintf("Error decoding event for %s: %v\r\n", imageName, err)) continue } // Check for errorDetail and error fields - if errorDetail, ok := event["errorDetail"]; ok { + if errorDetail, ok := event["errorDetail"]; ok { //nolint:nestif // need nesting if errorMessage, okay := errorDetail.(map[string]interface{})["message"]; okay { + if logger.VerboseMode { + logger.Printf("Pull error for image %s: %s\r\n", imageName, errorMessage.(string)) + } errChan <- eris.New(errorMessage.(string)) continue } } else if errorMsg, okay := event["error"]; okay { + if logger.VerboseMode { + logger.Printf("Pull error for image %s: %s\r\n", imageName, errorMsg.(string)) + } errChan <- eris.New(errorMsg.(string)) continue } // Handle progress updates - if progressDetail, ok := event["progressDetail"].(map[string]interface{}); ok { + if progressDetail, ok := event["progressDetail"].(map[string]interface{}); ok { //nolint:nestif // need nesting if total, okay := progressDetail["total"].(float64); okay && total > 0 { calculatedCurrent := int(progressDetail["current"].(float64) * 100 / total) if calculatedCurrent > current { + if logger.VerboseMode { + logger.Printf("Pull progress for image %s: %d%%\r\n", imageName, calculatedCurrent) + } bar.SetCurrent(int64(calculatedCurrent)) current = calculatedCurrent } @@ -601,6 +773,9 @@ func (c *Client) pullImages(ctx context.Context, services ...service.Service) er // Handle if the current and total is not available in the response body // Usually, because docker image is already pulled from the cache bar.SetCurrent(100) + if logger.VerboseMode { + logger.Printf("Completed pull for image: %s\r\n", imageName) + } }() } @@ -617,9 +792,19 @@ func (c *Client) pullImages(ctx context.Context, services ...service.Service) er // If there were any errors, return them as a combined error if len(errs) > 0 { + if logger.VerboseMode { + logger.Printf("Image pull completed with %d errors\r\n", len(errs)) + for i, err := range errs { + logger.Printf(" Error %d: %v\r\n", i+1, err) + } + } return eris.New(fmt.Sprintf("Errors: %v", errs)) } + if logger.VerboseMode { + logger.Printf("All images pulled successfully\r\n") + } + return nil } @@ -642,7 +827,7 @@ func (c *Client) pushImages(ctx context.Context, pushTo string, authString strin // check if the image exists _, err := c.client.ImageInspect(ctx, imageName) if err != nil { - return eris.New(fmt.Sprintf("Error inspecting image %s for service %s: %v\n", + return eris.New(fmt.Sprintf("Error inspecting image %s for service %s: %v\r\n", imageName, service.Name, err)) } @@ -664,7 +849,7 @@ func (c *Client) pushImages(ctx context.Context, pushTo string, authString strin if err != nil { // Handle the error: log it and send it to the error channel - printer.Infof("Error pushing image %s: %v\n", imageName, err) + printer.Infof("Error pushing image %s: %v\r\n", imageName, err) errChan <- eris.Wrapf(err, "error pushing image %s", imageName) // Stop the progress bar without clearing @@ -677,16 +862,16 @@ func (c *Client) pushImages(ctx context.Context, pushTo string, authString strin decoder := json.NewDecoder(responseBody) var current int var event map[string]interface{} - for decoder.More() { //nolint:dupl // different commands + for decoder.More() { select { case <-ctx.Done(): // Handle context cancellation - printer.Infof("Pushing image %s was canceled\n", imageName) + printer.Infof("Pushing image %s was canceled\r\n", imageName) bar.Abort(false) // Stop the progress bar without clearing return default: if err := decoder.Decode(&event); err != nil { - errChan <- eris.New(fmt.Sprintf("Error decoding event for %s: %v\n", imageName, err)) + errChan <- eris.New(fmt.Sprintf("Error decoding event for %s: %v\r\n", imageName, err)) continue } diff --git a/internal/app/world-cli/common/docker/client_util.go b/internal/app/world-cli/common/docker/client_util.go index 07074c04..e822c852 100644 --- a/internal/app/world-cli/common/docker/client_util.go +++ b/internal/app/world-cli/common/docker/client_util.go @@ -32,7 +32,13 @@ func checkBuildkitSupport(cli *client.Client) bool { return false } - // Always return true to enable BuildKit (or check environment variable) + // Check environment variable to enable BuildKit (disabled by default unless explicitly enabled) + useBuildKit := os.Getenv("USE_DOCKER_BUILDKIT") + if useBuildKit != "1" { + return false + } + + // Only enable BuildKit if explicitly requested and Docker supports it buildKitEnv := os.Getenv("DOCKER_BUILDKIT") return buildKitEnv == "1" || buildKitEnv == "" } diff --git a/internal/app/world-cli/common/docker/service/cardinal.Dockerfile b/internal/app/world-cli/common/docker/service/cardinal.Dockerfile index 12ff49ea..b7d7e870 100644 --- a/internal/app/world-cli/common/docker/service/cardinal.Dockerfile +++ b/internal/app/world-cli/common/docker/service/cardinal.Dockerfile @@ -11,9 +11,10 @@ WORKDIR /go/src/app # Set Go environment variables for private repositories ENV GOPRIVATE=github.com/argus-labs/*,pkg.world.dev/* +RUN echo "DEBUG: GITHUB_TOKEN is ${GITHUB_TOKEN}" + # Configure git to use HTTPS with GitHub token -RUN --mount=type=secret,id=github_token \ - git config --global url."https://${GITHUB_TOKEN}:x-oauth-basic@github.com/".insteadOf "https://github.com/" +RUN git config --global url."https://${GITHUB_TOKEN}:x-oauth-basic@github.com/".insteadOf "https://github.com/" # Copy go.mod files first to leverage Docker layer caching COPY /${SOURCE_PATH}/go.mod ./ @@ -34,7 +35,7 @@ RUN rm go.sum RUN go mod tidy # Build the binary -RUN --mount=type=cache,target="/root/.cache/go-build" go build -v -o /go/bin/app +RUN go build -v -o /go/bin/app ################################ # Runtime Image - Normal diff --git a/internal/app/world-cli/common/docker/service/cardinal.go b/internal/app/world-cli/common/docker/service/cardinal.go index 772f4a8d..5d4d095e 100644 --- a/internal/app/world-cli/common/docker/service/cardinal.go +++ b/internal/app/world-cli/common/docker/service/cardinal.go @@ -7,6 +7,7 @@ import ( "github.com/docker/docker/api/types/container" "github.com/docker/go-connections/nat" "pkg.world.dev/world-cli/internal/app/world-cli/common/config" + "pkg.world.dev/world-cli/internal/pkg/logger" ) const ( @@ -34,7 +35,7 @@ func getCardinalContainerName(cfg *config.Config) string { return fmt.Sprintf("%s-cardinal", cfg.DockerEnv["CARDINAL_NAMESPACE"]) } -func Cardinal(cfg *config.Config) Service { +func Cardinal(cfg *config.Config) Service { //nolint:funlen // it does what it needs to do // Check cardinal namespace checkCardinalNamespace(cfg) @@ -47,11 +48,11 @@ func Cardinal(cfg *config.Config) Service { dockerfile := dockerfileContent if !BuildkitSupport { - // dockerfile = strings.ReplaceAll(dockerfile, mountCacheScript, "") - // dockerfile = strings.ReplaceAll(dockerfile, gitConfigWithSecret, gitConfigWithEnv) - // (not recommended) uncomment the lines above and comment out the panic if you want to support insecure builds - // without BuildKit. Insecure because this embeds the GitHub token value in the image layers - panic("BuildKit is required to build the Cardinal image. Please enable BuildKit in your Docker configuration.") + // When BuildKit is disabled, we use the standard Dockerfile without BuildKit-specific features + // This is less secure as it embeds the GitHub token in image layers, but allows for debugging + if logger.VerboseMode { + logger.Printf("BuildKit disabled - using standard Docker build for Cardinal\r\n") + } } // Set env variables diff --git a/internal/app/world-cli/common/telemetry/sentry.go b/internal/app/world-cli/common/telemetry/sentry.go index 53779cce..ea90029e 100644 --- a/internal/app/world-cli/common/telemetry/sentry.go +++ b/internal/app/world-cli/common/telemetry/sentry.go @@ -25,7 +25,9 @@ func SentryInit(sentryDsn string, env string, appVersion string) { Release: fmt.Sprintf("world-cli@%s", appVersion), }) if err != nil { - log.Err(err).Msg("Cannot initialize sentry") + log.Err(err).Msg("Cannot initialize sentry. \r\n" + + " Please check your SENTRY_DSN in your GitHub Actions secrets for World CLI repository. \r\n" + + " If you are running locally, you can ignore this message.\r\n") return } diff --git a/internal/app/world-cli/gen/logs/v1/logs.pb.go b/internal/app/world-cli/gen/logs/v1/logs.pb.go new file mode 100644 index 00000000..57a9bd2c --- /dev/null +++ b/internal/app/world-cli/gen/logs/v1/logs.pb.go @@ -0,0 +1,201 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.6 +// protoc (unknown) +// source: logs/v1/logs.proto + +package logsv1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type GetLogsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + OrganizationSlug string `protobuf:"bytes,1,opt,name=organization_slug,json=organizationSlug,proto3" json:"organization_slug,omitempty"` + ProjectSlug string `protobuf:"bytes,2,opt,name=project_slug,json=projectSlug,proto3" json:"project_slug,omitempty"` + Env string `protobuf:"bytes,3,opt,name=env,proto3" json:"env,omitempty"` + Region string `protobuf:"bytes,4,opt,name=region,proto3" json:"region,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetLogsRequest) Reset() { + *x = GetLogsRequest{} + mi := &file_logs_v1_logs_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetLogsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetLogsRequest) ProtoMessage() {} + +func (x *GetLogsRequest) ProtoReflect() protoreflect.Message { + mi := &file_logs_v1_logs_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetLogsRequest.ProtoReflect.Descriptor instead. +func (*GetLogsRequest) Descriptor() ([]byte, []int) { + return file_logs_v1_logs_proto_rawDescGZIP(), []int{0} +} + +func (x *GetLogsRequest) GetOrganizationSlug() string { + if x != nil { + return x.OrganizationSlug + } + return "" +} + +func (x *GetLogsRequest) GetProjectSlug() string { + if x != nil { + return x.ProjectSlug + } + return "" +} + +func (x *GetLogsRequest) GetEnv() string { + if x != nil { + return x.Env + } + return "" +} + +func (x *GetLogsRequest) GetRegion() string { + if x != nil { + return x.Region + } + return "" +} + +type GetLogsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Log string `protobuf:"bytes,1,opt,name=log,proto3" json:"log,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetLogsResponse) Reset() { + *x = GetLogsResponse{} + mi := &file_logs_v1_logs_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetLogsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetLogsResponse) ProtoMessage() {} + +func (x *GetLogsResponse) ProtoReflect() protoreflect.Message { + mi := &file_logs_v1_logs_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetLogsResponse.ProtoReflect.Descriptor instead. +func (*GetLogsResponse) Descriptor() ([]byte, []int) { + return file_logs_v1_logs_proto_rawDescGZIP(), []int{1} +} + +func (x *GetLogsResponse) GetLog() string { + if x != nil { + return x.Log + } + return "" +} + +var File_logs_v1_logs_proto protoreflect.FileDescriptor + +const file_logs_v1_logs_proto_rawDesc = "" + + "\n" + + "\x12logs/v1/logs.proto\x12\alogs.v1\"\x8a\x01\n" + + "\x0eGetLogsRequest\x12+\n" + + "\x11organization_slug\x18\x01 \x01(\tR\x10organizationSlug\x12!\n" + + "\fproject_slug\x18\x02 \x01(\tR\vprojectSlug\x12\x10\n" + + "\x03env\x18\x03 \x01(\tR\x03env\x12\x16\n" + + "\x06region\x18\x04 \x01(\tR\x06region\"#\n" + + "\x0fGetLogsResponse\x12\x10\n" + + "\x03log\x18\x01 \x01(\tR\x03log2M\n" + + "\vLogsService\x12>\n" + + "\aGetLogs\x12\x17.logs.v1.GetLogsRequest\x1a\x18.logs.v1.GetLogsResponse0\x01B\x98\x01\n" + + "\vcom.logs.v1B\tLogsProtoP\x01ZApkg.world.dev/world-cli/internal/app/world-cli/gen/logs/v1;logsv1\xa2\x02\x03LXX\xaa\x02\aLogs.V1\xca\x02\aLogs\\V1\xe2\x02\x13Logs\\V1\\GPBMetadata\xea\x02\bLogs::V1b\x06proto3" + +var ( + file_logs_v1_logs_proto_rawDescOnce sync.Once + file_logs_v1_logs_proto_rawDescData []byte +) + +func file_logs_v1_logs_proto_rawDescGZIP() []byte { + file_logs_v1_logs_proto_rawDescOnce.Do(func() { + file_logs_v1_logs_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_logs_v1_logs_proto_rawDesc), len(file_logs_v1_logs_proto_rawDesc))) + }) + return file_logs_v1_logs_proto_rawDescData +} + +var file_logs_v1_logs_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_logs_v1_logs_proto_goTypes = []any{ + (*GetLogsRequest)(nil), // 0: logs.v1.GetLogsRequest + (*GetLogsResponse)(nil), // 1: logs.v1.GetLogsResponse +} +var file_logs_v1_logs_proto_depIdxs = []int32{ + 0, // 0: logs.v1.LogsService.GetLogs:input_type -> logs.v1.GetLogsRequest + 1, // 1: logs.v1.LogsService.GetLogs:output_type -> logs.v1.GetLogsResponse + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_logs_v1_logs_proto_init() } +func file_logs_v1_logs_proto_init() { + if File_logs_v1_logs_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_logs_v1_logs_proto_rawDesc), len(file_logs_v1_logs_proto_rawDesc)), + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_logs_v1_logs_proto_goTypes, + DependencyIndexes: file_logs_v1_logs_proto_depIdxs, + MessageInfos: file_logs_v1_logs_proto_msgTypes, + }.Build() + File_logs_v1_logs_proto = out.File + file_logs_v1_logs_proto_goTypes = nil + file_logs_v1_logs_proto_depIdxs = nil +}