Skip to content

Commit

Permalink
Merge pull request #959 from aziontech/dev
Browse files Browse the repository at this point in the history
Deploy to Production - 2024/10/01
  • Loading branch information
PatrickMenoti authored Oct 1, 2024
2 parents d855473 + 164c1ca commit a818ad8
Show file tree
Hide file tree
Showing 26 changed files with 36 additions and 208 deletions.
1 change: 0 additions & 1 deletion messages/build/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ var (
BuildStatic = "Skipping build step. Build isn't applied to the type 'static'\n"
BuildNotNecessary = "Skipping build step. There were no changes detected in your project"
FlagTemplate = "The Edge Application's preset; Inform this flag if you wish to change the project's preset during build"
FlagMode = "The Edge Application's mode; Inform this flag if you wish to change the project's mode during build"
FlagWorker = "Indicates that the constructed code inserts its own worker expression, such as addEventListener(\"fetch\") or similar, without the need to inject a provider"
FlagPolyfill = "Use node polyfills in build"
FlagEntry = "Code entrypoint; (default: ./main.js)"
Expand Down
4 changes: 1 addition & 3 deletions messages/init/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ var (
EdgeApplicationsOutputErr = errors.New("This output-ctrl option is not available. Read the readme files found in the repository https://github.com/aziontech/azion-template and try again")

ErrorVulcanExecute = errors.New("Error executing Vulcan: %s")
ErrorModeNotSent = errors.New("You must send the --mode flag when --template is not nextjs/simple/static")
ErrorUpdatingVulcan = errors.New("Failed to update Vulcan: %s")
ErrorInstallVulcan = errors.New("Failed to install Vulcan: %s")
ErrorOpeningConfigFile = errors.New("Failed to open the config.json file. The file doesn't exist, is corrupted, or has an invalid JSON format. Verify if the file format is JSON or fix its content according to the JSON format specification at https://www.json.org/json-en.html")
Expand All @@ -21,8 +20,7 @@ var (
ErrorFailedCreatingAzionDirectory = errors.New("Failed to create the azion directory. The public's parent directory is read-only and/or isn't accessible. Change the permissions of the parent directory to read and write and/or give access to it")
ErrorDeps = errors.New("Failed to install project dependencies")
ErrorWorkingDir = errors.New("Failed to change current working directory")
ErrorModeNotFound = errors.New("No mode was found for the selected template. For more information, run the command again using the '--debug' flag. If the problem persists, contact Azion’s support")
ErrorReadingGitignore = errors.New("Failed to read your .gitignore file")
ErrorWritingGitignore = errors.New("Failed to write to your .gitignore file")
ErrorGetProjectInfo = errors.New("Failed to get project info (preset and mode)")
ErrorGetProjectInfo = errors.New("Failed to get project preset")
)
2 changes: 1 addition & 1 deletion messages/init/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (
EdgeApplicationsInitFlagNo = "Answers all yes/no interactions automatically with no"
WebAppInitContentOverridden = "This application was already configured. Do you want to override the previous configuration? <yes | no> (default: no) "
WebAppInitCmdSuccess = "Template successfully fetched and configured\n"
InitGettingTemplates = "\nGetting modes available (Some dependencies may need to be installed)\n"
InitGettingTemplates = "\nGetting presets available (Some dependencies may need to be installed)\n"
InitGettingVulcan = "\nGetting templates available\n"
InitProjectQuestion = "Your application's name: "
EdgeApplicationsInitFlagHelp = "Displays more information about the init command"
Expand Down
1 change: 0 additions & 1 deletion messages/link/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ var (
EdgeApplicationsOutputErr = errors.New("This output-ctrl option is not available. Read the readme files found in the repository https://github.com/aziontech/azion-template and try again")

ErrorVulcanExecute = errors.New("Error executing Vulcan: %s")
ErrorModeNotSent = errors.New("You must send the --mode flag when --template is not nextjs/simple/static")
ErrorUpdatingVulcan = errors.New("Failed to update Vulcan: %s")
ErrorInstallVulcan = errors.New("Failed to install Vulcan: %s")
ErrorOpeningConfigFile = errors.New("Failed to open the config.json file. The file doesn't exist, is corrupted, or has an invalid JSON format. Verify if the file format is JSON or fix its content according to the JSON format specification at https://www.json.org/json-en.html")
Expand Down
1 change: 0 additions & 1 deletion messages/link/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ var (
EdgeApplicationsLinkRunningCmd = "Running link step command:\n\n"
EdgeApplicationsLinkFlagName = "The Edge Application's name"
EdgeApplicationsLinkFlagTemplate = "The Edge Application's template"
EdgeApplicationsLinkFlagMode = "The Edge Application's mode"
WebAppLinkCmdSuccess = "Project successfully configured\n"
LinkGettingTemplates = "Getting templates available\n"
LinkProjectQuestion = "(Hit enter to accept the suggested name in parenthesis) Your application's name: "
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/edge_applications/edge_applications.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ func (c *Client) CreateDeviceGroups(ctx context.Context, req *CreateDeviceGroups
return &resp.Results, nil
}

func (c *Client) CreateRulesEngineNextApplication(ctx context.Context, applicationId int64, cacheId int64, typeLang string, mode string, authorize bool) error {
func (c *Client) CreateRulesEngineNextApplication(ctx context.Context, applicationId int64, cacheId int64, typeLang string, authorize bool) error {
logger.Debug("Create Rules Engine Next Application")

req := CreateRulesEngineRequest{}
Expand Down
1 change: 0 additions & 1 deletion pkg/cmd/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ func NewCobraCmd(build *BuildCmd) *cobra.Command {

buildCmd.Flags().BoolP("help", "h", false, msg.BuildFlagHelp)
buildCmd.Flags().StringVar(&fields.Preset, "preset", "", msg.FlagTemplate)
buildCmd.Flags().StringVar(&fields.Mode, "mode", "", msg.FlagMode)
buildCmd.Flags().StringVar(&fields.Entry, "entry", "", msg.FlagEntry)
buildCmd.Flags().StringVar(&fields.NodePolyfills, "use-node-polyfills", "", msg.FlagPolyfill)
buildCmd.Flags().StringVar(&fields.OwnWorker, "use-own-worker", "", msg.FlagWorker)
Expand Down
9 changes: 2 additions & 7 deletions pkg/cmd/build/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ func (b *BuildCmd) run(fields *contracts.BuildInfo, msgs *[]string) error {
conf.Preset = fields.Preset
}

if fields.Mode != "" {
vulcanParams += " --mode " + fields.Mode
conf.Mode = fields.Mode
}

if fields.Entry != "" {
vulcanParams += " --entry " + fields.Entry
}
Expand All @@ -43,15 +38,15 @@ func (b *BuildCmd) run(fields *contracts.BuildInfo, msgs *[]string) error {
if err != nil {
return fmt.Errorf("%w: %s", msg.ErrorPolyfills, fields.NodePolyfills)
}
vulcanParams += " --useNodePolyfills " + fields.NodePolyfills
vulcanParams += " --polyfills " + fields.NodePolyfills
}

if fields.OwnWorker != "" {
_, err := strconv.ParseBool(fields.OwnWorker)
if err != nil {
return fmt.Errorf("%w: %s", msg.ErrorWorker, fields.OwnWorker)
}
vulcanParams += " --useOwnWorker " + fields.OwnWorker
vulcanParams += " --worker " + fields.OwnWorker
}

if fields.IsFirewall {
Expand Down
4 changes: 0 additions & 4 deletions pkg/cmd/build/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ func TestBuildCmd_run(t *testing.T) {
fields: &contracts.BuildInfo{
ProjectPath: "",
Preset: "vanilla",
Mode: "compute",
Entry: "no",
NodePolyfills: "true",
OwnWorker: "true",
Expand Down Expand Up @@ -163,7 +162,6 @@ func TestBuildCmd_run(t *testing.T) {
fields: &contracts.BuildInfo{
ProjectPath: "",
Preset: "vanilla",
Mode: "compute",
Entry: "no",
NodePolyfills: "true",
OwnWorker: "true",
Expand Down Expand Up @@ -210,7 +208,6 @@ func TestBuildCmd_run(t *testing.T) {
fields: &contracts.BuildInfo{
ProjectPath: "",
Preset: "vanilla",
Mode: "compute",
Entry: "no",
NodePolyfills: "adf",
OwnWorker: "true",
Expand Down Expand Up @@ -257,7 +254,6 @@ func TestBuildCmd_run(t *testing.T) {
fields: &contracts.BuildInfo{
ProjectPath: "",
Preset: "vanilla",
Mode: "compute",
Entry: "no",
NodePolyfills: "true",
OwnWorker: "adf",
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/deploy/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ func (cmd *DeployCmd) doRulesDeploy(ctx context.Context, conf *contracts.AzionAp
}

// creates gzip and cache rules
err := client.CreateRulesEngineNextApplication(ctx, conf.Application.ID, cacheId, conf.Preset, conf.Mode, authorize)
err := client.CreateRulesEngineNextApplication(ctx, conf.Application.ID, cacheId, conf.Preset, authorize)
if err != nil {
logger.Debug("Error while creating rules engine", zap.Error(err))
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/deploy_remote/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ func (cmd *DeployCmd) doRulesDeploy(
}

// creates gzip and cache rules
err := client.CreateRulesEngineNextApplication(ctx, conf.Application.ID, cacheId, conf.Preset, conf.Mode, authorize)
err := client.CreateRulesEngineNextApplication(ctx, conf.Application.ID, cacheId, conf.Preset, authorize)
if err != nil {
logger.Debug("Error while creating rules engine", zap.Error(err))
return err
Expand Down
Loading

0 comments on commit a818ad8

Please sign in to comment.