feat: remote recipes

This commit is contained in:
2024-07-08 15:13:13 +02:00
parent 1a3ec7a107
commit d7a870b887
11 changed files with 107 additions and 56 deletions

View File

@ -6,7 +6,6 @@ import (
"os"
"path"
"coopcloud.tech/abra/pkg/config"
"coopcloud.tech/abra/pkg/log"
"coopcloud.tech/abra/pkg/recipe"
recipePkg "coopcloud.tech/abra/pkg/recipe"
@ -214,8 +213,7 @@ func LintComposeVersion(recipe recipe.Recipe) (bool, error) {
}
func LintEnvConfigPresent(r recipe.Recipe) (bool, error) {
r2 := recipe.Get(r.Name)
if _, err := os.Stat(r2.SampleEnvPath); !os.IsNotExist(err) {
if _, err := os.Stat(r.SampleEnvPath); !os.IsNotExist(err) {
return true, nil
}
@ -241,10 +239,9 @@ func LintAppService(recipe recipe.Recipe) (bool, error) {
// the recipe. This typically means that no domain is required to deploy and
// therefore no matching traefik deploy label will be present.
func LintTraefikEnabledSkipCondition(r recipe.Recipe) (bool, error) {
r2 := recipe.Get(r.Name)
sampleEnv, err := r2.SampleEnv()
sampleEnv, err := r.SampleEnv()
if err != nil {
return false, fmt.Errorf("Unable to discover .env.sample for %s", r2.Name)
return false, fmt.Errorf("Unable to discover .env.sample for %s", r.Name)
}
if _, ok := sampleEnv["DOMAIN"]; !ok {
@ -390,8 +387,7 @@ func LintHasPublishedVersion(recipe recipe.Recipe) (bool, error) {
}
func LintMetadataFilledIn(r recipe.Recipe) (bool, error) {
r2 := recipe.Get(r.Name)
features, category, err := recipe.GetRecipeFeaturesAndCategory(r2)
features, category, err := recipe.GetRecipeFeaturesAndCategory(r)
if err != nil {
return false, err
}
@ -431,9 +427,7 @@ func LintAbraShVendors(recipe recipe.Recipe) (bool, error) {
}
func LintHasRecipeRepo(recipe recipe.Recipe) (bool, error) {
url := fmt.Sprintf("%s/%s.git", config.REPOS_BASE_URL, recipe.Name)
res, err := http.Get(url)
res, err := http.Get(recipe.GitURL)
if err != nil {
return false, err
}