cipd

package
v0.0.0-...-963fb65 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2024 License: BSD-3-Clause Imports: 18 Imported by: 1

Documentation

Index

Constants

View Source
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

View Source
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}"),
		},
	}
)
View Source
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.1.chromium.11",
	},
	"infra/3pp/tools/git/linux-arm64": {
		Path:    "cipd_bin_packages",
		Name:    "infra/3pp/tools/git/linux-arm64",
		Version: "version:3@2.47.1.chromium.11",
	},
	"infra/3pp/tools/git/linux-armv6l": {
		Path:    "cipd_bin_packages",
		Name:    "infra/3pp/tools/git/linux-armv6l",
		Version: "version:3@2.47.1.chromium.11",
	},
	"infra/3pp/tools/git/mac-amd64": {
		Path:    "cipd_bin_packages",
		Name:    "infra/3pp/tools/git/mac-amd64",
		Version: "version:3@2.47.1.chromium.11",
	},
	"infra/3pp/tools/git/windows-386": {
		Path:    "cipd_bin_packages",
		Name:    "infra/3pp/tools/git/windows-386",
		Version: "version:3@2.47.1.chromium.11",
	},
	"infra/3pp/tools/git/windows-amd64": {
		Path:    "cipd_bin_packages",
		Name:    "infra/3pp/tools/git/windows-amd64",
		Version: "version:3@2.47.1.chromium.11",
	},
	"infra/tools/cipd/${os}-${arch}": {
		Path:    ".",
		Name:    "infra/tools/cipd/${os}-${arch}",
		Version: "git_revision:dc0b8fd6a9218ce32fbe767150707c0eb082a1f4",
	},
	"infra/tools/git/${platform}": {
		Path:    "cipd_bin_packages",
		Name:    "infra/tools/git/${platform}",
		Version: "git_revision:dc0b8fd6a9218ce32fbe767150707c0eb082a1f4",
	},
	"infra/tools/luci-auth/${platform}": {
		Path:    "cipd_bin_packages",
		Name:    "infra/tools/luci-auth/${platform}",
		Version: "git_revision:dc0b8fd6a9218ce32fbe767150707c0eb082a1f4",
	},
	"infra/tools/luci/git-credential-luci/${platform}": {
		Path:    "cipd_bin_packages",
		Name:    "infra/tools/luci/git-credential-luci/${platform}",
		Version: "git_revision:dc0b8fd6a9218ce32fbe767150707c0eb082a1f4",
	},
	"infra/tools/luci/isolate/${platform}": {
		Path:    "cipd_bin_packages",
		Name:    "infra/tools/luci/isolate/${platform}",
		Version: "git_revision:dc0b8fd6a9218ce32fbe767150707c0eb082a1f4",
	},
	"infra/tools/luci/kitchen/${platform}": {
		Path:    ".",
		Name:    "infra/tools/luci/kitchen/${platform}",
		Version: "git_revision:dc0b8fd6a9218ce32fbe767150707c0eb082a1f4",
	},
	"infra/tools/luci/lucicfg/${platform}": {
		Path:    "cipd_bin_packages",
		Name:    "infra/tools/luci/lucicfg/${platform}",
		Version: "git_revision:dc0b8fd6a9218ce32fbe767150707c0eb082a1f4",
	},
	"infra/tools/luci/swarming/${platform}": {
		Path:    "cipd_bin_packages",
		Name:    "infra/tools/luci/swarming/${platform}",
		Version: "git_revision:dc0b8fd6a9218ce32fbe767150707c0eb082a1f4",
	},
	"infra/tools/luci/vpython3/${platform}": {
		Path:    "cipd_bin_packages",
		Name:    "infra/tools/luci/vpython3/${platform}",
		Version: "git_revision:dc0b8fd6a9218ce32fbe767150707c0eb082a1f4",
	},
	"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:846022101a6f41af41780bbf335fee3d8f6eba43",
	},
	"skia/tools/bazel_test_all/${platform}": {
		Path:    "task_drivers",
		Name:    "skia/tools/bazel_test_all/${platform}",
		Version: "git_revision:846022101a6f41af41780bbf335fee3d8f6eba43",
	},
	"skia/tools/command_wrapper/${platform}": {
		Path:    "task_drivers",
		Name:    "skia/tools/command_wrapper/${platform}",
		Version: "git_revision:846022101a6f41af41780bbf335fee3d8f6eba43",
	},
	"skia/tools/goldctl/${platform}": {
		Path:    "cipd_bin_packages",
		Name:    "skia/tools/goldctl/${platform}",
		Version: "git_revision:dc0b8fd6a9218ce32fbe767150707c0eb082a1f4",
	},
	"skia/tools/presubmit/${platform}": {
		Path:    "task_drivers",
		Name:    "skia/tools/presubmit/${platform}",
		Version: "git_revision:846022101a6f41af41780bbf335fee3d8f6eba43",
	},
}

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

func GetStrCIPDPkgs(pkgs []*Package) []string

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

func InstanceIDToSha256(instanceID string) (string, error)

InstanceIDToSha256 returns a sha256 based on a package instance ID.

func Sha256ToInstanceID

func Sha256ToInstanceID(sha256 string) (string, error)

Sha256ToInstanceID returns a package instance ID based on a sha256 sum.

func VersionTag

func VersionTag(version string) string

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

type Client struct {
	cipd.Client
	// contains filtered or unexported fields
}

Client is a struct used for interacting with the CIPD API.

func NewClient

func NewClient(c *http.Client, rootDir, serviceURL string) (*Client, error)

NewClient returns a CIPD client.

func (*Client) Attach

func (c *Client) Attach(ctx context.Context, pin common.Pin, refs []string, tags []string, metadata map[string]string) error

func (*Client) Create

func (c *Client) Create(ctx context.Context, name, dir string, installMode pkg.InstallMode, excludeMatchingFiles []*regexp.Regexp, refs []string, tags []string, metadata map[string]string) (rv common.Pin, rvErr error)

func (*Client) Describe

func (c *Client) Describe(ctx context.Context, pkg, instance string, includeMetadata bool) (*cipd.InstanceDescription, error)

func (*Client) Ensure

func (c *Client) Ensure(ctx context.Context, forceCopyInstallMode bool, packages ...*Package) error

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

func GetPackage(pkg string) (*Package, error)

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

func MustGetPackage(pkg string) *Package

MustGetPackage returns the definition for the package with the given name. Panics if the package does not exist in the registry.

func ParseEnsureFile

func ParseEnsureFile(file string) ([]*Package, error)

ParseEnsureFile parses a CIPD ensure file and returns a slice of Packages.

func (*Package) String

func (p *Package) String() string

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)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL