cmd

package
v0.19.6 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: Apache-2.0 Imports: 18 Imported by: 21

Documentation

Overview

Package cmd provides all CLI commands. NOTE: These are different from the commands that get run via pull request comments.

Index

Constants

View Source
const (
	// Flag names.
	ADWebhookPasswordFlag      = "azuredevops-webhook-password" // nolint: gosec
	ADWebhookUserFlag          = "azuredevops-webhook-user"
	ADTokenFlag                = "azuredevops-token" // nolint: gosec
	ADUserFlag                 = "azuredevops-user"
	ADHostnameFlag             = "azuredevops-hostname"
	AllowForkPRsFlag           = "allow-fork-prs"
	AllowRepoConfigFlag        = "allow-repo-config"
	AtlantisURLFlag            = "atlantis-url"
	AutomergeFlag              = "automerge"
	AutoplanFileListFlag       = "autoplan-file-list"
	BitbucketBaseURLFlag       = "bitbucket-base-url"
	BitbucketTokenFlag         = "bitbucket-token"
	BitbucketUserFlag          = "bitbucket-user"
	BitbucketWebhookSecretFlag = "bitbucket-webhook-secret"
	ConfigFlag                 = "config"
	CheckoutStrategyFlag       = "checkout-strategy"
	DataDirFlag                = "data-dir"
	DefaultTFVersionFlag       = "default-tf-version"
	DisableApplyAllFlag        = "disable-apply-all"
	DisableApplyFlag           = "disable-apply"
	DisableAutoplanFlag        = "disable-autoplan"
	DisableMarkdownFoldingFlag = "disable-markdown-folding"
	DisableRepoLockingFlag     = "disable-repo-locking"
	EnablePolicyChecksFlag     = "enable-policy-checks"
	EnableRegExpCmdFlag        = "enable-regexp-cmd"
	EnableDiffMarkdownFormat   = "enable-diff-markdown-format"
	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
	GitlabHostnameFlag         = "gitlab-hostname"
	GitlabTokenFlag            = "gitlab-token"
	GitlabUserFlag             = "gitlab-user"
	GitlabWebhookSecretFlag    = "gitlab-webhook-secret" // nolint: gosec
	HidePrevPlanComments       = "hide-prev-plan-comments"
	LogLevelFlag               = "log-level"
	ParallelPoolSize           = "parallel-pool-size"
	StatsNamespace             = "stats-namespace"
	AllowDraftPRs              = "allow-draft-prs"
	PortFlag                   = "port"
	RepoConfigFlag             = "repo-config"
	RepoConfigJSONFlag         = "repo-config-json"
	// RepoWhitelistFlag is deprecated for RepoAllowlistFlag.
	RepoWhitelistFlag          = "repo-whitelist"
	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"
	// SilenceWhitelistErrorsFlag is deprecated for SilenceAllowlistErrorsFlag.
	SilenceWhitelistErrorsFlag = "silence-whitelist-errors"
	SkipCloneNoChanges         = "skip-clone-no-changes"
	SlackTokenFlag             = "slack-token"
	SSLCertFileFlag            = "ssl-cert-file"
	SSLKeyFileFlag             = "ssl-key-file"
	TFDownloadURLFlag          = "tf-download-url"
	VarFileAllowlistFlag       = "var-file-allowlist"
	VCSStatusName              = "vcs-status-name"
	TFEHostnameFlag            = "tfe-hostname"
	TFETokenFlag               = "tfe-token"
	WriteGitCredsFlag          = "write-git-creds"
	WebBasicAuthFlag           = "web-basic-auth"
	WebUsernameFlag            = "web-username"
	WebPasswordFlag            = "web-password"

	// NOTE: Must manually set these as defaults in the setDefaults function.
	DefaultADBasicUser      = ""
	DefaultADBasicPassword  = ""
	DefaultADHostname       = "dev.azure.com"
	DefaultAutoplanFileList = "**/*.tf,**/*.tfvars,**/*.tfvars.json,**/terragrunt.hcl,**/.terraform.lock.hcl"
	DefaultCheckoutStrategy = "branch"
	DefaultBitbucketBaseURL = bitbucketcloud.BaseURL
	DefaultDataDir          = "~/.atlantis"
	DefaultGHHostname       = "github.com"
	DefaultGitlabHostname   = "gitlab.com"
	DefaultLogLevel         = "info"
	DefaultParallelPoolSize = 15
	DefaultStatsNamespace   = "atlantis"
	DefaultPort             = 4141
	DefaultTFDownloadURL    = "https://releases.hashicorp.com"
	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

View Source
var RootCmd = &cobra.Command{
	Use:   "atlantis",
	Short: "Terraform Pull Request Automation",
}

RootCmd is the base command onto which all other commands are added.

View Source
var ValidLogLevels = []string{"debug", "info", "warn", "error"}

ValidLogLevels are the valid log levels that can be set

Functions

func Execute

func Execute()

Execute starts RootCmd.

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.

func (*ServerCmd) Init added in v0.1.3

func (s *ServerCmd) Init() *cobra.Command

Init returns the runnable cobra command.

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.

Jump to

Keyboard shortcuts

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