cmd

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Copyright 2017 HootSuite Media Inc.

Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.

Copyright 2017 HootSuite Media Inc.

Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.

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

Copyright 2017 HootSuite Media Inc.

Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.

Copyright 2017 HootSuite Media Inc.

Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.

Copyright 2017 HootSuite Media Inc.

Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Modified hereafter by contributors to runatlantis/atlantis.

Index

Constants

View Source
const (
	// Flag names.
	AtlantisURLFlag     = "atlantis-url"
	AllowForkPRsFlag    = "allow-fork-prs"
	ConfigFlag          = "config"
	DataDirFlag         = "data-dir"
	GHHostnameFlag      = "gh-hostname"
	GHTokenFlag         = "gh-token"
	GHUserFlag          = "gh-user"
	GHWebHookSecret     = "gh-webhook-secret" // nolint: gas
	GitlabHostnameFlag  = "gitlab-hostname"
	GitlabTokenFlag     = "gitlab-token"
	GitlabUserFlag      = "gitlab-user"
	GitlabWebHookSecret = "gitlab-webhook-secret"
	LogLevelFlag        = "log-level"
	PortFlag            = "port"
	RepoWhitelistFlag   = "repo-whitelist"
	RequireApprovalFlag = "require-approval"
	SSLCertFileFlag     = "ssl-cert-file"
	SSLKeyFileFlag      = "ssl-key-file"

	// Flag defaults.
	DefaultDataDir        = "~/.atlantis"
	DefaultGHHostname     = "github.com"
	DefaultGitlabHostname = "gitlab.com"
	DefaultLogLevel       = "info"
	DefaultPort           = 4141
)

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.

View Source
const RedTermEnd = "\033[39m"
View Source
const RedTermStart = "\033[31m"

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "atlantis",
	Short: "A unified workflow for collaborating on Terraform through GitHub and GitLab",
}

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

Functions

func Execute

func Execute()

Execute starts RootCmd.

Types

type BootstrapCmd added in v0.1.3

type BootstrapCmd struct{}

BootstrapCmd starts the bootstrap process for testing out Atlantis.

func (*BootstrapCmd) Init added in v0.1.3

func (b *BootstrapCmd) Init() *cobra.Command

Init returns the runnable cobra command.

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
}

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 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