Documentation ¶
Index ¶
- Constants
- Variables
- func Ensure(ctx context.Context, c *http.Client, rootDir string, forceCopyInstallMode bool, ...) error
- func GetStrCIPDPkgs(pkgs []*Package) []string
- func InstanceIDToSha256(instanceID string) (string, error)
- func Sha256ToInstanceID(sha256 string) (string, error)
- func VersionTag(version string) string
- type CIPDClient
- type Client
- func (c *Client) Attach(ctx context.Context, pin common.Pin, refs []string, tags []string, ...) error
- func (c *Client) Create(ctx context.Context, name, dir string, installMode pkg.InstallMode, ...) (rv common.Pin, rvErr error)
- func (c *Client) Describe(ctx context.Context, pkg, instance string, includeMetadata bool) (*cipd.InstanceDescription, error)
- func (c *Client) Ensure(ctx context.Context, forceCopyInstallMode bool, packages ...*Package) error
- type Package
- type PackageSlice
Constants ¶
const ( // CIPD server to use for obtaining packages. DefaultServiceURL = "https://chrome-infra-packages.appspot.com" // Platforms supported by CIPD. PlatformLinuxAmd64 = "linux-amd64" PlatformLinuxArm64 = "linux-arm64" PlatformLinuxArmv6l = "linux-armv6l" PlatformMacAmd64 = "mac-amd64" PlatformWindows386 = "windows-386" PlatformWindowsAmd64 = "windows-amd64" // Placeholder for target platform. PlatformPlaceholder = "${platform}" // This is the CIPD package containing CIPD itself. PkgNameCIPD = "infra/tools/cipd/${os}-${arch}" )
Variables ¶
var ( // Platforms are the known CIPD platforms. Platforms = []string{ PlatformLinuxAmd64, PlatformLinuxArm64, PlatformLinuxArmv6l, PlatformMacAmd64, PlatformWindows386, PlatformWindowsAmd64, } // CIPD package for CIPD itself. PkgCIPD = MustGetPackage(PkgNameCIPD) // CIPD package for the Go installation. PkgGo = MustGetPackage("skia/bots/go") // CIPD package containing the Google Protocol Buffer compiler. PkgProtoc = MustGetPackage("skia/bots/protoc") // CIPD packages required for using Git. PkgsGit = map[string][]*Package{ PlatformLinuxAmd64: { MustGetPackage(fmt.Sprintf(pkgGitTmpl, PlatformLinuxAmd64)), MustGetPackage("infra/tools/git/${platform}"), MustGetPackage("infra/tools/luci/git-credential-luci/${platform}"), }, PlatformLinuxArm64: { MustGetPackage(fmt.Sprintf(pkgGitTmpl, PlatformLinuxArm64)), MustGetPackage("infra/tools/git/${platform}"), MustGetPackage("infra/tools/luci/git-credential-luci/${platform}"), }, PlatformLinuxArmv6l: { MustGetPackage(fmt.Sprintf(pkgGitTmpl, PlatformLinuxArmv6l)), MustGetPackage("infra/tools/git/${platform}"), MustGetPackage("infra/tools/luci/git-credential-luci/${platform}"), }, PlatformMacAmd64: { MustGetPackage(fmt.Sprintf(pkgGitTmpl, PlatformMacAmd64)), MustGetPackage("infra/tools/git/${platform}"), MustGetPackage("infra/tools/luci/git-credential-luci/${platform}"), }, PlatformWindows386: { MustGetPackage(fmt.Sprintf(pkgGitTmpl, PlatformWindows386)), MustGetPackage("infra/tools/git/${platform}"), MustGetPackage("infra/tools/luci/git-credential-luci/${platform}"), }, PlatformWindowsAmd64: { MustGetPackage(fmt.Sprintf(pkgGitTmpl, PlatformWindowsAmd64)), MustGetPackage("infra/tools/git/${platform}"), MustGetPackage("infra/tools/luci/git-credential-luci/${platform}"), }, } // CIPD packages required for using Python. PkgsPython = map[string][]*Package{ PlatformLinuxAmd64: { MustGetPackage(fmt.Sprintf(pkgCpython3Tmpl, PlatformLinuxAmd64)), MustGetPackage("infra/tools/luci/vpython3/${platform}"), }, PlatformLinuxArm64: { MustGetPackage(fmt.Sprintf(pkgCpython3Tmpl, PlatformLinuxArm64)), MustGetPackage("infra/tools/luci/vpython3/${platform}"), }, PlatformLinuxArmv6l: { MustGetPackage(fmt.Sprintf(pkgCpython3Tmpl, PlatformLinuxArmv6l)), MustGetPackage("infra/tools/luci/vpython3/${platform}"), }, PlatformMacAmd64: { MustGetPackage(fmt.Sprintf(pkgCpython3Tmpl, PlatformMacAmd64)), MustGetPackage("infra/tools/luci/vpython3/${platform}"), }, PlatformWindows386: { MustGetPackage(fmt.Sprintf(pkgCpython3Tmpl, PlatformWindows386)), MustGetPackage("infra/tools/luci/vpython3/${platform}"), }, PlatformWindowsAmd64: { MustGetPackage(fmt.Sprintf(pkgCpython3Tmpl, PlatformWindowsAmd64)), MustGetPackage("infra/tools/luci/vpython3/${platform}"), }, } )
var PACKAGES = map[string]*Package{
"infra/3pp/tools/cpython/linux-amd64": {
Path: "cipd_bin_packages/cpython",
Name: "infra/3pp/tools/cpython/linux-amd64",
Version: "version:2@2.7.18.chromium.47",
},
"infra/3pp/tools/cpython/linux-arm64": {
Path: "cipd_bin_packages/cpython",
Name: "infra/3pp/tools/cpython/linux-arm64",
Version: "version:2@2.7.18.chromium.47",
},
"infra/3pp/tools/cpython/linux-armv6l": {
Path: "cipd_bin_packages/cpython",
Name: "infra/3pp/tools/cpython/linux-armv6l",
Version: "version:2@2.7.18.chromium.47",
},
"infra/3pp/tools/cpython/mac-amd64": {
Path: "cipd_bin_packages/cpython",
Name: "infra/3pp/tools/cpython/mac-amd64",
Version: "version:2@2.7.18.chromium.47",
},
"infra/3pp/tools/cpython/windows-386": {
Path: "cipd_bin_packages/cpython",
Name: "infra/3pp/tools/cpython/windows-386",
Version: "version:2@2.7.18.chromium.47",
},
"infra/3pp/tools/cpython/windows-amd64": {
Path: "cipd_bin_packages/cpython",
Name: "infra/3pp/tools/cpython/windows-amd64",
Version: "version:2@2.7.18.chromium.47",
},
"infra/3pp/tools/cpython3/linux-amd64": {
Path: "cipd_bin_packages/cpython3",
Name: "infra/3pp/tools/cpython3/linux-amd64",
Version: "version:3@3.11.9.chromium.35",
},
"infra/3pp/tools/cpython3/linux-arm64": {
Path: "cipd_bin_packages/cpython3",
Name: "infra/3pp/tools/cpython3/linux-arm64",
Version: "version:3@3.11.9.chromium.35",
},
"infra/3pp/tools/cpython3/linux-armv6l": {
Path: "cipd_bin_packages/cpython3",
Name: "infra/3pp/tools/cpython3/linux-armv6l",
Version: "version:3@3.11.9.chromium.35",
},
"infra/3pp/tools/cpython3/mac-amd64": {
Path: "cipd_bin_packages/cpython3",
Name: "infra/3pp/tools/cpython3/mac-amd64",
Version: "version:3@3.11.9.chromium.35",
},
"infra/3pp/tools/cpython3/windows-386": {
Path: "cipd_bin_packages/cpython3",
Name: "infra/3pp/tools/cpython3/windows-386",
Version: "version:3@3.11.9.chromium.35",
},
"infra/3pp/tools/cpython3/windows-amd64": {
Path: "cipd_bin_packages/cpython3",
Name: "infra/3pp/tools/cpython3/windows-amd64",
Version: "version:3@3.11.9.chromium.35",
},
"infra/3pp/tools/git/linux-amd64": {
Path: "cipd_bin_packages",
Name: "infra/3pp/tools/git/linux-amd64",
Version: "version:3@2.47.0.chromium.11",
},
"infra/3pp/tools/git/linux-arm64": {
Path: "cipd_bin_packages",
Name: "infra/3pp/tools/git/linux-arm64",
Version: "version:3@2.47.0.chromium.11",
},
"infra/3pp/tools/git/linux-armv6l": {
Path: "cipd_bin_packages",
Name: "infra/3pp/tools/git/linux-armv6l",
Version: "version:3@2.47.0.chromium.11",
},
"infra/3pp/tools/git/mac-amd64": {
Path: "cipd_bin_packages",
Name: "infra/3pp/tools/git/mac-amd64",
Version: "version:3@2.47.0.chromium.11",
},
"infra/3pp/tools/git/windows-386": {
Path: "cipd_bin_packages",
Name: "infra/3pp/tools/git/windows-386",
Version: "version:3@2.47.0.chromium.11",
},
"infra/3pp/tools/git/windows-amd64": {
Path: "cipd_bin_packages",
Name: "infra/3pp/tools/git/windows-amd64",
Version: "version:3@2.47.0.chromium.11",
},
"infra/tools/cipd/${os}-${arch}": {
Path: ".",
Name: "infra/tools/cipd/${os}-${arch}",
Version: "git_revision:e5385b26ccc69d5e96eb051a7c7bbefe6e29f366",
},
"infra/tools/git/${platform}": {
Path: "cipd_bin_packages",
Name: "infra/tools/git/${platform}",
Version: "git_revision:e5385b26ccc69d5e96eb051a7c7bbefe6e29f366",
},
"infra/tools/luci-auth/${platform}": {
Path: "cipd_bin_packages",
Name: "infra/tools/luci-auth/${platform}",
Version: "git_revision:e5385b26ccc69d5e96eb051a7c7bbefe6e29f366",
},
"infra/tools/luci/git-credential-luci/${platform}": {
Path: "cipd_bin_packages",
Name: "infra/tools/luci/git-credential-luci/${platform}",
Version: "git_revision:e5385b26ccc69d5e96eb051a7c7bbefe6e29f366",
},
"infra/tools/luci/isolate/${platform}": {
Path: "cipd_bin_packages",
Name: "infra/tools/luci/isolate/${platform}",
Version: "git_revision:e5385b26ccc69d5e96eb051a7c7bbefe6e29f366",
},
"infra/tools/luci/kitchen/${platform}": {
Path: ".",
Name: "infra/tools/luci/kitchen/${platform}",
Version: "git_revision:e5385b26ccc69d5e96eb051a7c7bbefe6e29f366",
},
"infra/tools/luci/lucicfg/${platform}": {
Path: "cipd_bin_packages",
Name: "infra/tools/luci/lucicfg/${platform}",
Version: "git_revision:e5385b26ccc69d5e96eb051a7c7bbefe6e29f366",
},
"infra/tools/luci/swarming/${platform}": {
Path: "cipd_bin_packages",
Name: "infra/tools/luci/swarming/${platform}",
Version: "git_revision:e5385b26ccc69d5e96eb051a7c7bbefe6e29f366",
},
"infra/tools/luci/vpython3/${platform}": {
Path: "cipd_bin_packages",
Name: "infra/tools/luci/vpython3/${platform}",
Version: "git_revision:e5385b26ccc69d5e96eb051a7c7bbefe6e29f366",
},
"skia/bots/bazel": {
Path: "bazel",
Name: "skia/bots/bazel",
Version: "version:3",
},
"skia/bots/bazelisk": {
Path: "bazelisk",
Name: "skia/bots/bazelisk",
Version: "version:0",
},
"skia/bots/cockroachdb": {
Path: "cockroachdb",
Name: "skia/bots/cockroachdb",
Version: "version:4",
},
"skia/bots/gcloud_linux": {
Path: "gcloud_linux",
Name: "skia/bots/gcloud_linux",
Version: "version:15",
},
"skia/bots/go": {
Path: "go",
Name: "skia/bots/go",
Version: "version:17",
},
"skia/bots/go_win": {
Path: "go_win",
Name: "skia/bots/go_win",
Version: "version:4",
},
"skia/bots/gsutil": {
Path: "cipd_bin_packages",
Name: "skia/bots/gsutil",
Version: "version:6",
},
"skia/bots/node": {
Path: "node",
Name: "skia/bots/node",
Version: "version:2",
},
"skia/bots/patch_linux_amd64": {
Path: "cipd_bin_packages",
Name: "skia/bots/patch_linux_amd64",
Version: "version:0",
},
"skia/bots/protoc": {
Path: "protoc",
Name: "skia/bots/protoc",
Version: "version:0",
},
"skia/tools/bazel_build_all/${platform}": {
Path: "task_drivers",
Name: "skia/tools/bazel_build_all/${platform}",
Version: "git_revision:4448a7219f6d0d8380102f62e3505fc89ad0382c",
},
"skia/tools/bazel_test_all/${platform}": {
Path: "task_drivers",
Name: "skia/tools/bazel_test_all/${platform}",
Version: "git_revision:4448a7219f6d0d8380102f62e3505fc89ad0382c",
},
"skia/tools/command_wrapper/${platform}": {
Path: "task_drivers",
Name: "skia/tools/command_wrapper/${platform}",
Version: "git_revision:4448a7219f6d0d8380102f62e3505fc89ad0382c",
},
"skia/tools/goldctl/${platform}": {
Path: "cipd_bin_packages",
Name: "skia/tools/goldctl/${platform}",
Version: "git_revision:e5385b26ccc69d5e96eb051a7c7bbefe6e29f366",
},
"skia/tools/presubmit/${platform}": {
Path: "task_drivers",
Name: "skia/tools/presubmit/${platform}",
Version: "git_revision:4448a7219f6d0d8380102f62e3505fc89ad0382c",
},
}
Functions ¶
func Ensure ¶
func Ensure(ctx context.Context, c *http.Client, rootDir string, forceCopyInstallMode bool, packages ...*Package) error
Run "cipd ensure" to get the correct packages in the given location. Note that any previously-installed packages in the given rootDir will be removed if not specified again.
func GetStrCIPDPkgs ¶
Utility function that returns CIPD packages as slice of strings. Created for go/swarming, this can be removed when go/swarming has no more clients.
func InstanceIDToSha256 ¶
InstanceIDToSha256 returns a sha256 based on a package instance ID.
func Sha256ToInstanceID ¶
Sha256ToInstanceID returns a package instance ID based on a sha256 sum.
func VersionTag ¶
VersionTag returns a CIPD version tag for the given version number.
Types ¶
type CIPDClient ¶
type CIPDClient interface { cipd.Client // Attach the given refs, tags, and metadata to the given package instance. Attach(ctx context.Context, pin common.Pin, refs []string, tags []string, metadata map[string]string) error // Create uploads a new package instance. Create(ctx context.Context, name, dir string, installMode pkg.InstallMode, excludeMatchingFiles []*regexp.Regexp, refs []string, tags []string, metadata map[string]string) (common.Pin, error) // Ensure runs "cipd ensure" to get the correct packages in the given location. Note // that any previously-installed packages in the given rootDir will be removed // if not specified again. Ensure(ctx context.Context, forceCopyInstallMode bool, packages ...*Package) error // Describe is a convenience wrapper around cipd.Client.DescribeInstance. Describe(ctx context.Context, pkg, instance string, includeMetadata bool) (*cipd.InstanceDescription, error) }
CIPDClient is the interface for interactions with the CIPD API.
type Client ¶
Client is a struct used for interacting with the CIPD API.
type Package ¶
type Package struct { // Name of the package. Name string `json:"name"` // Relative path within the root dir to install the package. Path string `json:"path"` // Version of the package. See the CIPD docs for valid version strings: // https://godoc.org/go.chromium.org/luci/cipd/common#ValidateInstanceVersion Version string `json:"version"` }
Package describes a CIPD package.
func GetPackage ¶
GetPackage returns the definition for the package with the given name, or an error if the package does not exist in the registry.
func MustGetPackage ¶
MustGetPackage returns the definition for the package with the given name. Panics if the package does not exist in the registry.
func ParseEnsureFile ¶
ParseEnsureFile parses a CIPD ensure file and returns a slice of Packages.
type PackageSlice ¶
type PackageSlice []*Package
PackageSlice is used for sorting packages by name.
func (PackageSlice) Len ¶
func (s PackageSlice) Len() int
func (PackageSlice) Less ¶
func (s PackageSlice) Less(i, j int) bool
func (PackageSlice) Swap ¶
func (s PackageSlice) Swap(i, j int)