deploy

package
v0.0.0-...-059d9f2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: MIT Imports: 42 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DeployURL = "https://console.azion.com"
	ScriptID  = "17ac912d-5ce9-4806-9fa7-480779e43f58"
)

Variables

View Source
var ResponseMap map[string]string
View Source
var (
	Retries int64
)

Functions

func CleanupZipFiles

func CleanupZipFiles() error

func CreateZipsFromFileInfos

func CreateZipsFromFileInfos(fileInfos []FileInfo) ([]string, error)

CreateZipsFromFileInfos creates ZIP files in batches from FileInfo slices This function opens files in batches to avoid "too many open files" error

func CreateZipsInBatches

func CreateZipsInBatches(files []contracts.FileOps) ([]string, error)

func InitTimingSummary

func InitTimingSummary()

InitTimingSummary initializes the global timing summary

func NewCmd

func NewCmd(f *cmdutil.Factory) *cobra.Command

func NewCobraCmd

func NewCobraCmd(deploy *DeployCmd) *cobra.Command

func NewV6Cmd

func NewV6Cmd(f *cmdutil.Factory) *cobra.Command

NewV6Cmd is `azion deploy` for API v6 accounts: the v6 pipeline with --local or --dry-run, and otherwise the same remote deploy as v4, on the same script runner script.

func ReadAllFiles

func ReadAllFiles(pathStatic string, cmd *DeployCmd) ([]contracts.FileOps, error)

ReadAllFiles is kept for backward compatibility but now processes files in batches

func ReadZip

func ReadZip() ([]contracts.FileOps, error)

func TimeAPICall

func TimeAPICall(name string, fn func() error) error

TimeAPICall is a helper function to time an API call and record it

func TimeAPICallWithResult

func TimeAPICallWithResult[T any](name string, fn func() (T, error)) (T, error)

TimeAPICallWithResult is a helper function to time an API call that returns a result and record it

func Worker

func Worker(jobs <-chan contracts.FileOps, results chan<- error, currentFile *int64, clientUpload aws.Config, bucket, prefix string)

worker reads the range of jobs and uploads the file, if there is an error during upload, we returning it through the results channel

Types

type APICallTiming

type APICallTiming struct {
	Name     string
	Duration time.Duration
}

APICallTiming holds timing information for individual API calls

type DeployCmd

type DeployCmd struct {
	Io                    *iostreams.IOStreams
	GetWorkDir            func() (string, error)
	FileReader            func(path string) ([]byte, error)
	WriteFile             func(filename string, data []byte, perm fs.FileMode) error
	GetAzionJsonContent   func(pathConfig string) (*contracts.AzionApplicationOptions, error)
	WriteAzionJsonContent func(conf *contracts.AzionApplicationOptions, confConf string) error
	WriteAzionConfig      func(conf *contracts.AzionConfig) error
	BuildCmd              func(f *cmdutil.Factory) *build.BuildCmd
	Open                  func(name string) (*os.File, error)
	FilepathWalk          func(root string, fn filepath.WalkFunc) error
	F                     *cmdutil.Factory
	Unmarshal             func(data []byte, v interface{}) error
	Interpreter           func() *manifestInt.ManifestInterpreter
	VersionID             func() string
	CallScript            func(token string, id string, secret string, prefix string, name, confDir string, cmd *DeployCmd) (string, error)
	OpenBrowser           func(f *cmdutil.Factory, urlConsoleDeploy string, cmd *DeployCmd) error
	CaptureLogs           func(execId string, token string, cmd *DeployCmd) error
	CheckToken            func(f *cmdutil.Factory) error
	ReadSettings          func(path string) (token.Settings, error)
	UploadFiles           func(f *cmdutil.Factory, conf *contracts.AzionApplicationOptions, msgs *[]string, pathStatic, bucket string, cmd *DeployCmd, settings token.Settings) error
	OpenBrowserFunc       func(input string) error
	// SaveResult stores what the script runner's deploy returns (azion.json
	// and azion.config); DeployedURL reads the URL to show once it is saved.
	// Nil means the v4 format (saveResultV4, deployedURLV4); the v6 deploy
	// sets its own, since its azion.json has another format.
	SaveResult    func(body []byte, cmd *DeployCmd) error
	DeployedURL   func(cmd *DeployCmd) (url, workloadDomain string, err error)
	Auto          bool
	DryRun        bool
	Env           string
	Local         bool
	NoPrompt      bool
	Path          string
	ProjectConf   string
	SkipBuild     bool
	SkipFramework bool
	Sync          bool
	Workers       int
	AliasEnv      bool
	ConfigFile    string
	WriteBucket   bool
	Logs          contracts.Logs
	Result        contracts.ResultsV4
}

func NewDeployCmd

func NewDeployCmd(f *cmdutil.Factory) *DeployCmd

func (*DeployCmd) ExternalRun

func (cmd *DeployCmd) ExternalRun(f *cmdutil.Factory, configPath string, sync, local, skipFramework, aliasEnv bool) error

func (*DeployCmd) Run

func (cmd *DeployCmd) Run(f *cmdutil.Factory) error

type ExternalDeployer

type ExternalDeployer interface {
	ExternalRun(f *cmdutil.Factory, configPath string, sync, local, skipFramework, aliasEnv bool) error
}

ExternalDeployer is the deploy init and link start when the user asks to deploy right away.

func NewExternalDeployer

func NewExternalDeployer(f *cmdutil.Factory) ExternalDeployer

NewExternalDeployer picks the deploy for the account's API generation, so a v6 account never runs the v4 pipeline from init or link.

type FileInfo

type FileInfo struct {
	Path         string
	AbsolutePath string
	MimeType     string
	Size         int64
}

FileInfo represents a file's metadata without the file handle

func CollectFileInfos

func CollectFileInfos(pathStatic string, cmd *DeployCmd) ([]FileInfo, error)

CollectFileInfos walks the directory and collects file metadata without opening files

type Response

type Response struct {
	UUID  string    `json:"uuid"`
	Image string    `json:"image"`
	Start time.Time `json:"start"`
}

Response represents the structure of the response from the API.

type TimingSummary

type TimingSummary struct {
	TotalDeployTime  time.Duration
	BucketCreateTime time.Duration
	CredentialsTime  time.Duration
	UploadFilesTime  time.Duration
	ScriptCallTime   time.Duration
	LogsCaptureTime  time.Duration
	APICallTimes     []APICallTiming
	// contains filtered or unexported fields
}

TimingSummary holds the timing information for each phase of the deploy process

var GlobalTimingSummary *TimingSummary

GlobalTimingSummary is the global timing summary for the deploy process

func (*TimingSummary) AddAPICallTime

func (ts *TimingSummary) AddAPICallTime(name string, duration time.Duration)

AddAPICallTime adds an API call timing to the summary

func (*TimingSummary) GetTotalTime

func (ts *TimingSummary) GetTotalTime() time.Duration

GetTotalTime returns the total deploy time

func (*TimingSummary) PrintSummary

func (ts *TimingSummary) PrintSummary()

PrintSummary prints the timing summary in debug format

Directories

Path Synopsis
Package deploy is `azion deploy` for API v6 accounts.
Package deploy is `azion deploy` for API v6 accounts.

Jump to

Keyboard shortcuts

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