2024-01-30 16:42:56 +01:00
|
|
|
package db_lib
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/ansible-semaphore/semaphore/db"
|
2024-04-12 12:32:54 +02:00
|
|
|
"github.com/ansible-semaphore/semaphore/pkg/task_logger"
|
2024-01-30 16:42:56 +01:00
|
|
|
)
|
|
|
|
|
2024-04-12 12:32:54 +02:00
|
|
|
func CreateApp(template db.Template, repository db.Repository, logger task_logger.Logger) LocalApp {
|
2024-01-30 16:42:56 +01:00
|
|
|
switch template.App {
|
|
|
|
case db.TemplateAnsible:
|
|
|
|
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,
|
2024-02-05 21:55:09 +01:00
|
|
|
Logger: logger,
|
2024-01-30 16:42:56 +01:00
|
|
|
},
|
|
|
|
}
|
2024-06-12 21:53:00 +02:00
|
|
|
case db.TemplateTerraform:
|
|
|
|
return &TerraformApp{
|
|
|
|
Template: template,
|
|
|
|
Repository: repository,
|
|
|
|
Logger: logger,
|
|
|
|
Name: TerraformAppTerraform,
|
|
|
|
}
|
|
|
|
case db.TemplateTofu:
|
|
|
|
return &TerraformApp{
|
|
|
|
Template: template,
|
|
|
|
Repository: repository,
|
|
|
|
Logger: logger,
|
|
|
|
Name: TerraformAppTofu,
|
|
|
|
}
|
|
|
|
case db.TemplateBash:
|
|
|
|
return &BashApp{
|
|
|
|
Template: template,
|
|
|
|
Repository: repository,
|
|
|
|
Logger: logger,
|
|
|
|
}
|
2024-01-30 16:42:56 +01:00
|
|
|
default:
|
|
|
|
panic("unknown app")
|
|
|
|
}
|
|
|
|
}
|