github.com/nilium/gitlab-runner@v12.5.0+incompatible/helpers/docker/helperimage/linux_info.go (about)

     1  package helperimage
     2  
     3  import (
     4  	"fmt"
     5  	"runtime"
     6  )
     7  
     8  var bashCmd = []string{"gitlab-runner-build"}
     9  
    10  type linuxInfo struct{}
    11  
    12  func (l *linuxInfo) Create(revision string, cfg Config) (Info, error) {
    13  	arch := l.architecture(cfg.Architecture)
    14  
    15  	return Info{
    16  		Architecture: arch,
    17  		Name:         name,
    18  		Tag:          fmt.Sprintf("%s-%s", arch, revision),
    19  		IsSupportingLocalImport: true,
    20  		Cmd: bashCmd,
    21  	}, nil
    22  
    23  }
    24  
    25  func (l *linuxInfo) architecture(arch string) string {
    26  	switch arch {
    27  	case "armv6l", "armv7l", "aarch64":
    28  		return "arm"
    29  	case "amd64":
    30  		return "x86_64"
    31  	}
    32  
    33  	if arch != "" {
    34  		return arch
    35  	}
    36  
    37  	switch runtime.GOARCH {
    38  	case "amd64":
    39  		return "x86_64"
    40  	default:
    41  		return runtime.GOARCH
    42  	}
    43  }