site

package
v0.0.0-...-6700e38 Latest Latest
Warning

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

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

Documentation

Overview

Package site contains site local constants for the satlab

Index

Constants

View Source
const (
	// SatlabSAFilename is service account filename on user GCS bucket.
	SatlabSAFilename = "pubsub-key-do-not-delete.json"
	// SkylabDroneKeyFilename is filename of service account key to use by drone container
	SkylabDroneKeyFilename = "skylab-drone.json"
	// KeyFolder is where keys and config lives.
	KeyFolder = "/home/satlab/keys"
	// SatlabConfigFilename to be downloaed from GCS.
	SatlabConfigFilename = "satlab-config.json"
	BotoConfigFilename   = ".boto"
)
View Source
const (
	// CTPBuilderBucketEnv is the env var used to determine what bucket the
	// ctp task should run in.
	CTPBuilderBucketEnv = "CTP_BUILDER_BUCKET"
	// CTPBuilderNameEnv is the env var used to determine what CTP builder
	// name be used to schedule CTP builds.
	CTPBuilderNameEnv = "CTP_BUILDER_NAME"
	// DeployBuilderBucketEnv is the env var used to determine what bucket the
	// deploy task should run in.
	DeployBuilderBucketEnv = "DEPLOY_BUILDER_BUCKET"
	// GCSBucket is the bucket for staging images.
	// (in case of internal users staging is not needed)
	GCSImageBucketEnv = "GCS_IMAGE_BUCKET"
	// GCSBucket is the partner bucket for storing custom images, results and testplans.
	GCSPartnerBucketEnv = "GCS_PARTNER_BUCKET"
	// LUCIProjectEnv is the env var used to determine what LUCI project bb
	// tasks should run in.
	LUCIProjectEnv = "LUCI_PROJECT"
	// UFSNamespaceEnv is the env var used to determine what namespace should
	// be used to interface with UFS.
	UFSNamespaceEnv = "UFS_NAMESPACE"
	// UFSZoneEnv is the env var used to determine what zone should
	// be used to interface with UFS.
	UFSZoneEnv = "UFS_ZONE"
	// BotPrefix is the env var used to get bot information
	BotPrefix = "BOT_PREFIX"
	// BotoPath is the env var to get boto config file path
	BotoPath = "BOTO_PATH"

	// ServiceAccountKeyPathEnv defines the Service account key path to be used by
	// moblab api.
	ServiceAccountKeyPathEnv = "SERVICE_ACCOUNT_KEY_PATH"

	// Log file used for satlab-rpcserver
	RPCServerLogFileEnv = "SATLAB_RPCSERVER_LOGFILE"

	// DefaultLUCIProject is the LUCI project to specify if `LUCIProjectEnv` is
	// not present.
	DefaultLUCIProject = "chromeos"
	// DefaultDeployBuilderBucket is the bb bucket to specify if
	// `DeployBuilderBucketEnv` is not specified.
	DefaultDeployBuilderBucket = "labpack_runner"
	// DefaultCTPBuilderBucket is the bb bucket to specify if
	// `CTPBuilderBucketEnv` is not specified.
	DefaultCTPBuilderBucket = "testplatform"
	// DefaultCTPBuilderName is the bb bucket to specify if
	// `CTPBuilderNameEnv` is not specified.
	DefaultCTPBuilderName = "cros_test_platform"
	// DefaultGCSImageBucket is the GCS bucket to specify if
	// `GCSImageBucketEnv` is not specified.
	DefaultGCSImageBucket = "chromeos-image-archive"
	// DefaultGCSPartnerBucket is the GCS bucket to specify if
	// `GCSPartnerBucketEnv` is not specified.
	DefaultGCSPartnerBucket = "chromeos-satlab-internal-users"
	// DefaultNamespace is the default namespace to use for all operations.
	DefaultNamespace = "os"
	// DefaultZone is the default value for the zone command line flag.
	DefaultZone = "satlab"
	// DefaultServiceAccountKeyPathEnv is the default path for for service account.
	DefaultServiceAccountKeyPathEnv = "/home/satlab/keys/pubsub-key-do-not-delete.json"
	// SwarmingServiceHost is the host of swarming service address
	SwarmingServiceHost = "chromeos-swarming.appspot.com"

	DefaultRPCServerLogFile = "/var/log/satlab/satlab_rpcserver.log"
	// DefaultTestRunnerBuilderName is the  test_runner builder name
	DefaultTestRunnerBuilderName = "test_runner"
	// BotoAccessKeyId is the boto key of the boto config
	BotoAccessKeyId = "gs_access_key_id"
	// BotoSecretAccessKey is the boto secret key of the boto config
	BotoSecretAccessKey = "gs_secret_access_key"
)
View Source
const (
	BuildBucketIDTag          = "buildbucket_build_id"
	BuilderTag                = "builder"
	DisplayNameTag            = "display_name"
	DutNameTag                = "dut_name"
	ParentBuildBucketIDTag    = "parent_buildbucket_id"
	LabelPoolTag              = "label-pool"
	LabelSuiteTag             = "label-suite"
	SatlabIDTag               = "satlab-id"
	LabelBoardTag             = "label-board"
	LabelModelTag             = "label-model"
	LabelImageTag             = "label-image"
	Suite                     = "suite"
	TestPlan                  = "testplan"
	TestPlanIDTag             = "test-plan-id"
	TestTypeTag               = "test-type"
	BugIDTag                  = "bug_id"
	QualRunIDTag              = "qual_run_id"
	MiloSite                  = "http://ci.chromium.org/b/"
	TesthausURLTemplate       = "https://tests.chromeos.goog/p/chromeos/search?union=AND&viewMode=List&"
	BuildBucketID             = "buildbucket_id"
	TaskLinkTemplate          = "https://chromeos-swarming.appspot.com/task?id="
	DeployBuilderName         = "deploy"
	TaskRunningTest           = "Running"
	TaskRunningRepair         = "Repairing"
	TaskRunningDeploy         = "Deploying"
	TestRunnerSwarmingPoolEnv = "TEST_RUNNER_SWARMING_POOL"
	CTPSwarmingPoolEnv        = "CTP_SWARMING_POOL"
	CPConAccountIDEnv         = "CPCON_ACCOUNT_ID"
	CPConLinkTemplate         = "https://chromeos.google.com/partner/console/a/%s/pvsAvlDetails?runId=%s&issueId=%s"
)

Swarming task tags used to get task details.

View Source
const DefaultCTPTimeoutMins = 360

DefaultCTPTimeoutMins is the default build timeout.

View Source
const DevCrosAdmService = "skylab-staging-bot-fleet.appspot.com"

DevCrosAdmService is the dev CrOSSkylabAdmin service.

View Source
const DevUFSService = "staging.ufs.api.cr.dev"

DevUFSService is the dev UFS service

View Source
const Major = 0

// Major is the Major version number

View Source
const MaxIshCTPTimeoutMins = 4319

MaxIshCTPTimeoutMins is the maximum timeout (minus one minute) that can be scheduled as a CTP execution.

View Source
const Minor = 1

// Minor is the Minor version number

View Source
const Patch = 0

// Patch is the PAtch version number

View Source
const ProdCrosAdmService = "chromeos-skylab-bot-fleet.appspot.com"

ProdCrosAdmService is the prod CrOSSkylabAdmin service.

View Source
const ProdUFSService = "ufs.api.cr.dev"

ProdUFSService is the prod UFS service

View Source
const RecoveryVersionDirectory = "/home/satlab/keys/recovery_versions/"
View Source
const RepairBuilderName = "repair"

RepairBuilderName is the var used to determine what Repair builder name will be used to schedule Repair builds.

View Source
const Satlab = "satlab"

Satlab is just the string "satlab". The literal string "satlab" is used in many places to create resource names.

View Source
const SatlabSetupInstruction = `` /* 958-byte string literal not displayed */

Variables

View Source
var AppPrefix = "satlab"

AppPrefix is the prefix to use the satlab CLI.

View Source
var CipdInstalledPath = "go.chromium.org/infra/cros/satlab/satlab/"

CipdInstalledPath is the installed path for satlab package. This is the path to the directory containing main.go relative to the repo root.

DefaultAuthOptions is an auth.Options struct prefilled with chrome-infra defaults.

View Source
var DefaultAuthScopes = []string{auth.OAuthScopeEmail}

DefaultAuthScopes is the default scopes for shivas login

View Source
var DefaultPRPCOptions = prpcOptionWithUserAgent(fmt.Sprintf("satlab/%s", VersionNumber))

DefaultPRPCOptions is used for PRPC clients. If it is nil, the default value is used. See prpc.Options for details.

This is provided so it can be overridden for testing.

View Source
var VersionNumber = fmt.Sprintf("%d.%d.%d", Major, Minor, Patch)

// VersionNumber is the version number for the tool. It follows the Semantic // Versioning Specification (http://semver.org) and the format is: // "MAJOR.MINOR.0+BUILD_TIME". // We can ignore the PATCH part (i.e. it's always 0) to make the maintenance // work easier. // We can also print out the build time (e.g. 20060102150405) as the METADATA // when show version to users.

Functions

func GetAuthOption

func GetAuthOption(ctx context.Context) auth.Options

GetAuthOption returns the correct auth option for CLI and RPC calls

If the call is already authenticated with user scope, the login credential is reused. If no existing credential found the service account key is used as authentication method.

func GetBotPrefix

func GetBotPrefix() string

func GetBotoPath

func GetBotoPath() string

GetBotoPath get the boto file path

func GetCPConAccountID

func GetCPConAccountID() string

func GetCTPBucket

func GetCTPBucket() string

GetCTPBucket determines which bucket we expect any ctp tasks to run in, based on the environment.

func GetCTPBuilder

func GetCTPBuilder() string

GetCTPBuilder determines which builder we expect any ctp build to run in, based on the environment.

func GetCTPSwarmingPool

func GetCTPSwarmingPool() string

GetCTPSwarmingPool determines which Partner Swarming Pool for CTP, based on the environment.

func GetDeployBucket

func GetDeployBucket() string

GetDeployBucket determines which bucket we expect any deploy tasks to run in, based on the environment.

func GetFullyQualifiedHostname

func GetFullyQualifiedHostname(specifiedSatlabID string, fetchedSatlabID, prefix string, content string) string

GetFullyQualifiedHostname takes in primitives used to create the fully qualified hostname and produces that hostname specifiedSatlabID refers to a user specified ID which should take precedence over the fetchedSatlabID which should be fetched in an automated fashion

func GetGCSImageBucket

func GetGCSImageBucket() string

GetGCSImageBucket determines which Google storage image bucket to use, based on the environment.

func GetGCSPartnerBucket

func GetGCSPartnerBucket() string

GetGCSPartnerBucket determines which Google storage image bucket to use, based on the environment.

func GetLUCIProject

func GetLUCIProject() string

GetLUCIProject determines what LUCI project we expect any buildbucket tasks to run in, based on the environment.

func GetNamespace

func GetNamespace(namespace string) string

GetNamespace determines the namespace, in descending priority, by

  1. use parameter namespace.
  2. Specified in environment
  3. Default to `os`

func GetRPCServerLogFile

func GetRPCServerLogFile() string

GetRPCServerLogFile determines the log file to use for logging

func GetServiceAccountPath

func GetServiceAccountPath() string

GetServiceAccountPath specifies the service account key path to be used with moblab api

func GetTestRunnerSwarmingPool

func GetTestRunnerSwarmingPool() string

GetTestRunnerSwarmingPool determines which Partner Swarming Pool for test runner, based on the environment.

func GetUFSService

func GetUFSService(dev bool) string

GetUFSService returns the hostname of the UFS service by given a flag

func GetUFSZone

func GetUFSZone() string

GetUFSZone determines which ZONE the DUTs belongs to, based on the environment.

func IsPartner

func IsPartner() bool

IsPartner determines if user is internal or external. Returns true if external.

func MaybePrepend

func MaybePrepend(prefix string, satlabID string, content string) string

MaybePrepend adds a prefix with a leading dash unless the string already begins with the prefix in question.

func SecretsDir

func SecretsDir() string

SecretsDir customizes the location for auth-related secrets.

Types

type CommonFlags

type CommonFlags struct {
	Verbose  bool
	SatlabID string
}

CommonFlags controls some commonly-used CLI flags.

func (*CommonFlags) Register

func (f *CommonFlags) Register(fl *flag.FlagSet)

Register sets up the common flags.

type EnvFlags

type EnvFlags struct {
	// contains filtered or unexported fields
}

EnvFlags controls selection of the environment: either prod (default) or dev.

func MakeEnvFlagsForTesting

func MakeEnvFlagsForTesting(ns string) EnvFlags

MakeEnvFlagsForTesting creates env flags while allowing us to keep fields in EnvFlags private, so that users are forced to use GetNamespace() instead for real code.

func (*EnvFlags) GetCrosAdmService

func (f *EnvFlags) GetCrosAdmService() string

GetCrosAdmService returns the hostname of the CrOSSkylabAdmin service that is appropriate for the given environment.

func (*EnvFlags) GetNamespace

func (f *EnvFlags) GetNamespace() string

GetNamespace determines the namespace, in descending priority, by

  1. Specified in flag
  2. Specified in environment
  3. Default to `os`

func (*EnvFlags) GetUFSService

func (f *EnvFlags) GetUFSService() string

GetUFSService returns the hostname of the UFS service appropriate for an environment

func (*EnvFlags) Register

func (f *EnvFlags) Register(fl *flag.FlagSet)

Register sets up the -dev argument.

type OutputFlags

type OutputFlags struct {
	// contains filtered or unexported fields
}

OutputFlags controls output-related CLI flags.

func (*OutputFlags) Full

func (f *OutputFlags) Full() bool

Full returns if the full format of output is logged in tsv format (without title)

func (*OutputFlags) JSON

func (f *OutputFlags) JSON() bool

JSON returns if the output is logged in json format

func (*OutputFlags) NoEmit

func (f *OutputFlags) NoEmit() bool

NoEmit returns if output json should NOT print/emit unpopulated fields

func (*OutputFlags) Register

func (f *OutputFlags) Register(fl *flag.FlagSet)

Register sets up the output flags.

func (*OutputFlags) Tsv

func (f *OutputFlags) Tsv() bool

Tsv returns if the output is logged in tsv format (without title)

Jump to

Keyboard shortcuts

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