2019-10-10 00:52:42 -04:00
using System ;
namespace GitHub.Runner.Common
{
public enum WellKnownDirectory
{
Bin ,
Diag ,
Externals ,
Root ,
Actions ,
Temp ,
Tools ,
Update ,
Work ,
}
public enum WellKnownConfigFile
{
Runner ,
Credentials ,
2020-03-04 21:40:58 -05:00
MigratedCredentials ,
2019-10-10 00:52:42 -04:00
RSACredentials ,
Service ,
CredentialStore ,
Certificates ,
Options ,
2020-03-11 10:36:56 -04:00
SetupInfo ,
2021-09-29 15:49:31 -04:00
Telemetry
2019-10-10 00:52:42 -04:00
}
public static class Constants
{
/// <summary>Path environment variable name.</summary>
#if OS_WINDOWS
public static readonly string PathVariable = "Path" ;
#else
public static readonly string PathVariable = "PATH" ;
#endif
public static string ProcessTrackingId = "RUNNER_TRACKING_ID" ;
public static string PluginTracePrefix = "##[plugin.trace]" ;
public static readonly int RunnerDownloadRetryMaxAttempts = 3 ;
2021-07-01 13:34:28 -04:00
public static readonly int CompositeActionsMaxDepth = 9 ;
2019-10-10 00:52:42 -04:00
// This enum is embedded within the Constants class to make it easier to reference and avoid
// ambiguous type reference with System.Runtime.InteropServices.OSPlatform and System.Runtime.InteropServices.Architecture
public enum OSPlatform
{
OSX ,
Linux ,
Windows
}
public enum Architecture
{
X86 ,
X64 ,
Arm ,
Arm64
}
public static class Runner
{
#if OS_LINUX
public static readonly OSPlatform Platform = OSPlatform . Linux ;
#elif OS_OSX
public static readonly OSPlatform Platform = OSPlatform . OSX ;
#elif OS_WINDOWS
public static readonly OSPlatform Platform = OSPlatform . Windows ;
#endif
#if X86
public static readonly Architecture PlatformArchitecture = Architecture . X86 ;
#elif X64
public static readonly Architecture PlatformArchitecture = Architecture . X64 ;
#elif ARM
public static readonly Architecture PlatformArchitecture = Architecture . Arm ;
#elif ARM64
public static readonly Architecture PlatformArchitecture = Architecture . Arm64 ;
#endif
public static readonly TimeSpan ExitOnUnloadTimeout = TimeSpan . FromSeconds ( 30 ) ;
public static class CommandLine
{
//if you are adding a new arg, please make sure you update the
//validArgs array as well present in the CommandSettings.cs
public static class Args
{
public static readonly string Auth = "auth" ;
2020-04-13 21:33:13 -04:00
public static readonly string Labels = "labels" ;
2019-10-10 00:52:42 -04:00
public static readonly string MonitorSocketAddress = "monitorsocketaddress" ;
2019-12-11 13:26:06 -05:00
public static readonly string Name = "name" ;
2020-07-23 17:46:48 -04:00
public static readonly string RunnerGroup = "runnergroup" ;
2019-10-10 00:52:42 -04:00
public static readonly string StartupType = "startuptype" ;
public static readonly string Url = "url" ;
public static readonly string UserName = "username" ;
public static readonly string WindowsLogonAccount = "windowslogonaccount" ;
public static readonly string Work = "work" ;
// Secret args. Must be added to the "Secrets" getter as well.
public static readonly string Token = "token" ;
2020-12-25 21:54:23 -05:00
public static readonly string PAT = "pat" ;
2019-10-10 00:52:42 -04:00
public static readonly string WindowsLogonPassword = "windowslogonpassword" ;
public static string [ ] Secrets = > new [ ]
{
2020-12-25 21:54:23 -05:00
PAT ,
2019-10-10 00:52:42 -04:00
Token ,
WindowsLogonPassword ,
} ;
}
public static class Commands
{
public static readonly string Configure = "configure" ;
public static readonly string Remove = "remove" ;
public static readonly string Run = "run" ;
public static readonly string Warmup = "warmup" ;
}
//if you are adding a new flag, please make sure you update the
//validFlags array as well present in the CommandSettings.cs
public static class Flags
{
2021-01-14 13:26:07 -05:00
public static readonly string Check = "check" ;
2019-10-10 00:52:42 -04:00
public static readonly string Commit = "commit" ;
2021-09-13 11:28:09 -04:00
public static readonly string Ephemeral = "ephemeral" ;
2019-10-10 00:52:42 -04:00
public static readonly string Help = "help" ;
public static readonly string Replace = "replace" ;
2022-01-26 13:23:24 -05:00
public static readonly string DisableUpdate = "disableupdate" ;
2021-09-21 17:31:48 -04:00
public static readonly string Once = "once" ; // Keep this around since customers still relies on it
2019-10-10 00:52:42 -04:00
public static readonly string RunAsService = "runasservice" ;
public static readonly string Unattended = "unattended" ;
public static readonly string Version = "version" ;
}
}
public static class ReturnCode
{
public const int Success = 0 ;
public const int TerminatedError = 1 ;
public const int RetryableError = 2 ;
public const int RunnerUpdating = 3 ;
public const int RunOnceRunnerUpdating = 4 ;
}
2020-04-27 23:44:17 -04:00
2021-01-05 21:49:11 -05:00
public static class Features
{
public static readonly string DiskSpaceWarning = "runner.diskspace.warning" ;
2022-03-22 10:43:25 +01:00
public static readonly string Node12Warning = "DistributedTask.AddWarningToNode12Action" ;
2021-01-05 21:49:11 -05:00
}
2020-04-27 23:44:17 -04:00
public static readonly string InternalTelemetryIssueDataKey = "_internal_telemetry" ;
public static readonly string WorkerCrash = "WORKER_CRASH" ;
2021-01-05 21:49:11 -05:00
public static readonly string LowDiskSpace = "LOW_DISK_SPACE" ;
2020-10-02 11:34:37 -04:00
public static readonly string UnsupportedCommand = "UNSUPPORTED_COMMAND" ;
public static readonly string UnsupportedCommandMessageDisabled = "The `{0}` command is disabled. Please upgrade to using Environment Files or opt into unsecure command execution by setting the `ACTIONS_ALLOW_UNSECURE_COMMANDS` environment variable to `true`. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/" ;
2022-02-24 21:01:49 -05:00
public static readonly string UnsupportedStopCommandTokenDisabled = "You cannot use a endToken that is an empty string, the string 'pause-logging', or another workflow command. For more information see: https://docs.github.com/actions/learn-github-actions/workflow-commands-for-github-actions#example-stopping-and-starting-workflow-commands or opt into insecure command execution by setting the `ACTIONS_ALLOW_UNSECURE_STOPCOMMAND_TOKENS` environment variable to `true`." ;
public static readonly string UnsupportedSummarySize = "$GITHUB_STEP_SUMMARY upload aborted, supports content up to a size of {0}k, got {1}k. For more information see: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-markdown-summary" ;
2022-03-22 10:43:25 +01:00
public static readonly string Node12DetectedAfterEndOfLife = "Node.js 12 actions are deprecated. Please update the following actions to use Node.js 16: {0}" ;
2019-10-10 00:52:42 -04:00
}
2020-03-02 11:22:45 -05:00
public static class RunnerEvent
{
public static readonly string Register = "register" ;
public static readonly string Remove = "remove" ;
}
2019-10-10 00:52:42 -04:00
public static class Pipeline
{
public static class Path
{
public static readonly string PipelineMappingDirectory = "_PipelineMapping" ;
public static readonly string TrackingConfigFile = "PipelineFolder.json" ;
}
}
public static class Configuration
{
public static readonly string OAuthAccessToken = "OAuthAccessToken" ;
public static readonly string OAuth = "OAuth" ;
}
public static class Expressions
{
public static readonly string Always = "always" ;
public static readonly string Cancelled = "cancelled" ;
public static readonly string Failure = "failure" ;
public static readonly string Success = "success" ;
}
2022-03-18 02:35:04 +01:00
public static class Hooks
{
public static readonly string JobStartedStepName = "Set up runner" ;
public static readonly string JobCompletedStepName = "Complete runner" ;
}
2019-10-10 00:52:42 -04:00
public static class Path
{
public static readonly string ActionsDirectory = "_actions" ;
2020-01-20 18:22:59 +01:00
public static readonly string ActionManifestYmlFile = "action.yml" ;
public static readonly string ActionManifestYamlFile = "action.yaml" ;
2019-10-10 00:52:42 -04:00
public static readonly string BinDirectory = "bin" ;
public static readonly string DiagDirectory = "_diag" ;
public static readonly string ExternalsDirectory = "externals" ;
public static readonly string RunnerDiagnosticLogPrefix = "Runner_" ;
public static readonly string TempDirectory = "_temp" ;
public static readonly string ToolDirectory = "_tool" ;
public static readonly string UpdateDirectory = "_update" ;
public static readonly string WorkDirectory = "_work" ;
public static readonly string WorkerDiagnosticLogPrefix = "Worker_" ;
}
// Related to definition variables.
public static class Variables
{
public static readonly string MacroPrefix = "$(" ;
public static readonly string MacroSuffix = ")" ;
public static class Actions
{
//
// Keep alphabetical
//
2020-10-02 11:34:37 -04:00
public static readonly string AllowUnsupportedCommands = "ACTIONS_ALLOW_UNSECURE_COMMANDS" ;
2021-09-29 20:44:01 +02:00
public static readonly string AllowUnsupportedStopCommandTokens = "ACTIONS_ALLOW_UNSECURE_STOPCOMMAND_TOKENS" ;
2019-10-10 00:52:42 -04:00
public static readonly string RunnerDebug = "ACTIONS_RUNNER_DEBUG" ;
public static readonly string StepDebug = "ACTIONS_STEP_DEBUG" ;
2022-02-25 20:59:16 +01:00
public static readonly string AllowActionsUseUnsecureNodeVersion = "ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION" ;
2019-10-10 00:52:42 -04:00
}
2019-12-17 18:21:13 -05:00
public static class Agent
{
public static readonly string ToolsDirectory = "agent.ToolsDirectory" ;
2022-02-14 15:06:08 +01:00
2022-02-25 20:59:02 +01:00
// Set this env var to "node12" to downgrade the node version for internal functions (e.g hashfiles). This does NOT affect the version of node actions.
public static readonly string ForcedInternalNodeVersion = "ACTIONS_RUNNER_FORCED_INTERNAL_NODE_VERSION" ;
2019-12-17 18:21:13 -05:00
}
2019-10-10 00:52:42 -04:00
public static class System
{
//
// Keep alphabetical
//
public static readonly string AccessToken = "system.accessToken" ;
public static readonly string Culture = "system.culture" ;
public static readonly string PhaseDisplayName = "system.phaseDisplayName" ;
}
}
}
}