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
2 changes: 1 addition & 1 deletion cmd/build/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func buildMcpImage(ctx context.Context, server servers.Server) error {
token := os.Getenv("GITHUB_TOKEN")

buildArgs := []string{
"-f", server.GetDockerfile(), "-t", "check", "-t", server.Image, "--label", "org.opencontainers.image.revision=" + sha,
"-f", server.GetDockerfile(), "-t", "check", "-t", server.Image, "--label", "org.opencontainers.image.revision=" + sha, "--load",
}

if server.Source.BuildTarget != "" {
Expand Down
6 changes: 3 additions & 3 deletions cmd/create/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ func run(ctx context.Context, buildURL, name, category, userProvidedImage string
token := os.Getenv("GITHUB_TOKEN")

if token != "" {
cmd = exec.CommandContext(ctx, "docker", "buildx", "build", "--secret", "id=GIT_AUTH_TOKEN", "-t", "check", "-t", tag, "--label", "org.opencontainers.image.revision="+sha, gitURL)
cmd = exec.CommandContext(ctx, "docker", "buildx", "build", "--secret", "id=GIT_AUTH_TOKEN", "-t", "check", "-t", tag, "--label", "org.opencontainers.image.revision="+sha, "--load", gitURL)
cmd.Env = []string{"GIT_AUTH_TOKEN=" + token, "PATH=" + os.Getenv("PATH")}
} else {
cmd = exec.CommandContext(ctx, "docker", "buildx", "build", "-t", "check", "-t", tag, "--label", "org.opencontainers.image.revision="+sha, gitURL)
cmd = exec.CommandContext(ctx, "docker", "buildx", "build", "-t", "check", "-t", tag, "--label", "org.opencontainers.image.revision="+sha, "--load", gitURL)
cmd.Env = []string{"PATH=" + os.Getenv("PATH")}
}

Expand Down Expand Up @@ -177,7 +177,7 @@ func run(ctx context.Context, buildURL, name, category, userProvidedImage string
secrets = append(secrets, servers.Secret{
Name: secretName(name, parts[0]),
Env: parts[0],
Example: "<" + parts[0] + ">",
Example: parts[1],
})
} else {
env = append(env, servers.Env{
Expand Down
17 changes: 17 additions & 0 deletions pkg/servers/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ THE SOFTWARE.
package servers

import (
"encoding/json"

"gopkg.in/yaml.v3"
)

Expand All @@ -48,6 +50,21 @@ type Secret struct {
Required *bool `yaml:"required,omitempty" json:"required,omitempty"`
}

// secret is an alias used to drop encoding methods to avoid infinite recursion.
type secret Secret

func (s Secret) MarshalYAML() (any, error) {
a := secret(s)
a.Example = "<" + s.Env + ">"
return a, nil
}

func (s Secret) MarshalJSON() ([]byte, error) {
a := secret(s)
a.Example = "<" + s.Env + ">"
return json.Marshal(a)
}

type Env struct {
Name string `yaml:"name" json:"name"`
Example any `yaml:"example,omitempty" json:"example,omitempty"`
Expand Down