Skip to content

Commit

Permalink
z1396 - zerops.yml optional for certain service types (#91)
Browse files Browse the repository at this point in the history
Co-authored-by: Petra Vankova <[email protected]>
  • Loading branch information
vankovap and Petra Vankova authored Sep 1, 2022
1 parent 9762af8 commit 9b52abf
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [v0.12.6] - 2022-09-01

### Fixed
- `zerops.yml` file is optional for certain service types in `deploy` command

### Added
- Validation of `zerops.yml` file into `deploy` command

Expand Down
2 changes: 1 addition & 1 deletion src/cliAction/buildDeploy/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type RunConfig struct {
WorkingDir string
ArchiveFilePath string
VersionName string
ZeropsYamlPath *string
ZeropsYamlPath string
}

type Handler struct {
Expand Down
6 changes: 3 additions & 3 deletions src/cliAction/buildDeploy/handler_deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,16 @@ func (h *Handler) getValidConfigContent(
return nil, err
}

if config.ZeropsYamlPath != nil {
workingDir = filepath.Join(workingDir, *config.ZeropsYamlPath)
if config.ZeropsYamlPath != "" {
workingDir = filepath.Join(workingDir, config.ZeropsYamlPath)
}

zeropsYamlPath := filepath.Join(workingDir, zeropsYamlFileName)

zeropsYamlStat, err := os.Stat(zeropsYamlPath)
if err != nil {
if os.IsNotExist(err) {
if config.ZeropsYamlPath != nil {
if config.ZeropsYamlPath != "" {
return nil, errors.New(i18n.BuildDeployZeropsYamlNotFound)
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func deployCmd() *cobra.Command {
ArchiveFilePath: params.GetString(cmd, "archiveFilePath"),
WorkingDir: params.GetString(cmd, "workingDir"),
VersionName: params.GetString(cmd, "versionName"),
ZeropsYamlPath: params.GetStringP(cmd, "zeropsYamlPath"),
ZeropsYamlPath: params.GetString(cmd, "zeropsYamlPath"),
ProjectNameOrId: args[0],
ServiceStackName: args[1],
PathsForPacking: args[2:],
Expand All @@ -84,7 +84,7 @@ func deployCmd() *cobra.Command {
params.RegisterString(cmd, "workingDir", "./", i18n.BuildWorkingDir)
params.RegisterString(cmd, "archiveFilePath", "", i18n.BuildArchiveFilePath)
params.RegisterString(cmd, "versionName", "", i18n.BuildVersionName)
params.RegisterString(cmd, "zeropsYamlPath", "./", i18n.ZeropsYamlLocation)
params.RegisterString(cmd, "zeropsYamlPath", "", i18n.ZeropsYamlLocation)

cmd.Flags().BoolP("help", "h", false, helpText(i18n.DeployHelp))

Expand Down

0 comments on commit 9b52abf

Please sign in to comment.