Documentation ¶
Overview ¶
Package cmd provides all CLI commands. NOTE: These are different from the commands that get run via pull request comments.
Index ¶
Constants ¶
const ( CheckoutStrategyBranch = "branch" CheckoutStrategyMerge = "merge" )
checkout strategies
const ( // Flag names. ADWebhookPasswordFlag = "azuredevops-webhook-password" // nolint: gosec ADWebhookUserFlag = "azuredevops-webhook-user" ADTokenFlag = "azuredevops-token" // nolint: gosec ADUserFlag = "azuredevops-user" ADHostnameFlag = "azuredevops-hostname" AllowCommandsFlag = "allow-commands" AllowForkPRsFlag = "allow-fork-prs" AtlantisURLFlag = "atlantis-url" AutoDiscoverModeFlag = "autodiscover-mode" AutomergeFlag = "automerge" ParallelPlanFlag = "parallel-plan" ParallelApplyFlag = "parallel-apply" AutoplanModules = "autoplan-modules" AutoplanModulesFromProjects = "autoplan-modules-from-projects" AutoplanFileListFlag = "autoplan-file-list" BitbucketBaseURLFlag = "bitbucket-base-url" BitbucketTokenFlag = "bitbucket-token" BitbucketUserFlag = "bitbucket-user" BitbucketWebhookSecretFlag = "bitbucket-webhook-secret" CheckoutDepthFlag = "checkout-depth" CheckoutStrategyFlag = "checkout-strategy" ConfigFlag = "config" DataDirFlag = "data-dir" DefaultTFVersionFlag = "default-tf-version" DisableApplyAllFlag = "disable-apply-all" DisableAutoplanFlag = "disable-autoplan" DisableAutoplanLabelFlag = "disable-autoplan-label" DisableMarkdownFoldingFlag = "disable-markdown-folding" DisableRepoLockingFlag = "disable-repo-locking" DisableUnlockLabelFlag = "disable-unlock-label" DiscardApprovalOnPlanFlag = "discard-approval-on-plan" EmojiReaction = "emoji-reaction" EnablePolicyChecksFlag = "enable-policy-checks" EnableRegExpCmdFlag = "enable-regexp-cmd" EnableDiffMarkdownFormat = "enable-diff-markdown-format" ExecutableName = "executable-name" FailOnPreWorkflowHookError = "fail-on-pre-workflow-hook-error" HideUnchangedPlanComments = "hide-unchanged-plan-comments" GHHostnameFlag = "gh-hostname" GHTeamAllowlistFlag = "gh-team-allowlist" GHTokenFlag = "gh-token" GHUserFlag = "gh-user" GHAppIDFlag = "gh-app-id" GHAppKeyFlag = "gh-app-key" GHAppKeyFileFlag = "gh-app-key-file" GHAppSlugFlag = "gh-app-slug" GHOrganizationFlag = "gh-org" GHWebhookSecretFlag = "gh-webhook-secret" // nolint: gosec GHAllowMergeableBypassApply = "gh-allow-mergeable-bypass-apply" // nolint: gosec GitlabHostnameFlag = "gitlab-hostname" GitlabTokenFlag = "gitlab-token" GitlabUserFlag = "gitlab-user" GitlabWebhookSecretFlag = "gitlab-webhook-secret" // nolint: gosec IncludeGitUntrackedFiles = "include-git-untracked-files" APISecretFlag = "api-secret" HidePrevPlanComments = "hide-prev-plan-comments" QuietPolicyChecks = "quiet-policy-checks" LockingDBType = "locking-db-type" LogLevelFlag = "log-level" MarkdownTemplateOverridesDirFlag = "markdown-template-overrides-dir" ParallelPoolSize = "parallel-pool-size" StatsNamespace = "stats-namespace" AllowDraftPRs = "allow-draft-prs" PortFlag = "port" RedisDB = "redis-db" RedisHost = "redis-host" RedisPassword = "redis-password" RedisPort = "redis-port" RedisTLSEnabled = "redis-tls-enabled" RedisInsecureSkipVerify = "redis-insecure-skip-verify" RepoConfigFlag = "repo-config" RepoConfigJSONFlag = "repo-config-json" RepoAllowlistFlag = "repo-allowlist" RequireApprovalFlag = "require-approval" RequireMergeableFlag = "require-mergeable" SilenceNoProjectsFlag = "silence-no-projects" SilenceForkPRErrorsFlag = "silence-fork-pr-errors" SilenceVCSStatusNoPlans = "silence-vcs-status-no-plans" SilenceAllowlistErrorsFlag = "silence-allowlist-errors" SkipCloneNoChanges = "skip-clone-no-changes" SlackTokenFlag = "slack-token" SSLCertFileFlag = "ssl-cert-file" SSLKeyFileFlag = "ssl-key-file" RestrictFileList = "restrict-file-list" TFDownloadFlag = "tf-download" TFDownloadURLFlag = "tf-download-url" UseTFPluginCache = "use-tf-plugin-cache" VarFileAllowlistFlag = "var-file-allowlist" VCSStatusName = "vcs-status-name" TFEHostnameFlag = "tfe-hostname" TFELocalExecutionModeFlag = "tfe-local-execution-mode" TFETokenFlag = "tfe-token" WriteGitCredsFlag = "write-git-creds" // nolint: gosec WebBasicAuthFlag = "web-basic-auth" WebUsernameFlag = "web-username" WebPasswordFlag = "web-password" WebsocketCheckOrigin = "websocket-check-origin" // NOTE: Must manually set these as defaults in the setDefaults function. DefaultADBasicUser = "" DefaultADBasicPassword = "" DefaultADHostname = "dev.azure.com" DefaultAutoDiscoverMode = "auto" DefaultAutoplanFileList = "**/*.tf,**/*.tfvars,**/*.tfvars.json,**/terragrunt.hcl,**/.terraform.lock.hcl" DefaultAllowCommands = "version,plan,apply,unlock,approve_policies" DefaultCheckoutStrategy = CheckoutStrategyBranch DefaultCheckoutDepth = 0 DefaultBitbucketBaseURL = bitbucketcloud.BaseURL DefaultDataDir = "~/.atlantis" DefaultEmojiReaction = "eyes" DefaultExecutableName = "atlantis" DefaultMarkdownTemplateOverridesDir = "~/.markdown_templates" DefaultGHHostname = "github.com" DefaultGitlabHostname = "gitlab.com" DefaultLockingDBType = "boltdb" DefaultLogLevel = "info" DefaultParallelPoolSize = 15 DefaultStatsNamespace = "atlantis" DefaultPort = 4141 DefaultRedisDB = 0 DefaultRedisPort = 6379 DefaultRedisTLSEnabled = false DefaultRedisInsecureSkipVerify = false DefaultTFDownloadURL = "https://releases.hashicorp.com" DefaultTFDownload = true DefaultTFEHostname = "app.terraform.io" DefaultVCSStatusName = "atlantis" DefaultWebBasicAuth = false DefaultWebUsername = "atlantis" DefaultWebPassword = "atlantis" )
To add a new flag you must: 1. Add a const with the flag name (in alphabetic order). 2. Add a new field to server.UserConfig and set the mapstructure tag equal to the flag name. 3. Add your flag's description etc. to the stringFlags, intFlags, or boolFlags slices.
Variables ¶
var RootCmd = &cobra.Command{
Use: "atlantis",
Short: "Terraform Pull Request Automation",
}
RootCmd is the base command onto which all other commands are added.
var ValidLogLevels = []string{"debug", "info", "warn", "error"}
ValidLogLevels are the valid log levels that can be set
Functions ¶
Types ¶
type DefaultServerCreator ¶ added in v0.1.3
type DefaultServerCreator struct{}
DefaultServerCreator is the concrete implementation of ServerCreator.
func (*DefaultServerCreator) NewServer ¶ added in v0.1.3
func (d *DefaultServerCreator) NewServer(userConfig server.UserConfig, config server.Config) (ServerStarter, error)
NewServer returns the real Atlantis server object.
type ServerCmd ¶ added in v0.1.3
type ServerCmd struct { ServerCreator ServerCreator Viper *viper.Viper // SilenceOutput set to true means nothing gets printed. // Useful for testing to keep the logs clean. SilenceOutput bool AtlantisVersion string Logger logging.SimpleLogging }
ServerCmd is an abstraction that helps us test. It allows us to mock out starting the actual server.
type ServerCreator ¶ added in v0.1.3
type ServerCreator interface {
NewServer(userConfig server.UserConfig, config server.Config) (ServerStarter, error)
}
ServerCreator creates servers. It's an abstraction to help us test.
type ServerStarter ¶ added in v0.1.3
type ServerStarter interface {
Start() error
}
ServerStarter is for starting up a server. It's an abstraction to help us test.
type TestdriveCmd ¶ added in v0.3.10
type TestdriveCmd struct{}
TestdriveCmd starts the testdrive process for testing out Atlantis.
func (*TestdriveCmd) Init ¶ added in v0.3.10
func (b *TestdriveCmd) Init() *cobra.Command
Init returns the runnable cobra command.
type VersionCmd ¶ added in v0.1.3
type VersionCmd struct {
AtlantisVersion string
}
VersionCmd prints the current version.
func (*VersionCmd) Init ¶ added in v0.1.3
func (v *VersionCmd) Init() *cobra.Command
Init returns the runnable cobra command.