ci

package
v0.49.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigCIFeatureFlag = "FUNC_ENABLE_CI_CONFIG"

	PathFlag = "path"

	PlatformFlag    = "platform"
	DefaultPlatform = "github"

	DefaultGitHubWorkflowDir      = ".github/workflows"
	DefaultGitHubWorkflowFilename = "func-deploy.yaml"

	BranchFlag    = "branch"
	DefaultBranch = "main"

	WorkflowNameFlag               = "workflow-name"
	DefaultWorkflowName            = "Func Deploy"
	DefaultRemoteBuildWorkflowName = "Remote " + DefaultWorkflowName

	KubeconfigSecretNameFlag    = "kubeconfig-secret-name"
	DefaultKubeconfigSecretName = "KUBECONFIG"

	RegistryLoginUrlVariableNameFlag    = "registry-login-url-variable-name"
	DefaultRegistryLoginUrlVariableName = "REGISTRY_LOGIN_URL"

	RegistryUserVariableNameFlag    = "registry-user-variable-name"
	DefaultRegistryUserVariableName = "REGISTRY_USERNAME"

	RegistryPassSecretNameFlag    = "registry-pass-secret-name"
	DefaultRegistryPassSecretName = "REGISTRY_PASSWORD"

	RegistryUrlVariableNameFlag    = "registry-url-variable-name"
	DefaultRegistryUrlVariableName = "REGISTRY_URL"

	RegistryLoginFlag    = "registry-login"
	DefaultRegistryLogin = true

	WorkflowDispatchFlag    = "workflow-dispatch"
	DefaultWorkflowDispatch = false

	RemoteBuildFlag    = "remote"
	DefaultRemoteBuild = false

	SelfHostedRunnerFlag    = "self-hosted-runner"
	DefaultSelfHostedRunner = false

	TestStepFlag    = "test-step"
	DefaultTestStep = true

	ForceFlag    = "force"
	DefaultForce = false

	VerboseFlag    = "verbose"
	DefaultVerbose = false
)
View Source
const (
	MainLayoutPlainText = `` /* 281-byte string literal not displayed */

	RequireManyPlainText = `
  Required Secrets & Variables:
    %s
    %s
    %s
    %s
    %s
`

	RequireOnePlainText = `  Required secret:    %s
`

	PostExportManyPlainText = `
GitHub Workflow created at: %s

Create the following Secrets & Variables on github.com:
  %s
  %s
  %s
  %s
  %s
`

	PostExportOnePlainText = `
GitHub Workflow created at: %s

Create the following Secret on github.com: %s
`
)

Variables

View Source
var DefaultWorkflowWriter = &fileWriter{}

DefaultWorkflowWriter is the default implementation for writing workflow files to disk.

View Source
var ErrWorkflowExists = errors.New("existing GitHub workflow detected, overwrite using the --force option")

ErrWorkflowExists is returned when a GitHub workflow file already exists and --force is not specified.

Functions

func NewGitHubWorkflow

func NewGitHubWorkflow(conf CIConfig, messageWriter io.Writer) *githubWorkflow

func PrintConfiguration added in v0.49.0

func PrintConfiguration(w io.Writer, conf CIConfig) error

func PrintPostExportMessage added in v0.49.0

func PrintPostExportMessage(w io.Writer, conf CIConfig) error

Types

type BufferWriter added in v0.49.0

type BufferWriter struct {
	Path   string
	Buffer *bytes.Buffer
}

BufferWriter is a test double (fake) that implements WorkflowWriter by writing to an in-memory buffer instead of the filesystem.

func NewBufferWriter

func NewBufferWriter() *BufferWriter

NewBufferWriter creates a new BufferWriter test double.

func (*BufferWriter) Exist added in v0.49.0

func (bw *BufferWriter) Exist(_ string) bool

Exist is a fake implementation that returns true if the buffer has content.

func (*BufferWriter) Write added in v0.49.0

func (bw *BufferWriter) Write(path string, raw []byte) error

Write is a fake implementation that stores content in the buffer.

type CIConfig

type CIConfig struct {
	// contains filtered or unexported fields
}

CIConfig readonly configuration

func NewCIConfig

func NewCIConfig(
	fnLoader common.FunctionLoader,
	currentBranch common.CurrentBranchFunc,
	workingDir common.WorkDirFunc,
	workflowNameExplicit bool,
) (CIConfig, error)

func (CIConfig) Branch

func (cc CIConfig) Branch() string

func (CIConfig) FnBuilder added in v0.49.0

func (cc CIConfig) FnBuilder() string

func (CIConfig) FnGitHubWorkflowFilepath

func (cc CIConfig) FnGitHubWorkflowFilepath() string

func (CIConfig) FnRuntime added in v0.49.0

func (cc CIConfig) FnRuntime() string

func (CIConfig) Force added in v0.49.0

func (cc CIConfig) Force() bool

func (CIConfig) KubeconfigSecret

func (cc CIConfig) KubeconfigSecret() string

func (CIConfig) OutputPath added in v0.49.0

func (cc CIConfig) OutputPath() string

func (CIConfig) RegistryLogin added in v0.49.0

func (cc CIConfig) RegistryLogin() bool

func (CIConfig) RegistryLoginUrlVar

func (cc CIConfig) RegistryLoginUrlVar() string

func (CIConfig) RegistryPassSecret

func (cc CIConfig) RegistryPassSecret() string

func (CIConfig) RegistryUrlVar

func (cc CIConfig) RegistryUrlVar() string

func (CIConfig) RegistryUserVar

func (cc CIConfig) RegistryUserVar() string

func (CIConfig) RemoteBuild added in v0.49.0

func (cc CIConfig) RemoteBuild() bool

func (CIConfig) SelfHostedRunner added in v0.49.0

func (cc CIConfig) SelfHostedRunner() bool

func (CIConfig) TestStep added in v0.49.0

func (cc CIConfig) TestStep() bool

func (CIConfig) Verbose added in v0.49.0

func (cc CIConfig) Verbose() bool

func (CIConfig) WorkflowDispatch added in v0.49.0

func (cc CIConfig) WorkflowDispatch() bool

func (CIConfig) WorkflowName

func (cc CIConfig) WorkflowName() string

type WorkflowWriter

type WorkflowWriter interface {
	Exist(path string) bool
	Write(path string, raw []byte) error
}

WorkflowWriter defines the interface for writing workflow files.

Jump to

Keyboard shortcuts

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