Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions components/dashboard/src/workspaces/CreateWorkspacePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,11 @@ export function CreateWorkspacePage() {
<span className="text-sm">{warningIde}</span>
</Alert>
)}
{workspaceContext.data?.data.metadata?.warnings.map((warning) => (
<Alert type="warning" key={warning}>
<span className="text-sm">{warning}</span>
</Alert>
)) ?? []}

<InputField>
<RepositoryFinder
Expand Down
2 changes: 2 additions & 0 deletions components/gitpod-protocol/src/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,8 @@ export interface WorkspaceContext {
normalizedContextURL?: string;
forceCreateNewWorkspace?: boolean;
forceImageBuild?: boolean;
// The context can have non-blocking warnings that should be displayed to the user.
warnings?: string[];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧡

}

export namespace WorkspaceContext {
Expand Down
15 changes: 15 additions & 0 deletions components/image-builder-bob/cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
package cmd

import (
"errors"
"os"
"strings"
"time"

"github.com/spf13/cobra"
Expand All @@ -32,6 +34,14 @@ var buildCmd = &cobra.Command{

cfg, err := builder.GetConfigFromEnv()
if err != nil {
if errors.Is(err, builder.DockerfilePathNotExists) {
dockerfilePath := strings.TrimPrefix(os.Getenv("BOB_DOCKERFILE_PATH"), "/workspace/")
err = os.WriteFile("/workspace/.gitpod/bob.log", []byte("could not find Dockerfile at \""+dockerfilePath+"\". Please double-check the value specified in image.file in .gitpod.yml"), 0644)
if err != nil {
log.WithError(err).Error("cannot write init message to /workspace/.gitpod/bob.log")
}
}

log.WithError(err).Fatal("cannot get config")
return
}
Expand All @@ -43,6 +53,11 @@ var buildCmd = &cobra.Command{
if err != nil {
log.WithError(err).Error("build failed")

err := os.WriteFile("/workspace/.gitpod/bob.log", []byte(err.Error()), 0644)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧡

if err != nil {
log.WithError(err).Error("cannot write error to /workspace/.gitpod/bob.log")
}

// make sure we're running long enough to have our logs read
if dt := time.Since(t0); dt < 5*time.Second {
time.Sleep(10 * time.Second)
Expand Down
4 changes: 3 additions & 1 deletion components/image-builder-bob/pkg/builder/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ type Config struct {
localCacheImport string
}

var DockerfilePathNotExists = xerrors.Errorf("BOB_DOCKERFILE_PATH does not exist or isn't a file")

// GetConfigFromEnv extracts configuration from environment variables
func GetConfigFromEnv() (*Config, error) {
cfg := &Config{
Expand Down Expand Up @@ -63,7 +65,7 @@ func GetConfigFromEnv() (*Config, error) {
return nil, xerrors.Errorf("BOB_DOCKERFILE_PATH must begin with /workspace")
}
if stat, err := os.Stat(cfg.Dockerfile); err != nil || stat.IsDir() {
return nil, xerrors.Errorf("BOB_DOCKERFILE_PATH does not exist or isn't a file")
return nil, DockerfilePathNotExists
}
}

Expand Down
3 changes: 3 additions & 0 deletions components/public-api/gitpod/v1/workspace.proto
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,9 @@ message WorkspaceMetadata {
// original_context_url is the normalized URL from which the workspace was
// created
string original_context_url = 7;

// warnings are user-facing warnings that should be displayed to the user when trying to start the workspace
repeated string warnings = 8;
}

// WorkspaceSpec specifies the configuration of a workspace for a workspace
Expand Down
1,185 changes: 598 additions & 587 deletions components/public-api/go/v1/workspace.pb.go

Large diffs are not rendered by default.

Loading
Loading