MCPcopy Create free account
hub / github.com/buildpacks/pack / validateModule

Function validateModule

pkg/client/create_builder.go:433–456  ·  view source on GitHub ↗
(kind string, module buildpack.BuildModule, source, expectedID, expectedVersion string)

Source from the content-addressed store, hash-verified

431}
432
433func validateModule(kind string, module buildpack.BuildModule, source, expectedID, expectedVersion string) error {
434 info := module.Descriptor().Info()
435 if expectedID != "" && info.ID != expectedID {
436 return fmt.Errorf(
437 "%s from URI %s has ID %s which does not match ID %s from builder config",
438 kind,
439 style.Symbol(source),
440 style.Symbol(info.ID),
441 style.Symbol(expectedID),
442 )
443 }
444
445 if expectedVersion != "" && info.Version != expectedVersion {
446 return fmt.Errorf(
447 "%s from URI %s has version %s which does not match version %s from builder config",
448 kind,
449 style.Symbol(source),
450 style.Symbol(info.Version),
451 style.Symbol(expectedVersion),
452 )
453 }
454
455 return nil
456}
457
458func (c *Client) uriFromLifecycleVersion(version semver.Version, os string, architecture string) string {
459 arch := "x86-64"

Callers 1

addConfigMethod · 0.85

Calls 3

InfoMethod · 0.65
DescriptorMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected