gitlab.com/sparetimecoders/build-tools@v0.1.0/pkg/ci/gitlab.go (about)

     1  package ci
     2  
     3  type Gitlab struct {
     4  	*Common
     5  	CICommit     string `env:"CI_COMMIT_SHA"`
     6  	CIBuildName  string `env:"CI_PROJECT_NAME"`
     7  	CIBranchName string `env:"CI_COMMIT_REF_NAME"`
     8  }
     9  
    10  var _ CI = &Gitlab{}
    11  
    12  func (c *Gitlab) Name() string {
    13  	return "Gitlab"
    14  }
    15  
    16  func (c *Gitlab) BranchReplaceSlash() string {
    17  	return branchReplaceSlash(c.Branch())
    18  }
    19  
    20  func (c *Gitlab) BuildName() string {
    21  	return c.Common.BuildName(c.CIBuildName)
    22  }
    23  
    24  func (c *Gitlab) Branch() string {
    25  	return c.Common.Branch(c.CIBranchName)
    26  }
    27  
    28  func (c *Gitlab) Commit() string {
    29  	return c.Common.Commit(c.CICommit)
    30  }
    31  
    32  func (c *Gitlab) Configured() bool {
    33  	return c.CIBuildName != ""
    34  }