Semaphore/db_lib/AppFactory.go

38 lines
851 B
Go
Raw Permalink Normal View History

2024-01-30 16:42:56 +01:00
package db_lib
import (
"github.com/semaphoreui/semaphore/db"
"github.com/semaphoreui/semaphore/pkg/task_logger"
2024-01-30 16:42:56 +01:00
)
2024-07-17 17:29:12 +02:00
func CreateApp(template db.Template, repository db.Repository, inventory db.Inventory, logger task_logger.Logger) LocalApp {
2024-01-30 16:42:56 +01:00
switch template.App {
case db.AppAnsible:
2024-01-30 16:42:56 +01:00
return &AnsibleApp{
Template: template,
Repository: repository,
2024-02-04 21:38:15 +01:00
Logger: logger,
2024-01-30 16:42:56 +01:00
Playbook: &AnsiblePlaybook{
TemplateID: template.ID,
Repository: repository,
Logger: logger,
2024-01-30 16:42:56 +01:00
},
}
case db.AppTerraform, db.AppTofu:
return &TerraformApp{
Template: template,
Repository: repository,
Logger: logger,
2024-07-17 17:29:12 +02:00
Name: string(template.App),
Inventory: inventory,
}
2024-07-10 10:12:01 +02:00
default:
2024-07-05 18:46:47 +02:00
return &ShellApp{
Template: template,
Repository: repository,
Logger: logger,
2024-07-05 18:46:47 +02:00
App: template.App,
}
2024-01-30 16:42:56 +01:00
}
}