Documentation ¶
Index ¶
Constants ¶
View Source
const ( PublicAutomatedTestingRepoURL = "https://github.com/yorinasub17/packer-plugin-git-shell-automated-testing.git" PrivateAutomatedTestingRepoURL = "https://github.com/yorinasub17/packer-plugin-git-shell-automated-testing-private.git" TestGitTokenEnvVar = "TEST_GIT_TOKEN" TestGitUsernameEnvVar = "TEST_GIT_USERNAME" )
Variables ¶
This section is empty.
Functions ¶
func CloneAndCheckout ¶
func CloneAndCheckout(opts GitOptions, cloneDir string) error
CloneAndCheckout uses go-git to clone the configured repository at the desired ref into the given cloneDir.
Types ¶
type File ¶ added in v0.2.0
type File struct { // Path is the relative path in the git repo where the file or folder to upload is located. Path string `mapstructure:"path" required:"true"` // Destination is the path on the machine where the file or folder will be uploaded to. Destination string `mapstructure:"destination" required:"true"` }
type FlatFile ¶ added in v0.2.0
type FlatFile struct { Path *string `mapstructure:"path" required:"true" cty:"path" hcl:"path"` Destination *string `mapstructure:"destination" required:"true" cty:"destination" hcl:"destination"` }
FlatFile is an auto-generated flat version of File. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
type FlatScript ¶
type FlatScript struct { Path *string `mapstructure:"path" required:"true" cty:"path" hcl:"path"` Args []string `mapstructure:"args" cty:"args" hcl:"args"` EnvironmentVars []string `mapstructure:"environment_vars" cty:"environment_vars" hcl:"environment_vars"` }
FlatScript is an auto-generated flat version of Script. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
type GitConfig ¶ added in v0.2.0
type GitConfig struct { packer_common.PackerConfig `mapstructure:",squash"` // Source is the git URL (e.g., https://github.com/yorinasub17/packer-git-shell-example.git) where the scripts are // located. Source string `mapstructure:"source" required:"true"` // Ref is the git ref to checkout when sourcing the scripts. Ref string `mapstructure:"ref" required:"true"` // UsernameEnvVar is the name of the environment variable to lookup for the username to use when authing to the git // repo. Defaults to GIT_USERNAME. UsernameEnvVar string `mapstructure:"username_env_var"` // PasswordEnvVar is the name of the environment variable to lookup for the password to use when authing to the git // repo. If unset, defaults to GIT_PASSWORD. PasswordEnvVar string `mapstructure:"password_env_var"` }
func (GitConfig) GetGitOptions ¶ added in v0.2.0
func (cfg GitConfig) GetGitOptions() GitOptions
type GitOptions ¶
type GitOptions struct { // RepoURL is the URL of the git repo to clone. RepoURL string // Ref is the git ref to checkout after cloning. Ref string // UsernameEnvVar is the name of the environment variable to lookup for the username to use when authing to the git // repo. If unset, defaults to defaultUsernameEnvVar. UsernameEnvVar string // PasswordEnvVar is the name of the environment variable to lookup for the password to use when authing to the git // repo. If unset, defaults to defaultPasswordEnvVar. PasswordEnvVar string }
GitOptions specifies the options to use when cloning a git repo and checking out a ref.
type Script ¶
type Script struct { // Path is the relative path in the git repo where the script to run is located. Path string `mapstructure:"path" required:"true"` // Args is the script args to pass when executing the script. Args []string `mapstructure:"args"` // EnvironmentVars is the list of environment variables that should be set when the script is called. Each entry is // a key=value string, setting the environment variable `key` to the given `value`. EnvironmentVars []string `mapstructure:"environment_vars"` }
type ScriptConfig ¶ added in v0.2.0
type ScriptConfig struct { // Scripts is a list of blocks that specify which scripts from the repo should be called, and with what args. The // scripts will be called in the order in which the blocks are defined. At least one script block must be defined. Scripts []Script `mapstructure:"script"` }
Click to show internal directories.
Click to hide internal directories.