Documentation
¶
Index ¶
- Constants
- Variables
- func BrewManagedBinary() (string, bool)
- func CompletionDebugLogFile() string
- func EnsureHarnessHome() error
- func ExpandHomeDir(pathStr string) string
- func GetConfigFilePath() string
- func GetCredentialsFilePath() string
- func GetHarnessBinDir() string
- func GetHarnessHomeDir() string
- func GetHomeDir() string
- func IsDev() bool
- func IsPipelineExecution() bool
Constants ¶
const ( PostUpgradeFlag = "--post-upgrade" PostInstallFlag = "--post-install" BackgroundUpdateCheckFlag = "--background-update-check" )
Hidden flags. See the corresponding rootcmd.MaybeRun* function for each.
const ( HarnessHome = "~/.harness" ConfigFileName = "config.yaml" CredentialsFileName = "credentials" // EnvCheckSpecs triggers spec validation mode when set to "1". EnvCheckSpecs = "HARNESS_CHECKSPECS" // EnvDebugCompletion enables debug logging for completion invocations, writing to CompletionDebugLogFile. EnvDebugCompletion = "HARNESS_DEBUG_COMPLETION" // EnvPipelineID is set by the Harness platform when running inside a pipeline. EnvPipelineID = "HARNESS_PIPELINEID" // EnvNoUpdateCheck disables the background update check when set to "1". EnvNoUpdateCheck = "HARNESS_NO_UPDATE_CHECK" // EnvNoTelemetry disables all usage telemetry when set to "1". EnvNoTelemetry = "HARNESS_NO_TELEMETRY" // EnvInstallType identifies how the CLI was installed (e.g. "script"), // set by the installer before invoking --post-install. See // [telemetry.ResolveInstallType] for the whitelist and default. EnvInstallType = "HARNESS_INSTALL_TYPE" // EnvLogFile redirects all log output to the specified file path. EnvLogFile = "HARNESS_CLI_LOGFILE" // EnvColumns sets default --columns overrides per noun for list commands, so users // don't have to pass --columns on every invocation (e.g. to keep demo terminals from // wrapping columns). Format: semicolon-separated "noun=columns" entries, e.g. // "pipeline=id,name,status;execution=id,status,started". See [format.EnvColumnsFor]. EnvColumns = "HARNESS_CLI_COLUMNS" // EnvCLIHome overrides the harness home directory (default ~/.harness). EnvCLIHome = "HARNESS_CLI_HOME" // EnvEnableBetaModules is a tri-state env var consulted when resolving // whether a module_type: hidden module is enabled. "1" enables every // hidden module; "0" forces off the harness.io-employee auto-detect // (falling through to the config file); unset defers to the auto-detect. EnvEnableBetaModules = "HARNESS_ENABLE_BETA_MODULES" // EnvEnabledModules, when set at all (including to ""), is a // comma-separated allowlist of hidden module names to enable — a hard // override of both EnvEnableBetaModules and the config file for this // invocation. EnvEnabledModules = "HARNESS_CLI_ENABLED_MODULES" // Env var names for env-var auth mode. EnvAPIKey = "HARNESS_API_KEY" EnvAPIJWT = "HARNESS_API_JWT" EnvAccount = "HARNESS_ACCOUNT" EnvAPIURL = "HARNESS_API_URL" EnvOrg = "HARNESS_ORG" EnvProject = "HARNESS_PROJECT" EnvRegistryURL = "HARNESS_REGISTRY_URL" EnvProfile = "HARNESS_PROFILE" // EnvSSOAuthServerURL overrides the SSO authorization server base URL // (default https://id.harness.io). EnvSSOAuthServerURL = "HARNESS_SSO_AUTH_SERVER_URL" // EnvSSOBaseURL overrides the SSO API base URL used for SSO-authenticated // requests (default https://mcp.harness.io/cli). EnvSSOBaseURL = "HARNESS_SSO_BASE_URL" // EnvSSOClientID overrides the SSO OAuth client ID // (default harness-cli-client). EnvSSOClientID = "HARNESS_SSO_CLIENT_ID" // Defaults applied when env vars are not set. DefaultAPIURL = "https://app.harness.io" DefaultRegistryURL = "https://pkg.harness.io" )
const BrewCaskRef = "harness/tap/harness-cli"
BrewCaskRef is the tap-qualified cask this CLI is published as, suitable for `brew install --cask` / `brew upgrade --cask`.
const TimeoutExitCode = 124
TimeoutExitCode is the exit code used when a command is killed by --timeout.
Variables ¶
var BuildTime = ""
overridden at build time via ldflags: -X github.com/harness/cli/v3/pkg/hbase.BuildTime=yyyymmddhhmmZ
var RunID = uuid.New().String()
RunID is a UUID generated once at process startup. It is sent as X-Harness-CLI-Run-ID on every outgoing API call to correlate all requests from a single CLI invocation.
var Version = "0.1.0-dev"
overridden at build time via ldflags: -X github.com/harness/cli/v3/pkg/hbase.Version=x.y.z
Functions ¶
func BrewManagedBinary ¶
BrewManagedBinary reports whether the running binary was installed by a Homebrew cask, returning the resolved path when it was. Homebrew owns that path, so self-update must defer to `brew upgrade` rather than write over it.
func CompletionDebugLogFile ¶
func CompletionDebugLogFile() string
CompletionDebugLogFile returns the path used for completion debug logging when EnvDebugCompletion is set. On Windows there's no /tmp, so it falls back to os.TempDir().
func EnsureHarnessHome ¶
func EnsureHarnessHome() error
EnsureHarnessHome creates ~/.harness with 0700 permissions if it does not exist. Returns an error if the directory cannot be created or if the path exists but is not a directory.
func ExpandHomeDir ¶
func GetConfigFilePath ¶
func GetConfigFilePath() string
func GetCredentialsFilePath ¶
func GetCredentialsFilePath() string
func GetHarnessBinDir ¶
func GetHarnessBinDir() string
GetHarnessBinDir returns the directory installed plugin binaries live in: ~/.harness/bin. This is a directory the CLI always owns and can write to, unlike the core binary's own directory (owned by brew/deb/rpm/scoop).
func GetHarnessHomeDir ¶
func GetHarnessHomeDir() string
GetHarnessHomeDir returns the harness home directory, defaulting to ~/.harness unless overridden by EnvCLIHome.
func GetHomeDir ¶
func GetHomeDir() string
func IsDev ¶
func IsDev() bool
IsDev reports whether this is a development build (Version ends with "-dev").
func IsPipelineExecution ¶
func IsPipelineExecution() bool
IsPipelineExecution reports whether the CLI is running as a step inside a Harness pipeline.
Types ¶
This section is empty.