Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix vendor pull directory creation issue #782

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions internal/exec/vendor_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,25 @@ func ReadAndProcessVendorConfigFile(
vendorConfigFile string,
) (schema.AtmosVendorConfig, bool, string, error) {
var vendorConfig schema.AtmosVendorConfig
var foundVendorConfigFile string
var vendorConfigFileExists bool

// Initialize empty sources slice
vendorConfig.Spec.Sources = []schema.AtmosVendorSource{}

var vendorConfigFileExists bool
var foundVendorConfigFile string

// Check if vendor config is specified in atmos.yaml
if cliConfig.Vendor.BasePath != "" {
if !filepath.IsAbs(cliConfig.Vendor.BasePath) {
foundVendorConfigFile = filepath.Join(cliConfig.BasePath, cliConfig.Vendor.BasePath)
} else {
foundVendorConfigFile = cliConfig.Vendor.BasePath
}

// Check if specified path exists
if !u.FileExists(foundVendorConfigFile) {
u.LogWarning(cliConfig, fmt.Sprintf("Vendor config path '%s' specified in atmos.yaml does not exist", foundVendorConfigFile))
return vendorConfig, false, "", nil
}
} else {
// Path is not defined in atmos.yaml, proceed with existing logic
var fileExists bool
Expand All @@ -152,8 +157,8 @@ func ReadAndProcessVendorConfigFile(
pathToVendorConfig := path.Join(cliConfig.BasePath, vendorConfigFile)

if !u.FileExists(pathToVendorConfig) {
vendorConfigFileExists = false
return vendorConfig, vendorConfigFileExists, "", fmt.Errorf("vendor config file or directory '%s' does not exist", pathToVendorConfig)
// Instead of returning error, return false to indicate no vendor config exists
return vendorConfig, false, "", nil
}

foundVendorConfigFile = pathToVendorConfig
Expand Down