github.com/jenkins-x/jx/v2@v2.1.155/pkg/jenkinsfile/modules.go (about)

     1  package jenkinsfile
     2  
     3  import "github.com/jenkins-x/jx/v2/pkg/util"
     4  
     5  const (
     6  	// ModuleFileName the name of the module imports file name
     7  	ModuleFileName = "imports.yaml"
     8  )
     9  
    10  // ImportFile represents an import of a file from a module (usually a version of a git repo)
    11  type ImportFile struct {
    12  	Import string
    13  	File   string
    14  }
    15  
    16  // ImportFileResolver resolves a build pack file resolver strategy
    17  type ImportFileResolver func(importFile *ImportFile) (string, error)
    18  
    19  // Modules defines the dependent modules for a build pack
    20  type Modules struct {
    21  	Modules []*Module `json:"modules,omitempty"`
    22  }
    23  
    24  // Module defines a dependent module for a build pack
    25  type Module struct {
    26  	Name   string `json:"name,omitempty"`
    27  	GitURL string `json:"gitUrl,omitempty"`
    28  	GitRef string `json:"gitRef,omitempty"`
    29  }
    30  
    31  // Validate returns an error if any data is missing
    32  func (m *Module) Validate() error {
    33  	if m.GitURL == "" {
    34  		return util.MissingOption("GitURL")
    35  	}
    36  	return nil
    37  }