Documentation
¶
Index ¶
- Constants
- Variables
- func CreateRevisionTagName(ctx context.Context, tag string) (string, error)
- func GetCommitHash(ctx context.Context) (string, error)
- func GetRunnerRef(ctx context.Context) (string, error)
- func Run(ctx context.Context) int
- func SetCmdOption(ctx context.Context, cmdOption *CmdOption) context.Context
- func SetDekopinCommand(ctx context.Context, cmd DekopinCommand) context.Context
- func SetGCloud(ctx context.Context, gcloud GCloud) context.Context
- func ValidateTag(tag string) error
- type CmdOption
- type DekopinCommand
- type DekopinConfig
- type DeployCommandFlags
- type GCloud
- type GetCommitHashErrorInLocal
Constants ¶
View Source
const ( RUNNER_GITHUB_ACTIONS = "github-actions" RUNNER_CLOUD_BUILD = "cloud-build" RUNNER_LOCAL = "local" ENV_GITHUB_REF = "GITHUB_REF" ENV_CLOUD_BUILD_REF = "REF_NAME" ENV_GITHUB_SHA = "GITHUB_SHA" ENV_CLOUD_BUILD_SHA = "COMMIT_SHA" )
View Source
const ( SERVICE_FULL_NAME_FORMAT = "projects/%s/locations/%s/services/%s" REVISION_FULL_NAME_FORMAT = "projects/%s/locations/%s/services/%s/revisions/%s" )
View Source
const (
COMMIT_HASH_LENGTH = 7
)
View Source
const (
CREATE_TAG_DEFAULT_REVISION = "LATEST"
)
View Source
const (
DEPLOY_DEFAULT_REVISION = "LATEST"
)
View Source
const (
SWITCH_REVISION_DEFAULT_REVISION = "LATEST"
)
View Source
const (
TIMEOUT = 120 * time.Second
)
Variables ¶
View Source
var (
ErrGetCommitHashInLocal = &GetCommitHashErrorInLocal{
Message: "failed to get commit hash in local",
}
)
View Source
var ValidRunners = []string{ RUNNER_GITHUB_ACTIONS, RUNNER_CLOUD_BUILD, RUNNER_LOCAL, }
Functions ¶
func CreateRevisionTagName ¶
func SetDekopinCommand ¶
func SetDekopinCommand(ctx context.Context, cmd DekopinCommand) context.Context
func ValidateTag ¶
Types ¶
type CmdOption ¶
func NewCmdOption ¶
type DekopinCommand ¶
type DekopinCommand interface {
GetFileByFlag() (string, error)
GetProjectByFlag() (string, error)
GetRegionByFlag() (string, error)
GetServiceByFlag() (string, error)
GetRunnerByFlag() (string, error)
GetImageByFlag() (string, error)
GetTagByFlag() (string, error)
GetRevisionByFlag() (string, error)
GetCreateTagByFlag() (bool, error)
GetRemoveTagsByFlag() (bool, error)
GetUpdateTrafficByFlag() (bool, error)
}
func GetDekopinCommand ¶
func GetDekopinCommand(ctx context.Context) (DekopinCommand, error)
func NewDekopinCommand ¶
func NewDekopinCommand(cmd *cobra.Command) DekopinCommand
type DekopinConfig ¶
type DeployCommandFlags ¶
type GCloud ¶
type GCloud interface {
CreateRevision(ctx context.Context, imageName string, commitHash string) error // Create a revision
CreateRevisionTag(ctx context.Context, revisionTag string, revisionName string) error // Assign a tag to a revision
RemoveRevisionTag(ctx context.Context, revisionTag string) error // Remove a tag from a revision
RemoveRevisionTags(ctx context.Context, revisionTags []string) error // Remove tags from a revision
Deploy(ctx context.Context, imageName string, commitHash string, useTraffic bool) error // Deploy a revision
UpdateTrafficToLatestRevision(ctx context.Context) error // Update traffic to the latest revision
UpdateTrafficToRevision(ctx context.Context, revisionName string) error // Update traffic to the specified revision
UpdateTrafficToRevisionTag(ctx context.Context, tag string) error // Update traffic to the specified tag
DeployWithTraffic(ctx context.Context, imageName string, commitHash string) error // Deploy with traffic
GetActiveRevisionTags(ctx context.Context) ([]string, error) // Get active revision tags
GetRevision(ctx context.Context, revisionName string) (*runpb.Revision, error) // Get a revision
}
type GetCommitHashErrorInLocal ¶
type GetCommitHashErrorInLocal struct {
Message string
}
func (*GetCommitHashErrorInLocal) Error ¶
func (e *GetCommitHashErrorInLocal) Error() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.