Documentation
¶
Overview ¶
Copyright 2023 The Chromium Authors Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Copyright 2023 The Chromium Authors Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Copyright 2023 The Chromium Authors Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Index ¶
- Constants
- Variables
- func ParseBuildArtifactPath(board string, model string, buildVersion string, bucket string) string
- func ParseBuildTargetsPath(board string) string
- func ParseModelPath(board string, model string) string
- type BuildServiceImpl
- func (b *BuildServiceImpl) CheckBuildStageStatus(ctx context.Context, board string, model string, buildVersion string, ...) (bool, error)
- func (b *BuildServiceImpl) Close() error
- func (b *BuildServiceImpl) FindMostStableBuild(ctx context.Context, board string) (string, error)
- func (b *BuildServiceImpl) FindMostStableBuildByBoardAndModel(ctx context.Context, board, model string) (*models.RecoveryVersion, error)
- func (b *BuildServiceImpl) ListAvailableMilestones(ctx context.Context, board, model string, filterType FilterType) ([]string, error)
- func (b *BuildServiceImpl) ListBuildTargets(ctx context.Context) ([]string, error)
- func (b *BuildServiceImpl) ListBuildsForMilestone(ctx context.Context, board string, model string, milestone int32, ...) ([]*BuildVersion, error)
- func (b *BuildServiceImpl) ListModels(ctx context.Context, board string) ([]string, error)
- func (b *BuildServiceImpl) StageBuild(ctx context.Context, board string, model string, buildVersion string, ...) (*moblabapipb.BuildArtifact, error)
- type BuildStatus
- type BuildVersion
- type FilterType
- type IBuildService
- type MockBuildService
- func (m *MockBuildService) CheckBuildStageStatus(ctx context.Context, board, model, buildVersion, bucketName string) (bool, error)
- func (m *MockBuildService) Close() error
- func (m *MockBuildService) FindMostStableBuild(ctx context.Context, board string) (string, error)
- func (m *MockBuildService) FindMostStableBuildByBoardAndModel(ctx context.Context, board, model string) (*models.RecoveryVersion, error)
- func (m *MockBuildService) ListAvailableMilestones(ctx context.Context, board, model string, filterType FilterType) ([]string, error)
- func (m *MockBuildService) ListBuildTargets(ctx context.Context) ([]string, error)
- func (m *MockBuildService) ListBuildsForMilestone(ctx context.Context, board, model string, milestone int32, ...) ([]*BuildVersion, error)
- func (m *MockBuildService) ListModels(ctx context.Context, board string) ([]string, error)
- func (m *MockBuildService) StageBuild(ctx context.Context, board, model, buildVersion, bucketName string, ...) (*moblabapipb.BuildArtifact, error)
Constants ¶
const PageSize = 1000
PageSize The number of items to return in a page
Variables ¶
var FromGCSBucketBuildStatusMap = map[moblabapipb.Build_BuildStatus]BuildStatus{ moblabapipb.Build_PASS: AVAILABLE, moblabapipb.Build_FAIL: FAILED, moblabapipb.Build_RUNNING: RUNNING, moblabapipb.Build_ABORTED: ABORTED, }
Functions ¶
func ParseBuildArtifactPath ¶
ParseBuildArtifactPath compose the path by given board, model, buildVersion, and bucket.
func ParseBuildTargetsPath ¶
ParseBuildTargetsPath compose the path by given board.
func ParseModelPath ¶
ParseModelPath compose the path by given board and model.
Types ¶
type BuildServiceImpl ¶
type BuildServiceImpl struct {
// contains filtered or unexported fields
}
BuildServiceImpl is an object for connecting the build client.
func (*BuildServiceImpl) CheckBuildStageStatus ¶
func (b *BuildServiceImpl) CheckBuildStageStatus( ctx context.Context, board string, model string, buildVersion string, bucketName string, ) (bool, error)
CheckBuildStageStatus check the build version is staged by given board, model, build version, and bucket name.
string board is the board name that we use it as a filter. string model is the model name that we use it as a filter. string buildVersion is the build version that we use it as a filter. string bucketName the bucket we need to check the build version is in this bucket.\fc
func (*BuildServiceImpl) Close ¶
func (b *BuildServiceImpl) Close() error
Close to close the client connection.
func (*BuildServiceImpl) FindMostStableBuild ¶
FindMostStableBuild find the stable build version by given board.
string board is the board name that we use it as a filter.
func (*BuildServiceImpl) FindMostStableBuildByBoardAndModel ¶
func (b *BuildServiceImpl) FindMostStableBuildByBoardAndModel(ctx context.Context, board, model string) (*models.RecoveryVersion, error)
FindMostStableBuildByBoardAndModel find the stable recovery version by board and model
func (*BuildServiceImpl) ListAvailableMilestones ¶
func (b *BuildServiceImpl) ListAvailableMilestones(ctx context.Context, board, model string, filterType FilterType) ([]string, error)
ListAvailableMilestones returns all available milestones by given board and model.
string board is the board name that we use it as a filter. string model is the model name that we use it as a filter.
func (*BuildServiceImpl) ListBuildTargets ¶
func (b *BuildServiceImpl) ListBuildTargets(ctx context.Context) ([]string, error)
ListBuildTargets returns all the board.
func (*BuildServiceImpl) ListBuildsForMilestone ¶
func (b *BuildServiceImpl) ListBuildsForMilestone( ctx context.Context, board string, model string, milestone int32, filterType FilterType, ) ([]*BuildVersion, error)
ListBuildsForMilestone returns all build versions by given board, model, and milestone.
string board is the board name that we use it as a filter. string model is the model name that we use it as a filter. int32 milestone is the milestone that we use it as a filter.
func (*BuildServiceImpl) ListModels ¶
ListModels returns all models by given board.
string board is the board name that we use it as a filter.
func (*BuildServiceImpl) StageBuild ¶
func (b *BuildServiceImpl) StageBuild(ctx context.Context, board string, model string, buildVersion string, bucketName string, filterType FilterType, ) (*moblabapipb.BuildArtifact, error)
StageBuild stage the build version in the bucket by given board, model, build version, and bucket name.
string board is the board that we want to stage. string model is the model that we want to stage. string buildVersion is the build version that we want to stage. string bucketName which bucket we want to put the build version in.
type BuildStatus ¶
type BuildStatus int
const ( AVAILABLE BuildStatus = iota FAILED RUNNING ABORTED )
type BuildVersion ¶
type BuildVersion struct { Version string Status BuildStatus }
type FilterType ¶
type FilterType string
const ( Unset FilterType = "" Release FilterType = "release" Firmware FilterType = "firmware" )
type IBuildService ¶
type IBuildService interface { // ListBuildTargets returns all the board. ListBuildTargets(ctx context.Context) ([]string, error) // ListModels returns all models by given board. ListModels(ctx context.Context, board string) ([]string, error) // ListAvailableMilestones returns all available milestones by given board and model. ListAvailableMilestones(ctx context.Context, board, model string, filterType FilterType) ([]string, error) // ListBuildsForMilestone returns all build versions by given board, model, and milestone. ListBuildsForMilestone(ctx context.Context, board, model string, milestone int32, filterType FilterType) ([]*BuildVersion, error) // FindMostStableBuild find the stable build version by given board. FindMostStableBuild(ctx context.Context, board string) (string, error) // FindMostStableBuildByBoardAndModel find the stable recovery version by board and model FindMostStableBuildByBoardAndModel(ctx context.Context, board, model string) (*models.RecoveryVersion, error) // CheckBuildStageStatus check the build version is staged by given board, model, build version, and bucket name. CheckBuildStageStatus(ctx context.Context, board, model, buildVersion, bucketName string) (bool, error) // StageBuild stage the build version in the bucket by given board, model, build version, and bucket name. StageBuild(ctx context.Context, board, model, buildVersion, bucketName string, filterType FilterType) (*moblabapipb.BuildArtifact, error) // Close clean up Close() error }
IBuildService is the interface that provide the services It should not contain any `Business Logic` here, because it is to mock the interface for testing.
type MockBuildService ¶
MockBuildService This object is only for testing
Object should provide the same functions that `IBuildServices` interfaces provide. TODO: I will write a generator for the interface later to generate this file
func (*MockBuildService) CheckBuildStageStatus ¶
func (m *MockBuildService) CheckBuildStageStatus(ctx context.Context, board, model, buildVersion, bucketName string) (bool, error)
CheckBuildStageStatus Mock the function instead of calling an API.
func (*MockBuildService) Close ¶
func (m *MockBuildService) Close() error
Close Mock the function instead of calling an API.
func (*MockBuildService) FindMostStableBuild ¶
FindMostStableBuild Mock the function instead of calling an API.
func (*MockBuildService) FindMostStableBuildByBoardAndModel ¶
func (m *MockBuildService) FindMostStableBuildByBoardAndModel(ctx context.Context, board, model string) (*models.RecoveryVersion, error)
func (*MockBuildService) ListAvailableMilestones ¶
func (m *MockBuildService) ListAvailableMilestones(ctx context.Context, board, model string, filterType FilterType) ([]string, error)
ListAvailableMilestones Mock the function instead of calling an API.
func (*MockBuildService) ListBuildTargets ¶
func (m *MockBuildService) ListBuildTargets(ctx context.Context) ([]string, error)
ListBuildTargets Mock the function instead of calling an API.
func (*MockBuildService) ListBuildsForMilestone ¶
func (m *MockBuildService) ListBuildsForMilestone(ctx context.Context, board, model string, milestone int32, filterType FilterType) ([]*BuildVersion, error)
ListBuildsForMilestone Mock the function instead of calling an API.
func (*MockBuildService) ListModels ¶
ListModels Mock the function instead of calling an API.
func (*MockBuildService) StageBuild ¶
func (m *MockBuildService) StageBuild(ctx context.Context, board, model, buildVersion, bucketName string, filterType FilterType) (*moblabapipb.BuildArtifact, error)
StageBuild Mock the function instead of calling an API.