feat: unify installation model catalog
This commit is contained in:
@@ -21,6 +21,7 @@ import (
|
||||
"github.com/aritmolab/thothii/tools/tht/internal/compose"
|
||||
"github.com/aritmolab/thothii/tools/tht/internal/config"
|
||||
"github.com/aritmolab/thothii/tools/tht/internal/lifecycle"
|
||||
"github.com/aritmolab/thothii/tools/tht/internal/modelprojection"
|
||||
"github.com/aritmolab/thothii/tools/tht/internal/safeio"
|
||||
"github.com/aritmolab/thothii/tools/tht/internal/service"
|
||||
"gopkg.in/yaml.v3"
|
||||
@@ -734,6 +735,11 @@ func activeSessions(value string) (bool, error) {
|
||||
}
|
||||
|
||||
func composeStartAndVerify(ctx context.Context, installation config.Installation, runner archiveRunner) error {
|
||||
// Projections are disposable and deliberately excluded from archives. Regenerate them from
|
||||
// the restored installation catalog immediately before any service is started.
|
||||
if err := modelprojection.Generate(installation); err != nil {
|
||||
return fmt.Errorf("regenerate model projections: %w", err)
|
||||
}
|
||||
if err := runCompose(ctx, installation, runner, "start"); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -949,8 +955,6 @@ func configurationInputs(installation config.Installation) []configurationInput
|
||||
inputs := []configurationInput{
|
||||
{"configuration/installation/thothii-installation.yaml", "installation", installation.Path, false},
|
||||
{"configuration/environment/operator.env", "installation", installation.EnvFile, false},
|
||||
{"configuration/pi/models.json", "pi", filepath.Join(installation.ProjectDirectory, "deploy", "pi", "models.json"), false},
|
||||
{"configuration/pi/settings.json", "pi", filepath.Join(installation.ProjectDirectory, "deploy", "pi", "settings.json"), false},
|
||||
{"configuration/generated/current-image.yaml", "installation", installation.CurrentImageOverridePath(), true},
|
||||
}
|
||||
for index, source := range installation.Overrides {
|
||||
|
||||
@@ -143,8 +143,6 @@ func TestCreateWritesManifestLastWithConfigurationMetadataAndSevenVolumes(t *tes
|
||||
for _, path := range []string{
|
||||
"configuration/installation/thothii-installation.yaml",
|
||||
"configuration/environment/operator.env",
|
||||
"configuration/pi/models.json",
|
||||
"configuration/pi/settings.json",
|
||||
"configuration/generated/current-image.yaml",
|
||||
} {
|
||||
if _, exists := archive.files[path]; !exists {
|
||||
|
||||
@@ -276,10 +276,6 @@ func restoreFileTarget(installation config.Installation, entry ArchiveEntryMetad
|
||||
return installation.Path, nil
|
||||
case "configuration/environment/operator.env":
|
||||
return installation.EnvFile, nil
|
||||
case "configuration/pi/models.json":
|
||||
return filepath.Join(installation.ProjectDirectory, "deploy", "pi", "models.json"), nil
|
||||
case "configuration/pi/settings.json":
|
||||
return filepath.Join(installation.ProjectDirectory, "deploy", "pi", "settings.json"), nil
|
||||
case "configuration/generated/current-image.yaml":
|
||||
return installation.CurrentImageOverridePath(), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user