Documentation
¶
Overview ¶
Package internal contains the internals of the uprev service.
Index ¶
- Constants
- Variables
- func GcloudAuth(ctx context.Context, registry, dockerKeyFile string) (err error)
- func RevertShas(ctx context.Context, containerNames []string, ...) (err error)
- func UpdateShaStorage(ctx context.Context, firestoreDatabaseName string, ...) (err error)
- func UprevContainer(ctx context.Context, imageCache map[string]any, config *UprevConfig, ...) (containerInfoItem *common.ContainerInfoItem, err error)
- func WriteDockerfile(dir string, name string) error
- func WriteResource(dir string, name string) error
- type CIPDPackage
- type ContainerInfosMap
- type Repository
- type UprevConfig
Constants ¶
const ( Oauth2Username = "oauth2accesstoken" Oauth2Password = "$(gcloud auth print-access-token)" // "host/project/containerName:tag" ContainerFormat = "%s/%s/%s:%s" )
Variables ¶
var ( //go:embed dockerfiles/* Dockerfiles embed.FS //go:embed resources/* Resources embed.FS DefaultRepository = &Repository{ Hostname: common.DefaultDockerHost, Project: common.DefaultDockerProject, FirestoreHost: common.TestPlatformFireStore, } PartnerRepository = &Repository{ Hostname: common.DefaultDockerHost, Project: common.PartnerDockerProject, FirestoreHost: common.PartnerTestPlatformFireStore, } )
Functions ¶
func GcloudAuth ¶
GcloudAuth signs into gcloud and attempts to activate the service account given by the dockerKeyFile.
func RevertShas ¶
func RevertShas(ctx context.Context, containerNames []string, firestoreDatabaseName, creds, tag string) (err error)
RevertShas swaps the previous sha with the current sha and updates the firestore.
func UpdateShaStorage ¶
func UpdateShaStorage(ctx context.Context, firestoreDatabaseName string, containerInfo ContainerInfosMap, creds, tag string) (err error)
UpdateShaStorage connects the the firestore and uploads the SHAs produced during the uprev service.
func UprevContainer ¶
func UprevContainer(ctx context.Context, imageCache map[string]any, config *UprevConfig, cipdLabel, imageTag string) (containerInfoItem *common.ContainerInfoItem, err error)
UprevContainer performs the logic for upreving a container. This involves creating a temporary directory for the container to modify by writing its Dockerfile and ensuring its CIPD packages.
func WriteDockerfile ¶
WriteDockerfile writes the embedded dockerfile to the temporary directory.
func WriteResource ¶
WriteResource writes the embedded resource to the temporary directory.
Types ¶
type CIPDPackage ¶
type CIPDPackage struct { // Name of CIPD package. Name string // Reference label of CIPD package. // Mainly for local development. Ref string }
CIPDPackage contains relevant information about a CIPDPackage.
func NewCIPDPackage ¶
func NewCIPDPackage(name string) *CIPDPackage
NewCIPDPackage creates a CIPDPackage without a reference label.
func NewCIPDPackageWithRef ¶
func NewCIPDPackageWithRef(name, ref string) *CIPDPackage
NewCIPDPackageWithRef creates a CIPDPackage with a reference label.
type ContainerInfosMap ¶
type ContainerInfosMap = map[string]*common.ContainerInfoItem
type Repository ¶
type UprevConfig ¶
type UprevConfig struct { // Dockerfile found by: Dockerfile_<Name> Name string // Repository information. // If empty, defaults to // host: us-docker.pkg.dev // project: cros-registry/test-services // firestoreHost: test-platform-store Repositories []*Repository // Defaults to Name, but can be separately set if // container name is different than the uprev name. ContainerName string // Binaries used during docker image setup. CIPDPackages []*CIPDPackage // Prepper is a function signature representing // any custom work needed by the Dockerfile. Prepper func(ctx context.Context, dir string) error Resources []string }
UprevConfig describes a container's uprev information.
func CleanConfigs ¶
func CleanConfigs(configs []*UprevConfig) []*UprevConfig