MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/buildpacks / AdaptEntrypoint

Function AdaptEntrypoint

pkg/python/python.go:606–615  ·  view source on GitHub ↗

AdaptEntrypoint rewrites the entrypoint command if the capability is present.

(ctx *gcp.Context, cmd []string, scriptCmd []string)

Source from the content-addressed store, hash-verified

604
605// EntrypointAdapterCapability is the capability key for the EntrypointAdapter.
606const EntrypointAdapterCapability = "python.EntrypointAdapter"
607
608// entrypointAdapter is an interface for rewriting the entrypoint command.
609type entrypointAdapter interface {
610 adapt(cmd []string, scriptCmd []string) ([]string, error)
611}
612
613// AdaptEntrypoint rewrites the entrypoint command if the capability is present.
614func AdaptEntrypoint(ctx *gcp.Context, cmd []string, scriptCmd []string) ([]string, error) {
615 if cap := ctx.Capability(EntrypointAdapterCapability); cap != nil {
616 a, ok := cap.(entrypointAdapter)
617 if !ok {
618 return nil, gcp.InternalErrorf("capability %q does not implement entrypointAdapter interface", EntrypointAdapterCapability)

Callers 3

BuildFnFunction · 0.92
TestAdaptEntrypointFunction · 0.85

Calls 2

CapabilityMethod · 0.80
adaptMethod · 0.65

Tested by 2

TestAdaptEntrypointFunction · 0.68