build_service

package
v0.0.0-...-9994f1b Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2025 License: BSD-3-Clause Imports: 16 Imported by: 0

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

View Source
const PageSize = 1000

PageSize The number of items to return in a page

Variables

Functions

func ParseBuildArtifactPath

func ParseBuildArtifactPath(board string, model string, buildVersion string, bucket string) string

ParseBuildArtifactPath compose the path by given board, model, buildVersion, and bucket.

func ParseBuildTargetsPath

func ParseBuildTargetsPath(board string) string

ParseBuildTargetsPath compose the path by given board.

func ParseModelPath

func ParseModelPath(board string, model string) string

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

func (b *BuildServiceImpl) FindMostStableBuild(ctx context.Context, board string) (string, error)

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

func (b *BuildServiceImpl) ListModels(ctx context.Context, board string) ([]string, error)

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.

func New

func New(ctx context.Context) (IBuildService, error)

New sets up the `BuildClient` and returns a BuildConnector. The service account is set in the global environment.

type MockBuildService

type MockBuildService struct {
	mock.Mock
}

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

func (m *MockBuildService) FindMostStableBuild(ctx context.Context, board string) (string, error)

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

func (m *MockBuildService) ListModels(ctx context.Context, board string) ([]string, error)

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.

Jump to

Keyboard shortcuts

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