mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-21 17:01:04 +01:00
fix: provide app for demo project templates
This commit is contained in:
parent
faa71a0913
commit
bb748cb480
@ -136,7 +136,7 @@ func resolveCapability(caps []string, resolved []string, uid string) {
|
||||
AllowOverrideArgsInTask: false,
|
||||
Description: &desc,
|
||||
ViewID: &view.ID,
|
||||
App: db.TemplateAnsible,
|
||||
App: db.AppAnsible,
|
||||
})
|
||||
|
||||
printError(err)
|
||||
|
@ -114,6 +114,7 @@ func createDemoProject(projectID int, noneKeyID int, emptyEnvID int, store db.St
|
||||
InventoryID: &prodInv.ID,
|
||||
EnvironmentID: &emptyEnvID,
|
||||
RepositoryID: demoRepo.ID,
|
||||
App: db.AppAnsible,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
@ -132,6 +133,7 @@ func createDemoProject(projectID int, noneKeyID int, emptyEnvID int, store db.St
|
||||
EnvironmentID: &emptyEnvID,
|
||||
RepositoryID: demoRepo.ID,
|
||||
StartVersion: &startVersion,
|
||||
App: db.AppAnsible,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
@ -149,6 +151,7 @@ func createDemoProject(projectID int, noneKeyID int, emptyEnvID int, store db.St
|
||||
BuildTemplateID: &buildTpl.ID,
|
||||
Autorun: true,
|
||||
VaultKeyID: &vaultKey.ID,
|
||||
App: db.AppAnsible,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
@ -165,6 +168,7 @@ func createDemoProject(projectID int, noneKeyID int, emptyEnvID int, store db.St
|
||||
RepositoryID: demoRepo.ID,
|
||||
BuildTemplateID: &buildTpl.ID,
|
||||
VaultKeyID: &vaultKey.ID,
|
||||
App: db.AppAnsible,
|
||||
})
|
||||
|
||||
return
|
||||
|
@ -15,17 +15,17 @@ const (
|
||||
type TemplateApp string
|
||||
|
||||
const (
|
||||
TemplateAnsible TemplateApp = "ansible"
|
||||
TemplateTerraform TemplateApp = "terraform"
|
||||
TemplateTofu TemplateApp = "tofu"
|
||||
TemplateBash TemplateApp = "bash"
|
||||
TemplatePowerShell TemplateApp = "powershell"
|
||||
TemplatePython TemplateApp = "python"
|
||||
TemplatePulumi TemplateApp = "pulumi"
|
||||
AppAnsible TemplateApp = "ansible"
|
||||
AppTerraform TemplateApp = "terraform"
|
||||
AppTofu TemplateApp = "tofu"
|
||||
AppBash TemplateApp = "bash"
|
||||
AppPowerShell TemplateApp = "powershell"
|
||||
AppPython TemplateApp = "python"
|
||||
AppPulumi TemplateApp = "pulumi"
|
||||
)
|
||||
|
||||
func (t TemplateApp) IsTerraform() bool {
|
||||
return t == TemplateTerraform || t == TemplateTofu
|
||||
return t == AppTerraform || t == AppTofu
|
||||
}
|
||||
|
||||
type SurveyVarType string
|
||||
@ -104,7 +104,7 @@ type Template struct {
|
||||
|
||||
func (tpl *Template) Validate() error {
|
||||
switch tpl.App {
|
||||
case TemplateAnsible:
|
||||
case AppAnsible:
|
||||
if tpl.InventoryID == nil {
|
||||
return &ValidationError{"template inventory can not be empty"}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
|
||||
func CreateApp(template db.Template, repository db.Repository, logger task_logger.Logger) LocalApp {
|
||||
switch template.App {
|
||||
case db.TemplateAnsible:
|
||||
case db.AppAnsible:
|
||||
return &AnsibleApp{
|
||||
Template: template,
|
||||
Repository: repository,
|
||||
@ -18,7 +18,7 @@ func CreateApp(template db.Template, repository db.Repository, logger task_logge
|
||||
Logger: logger,
|
||||
},
|
||||
}
|
||||
case db.TemplateTerraform, db.TemplateTofu:
|
||||
case db.AppTerraform, db.AppTofu:
|
||||
return &TerraformApp{
|
||||
Template: template,
|
||||
Repository: repository,
|
||||
|
@ -83,11 +83,11 @@ func (t *ShellApp) makeShellCmd(args []string, environmentVars *[]string) *exec.
|
||||
var command string
|
||||
var appArgs []string
|
||||
switch t.App {
|
||||
case db.TemplateBash:
|
||||
case db.AppBash:
|
||||
command = "bash"
|
||||
case db.TemplatePython:
|
||||
case db.AppPython:
|
||||
command = "python3"
|
||||
case db.TemplatePowerShell:
|
||||
case db.AppPowerShell:
|
||||
command = "powershell"
|
||||
appArgs = []string{"-File"}
|
||||
default:
|
||||
|
@ -374,9 +374,9 @@ func (t *LocalJob) Run(username string, incomingVersion *string) (err error) {
|
||||
var inputs map[string]string
|
||||
|
||||
switch t.Template.App {
|
||||
case db.TemplateAnsible:
|
||||
case db.AppAnsible:
|
||||
args, inputs, err = t.getPlaybookArgs(username, incomingVersion)
|
||||
case db.TemplateTerraform, db.TemplateTofu:
|
||||
case db.AppTerraform, db.AppTofu:
|
||||
args, err = t.getTerraformArgs(username, incomingVersion)
|
||||
default:
|
||||
args, err = t.getShellArgs(username, incomingVersion)
|
||||
|
@ -63,11 +63,9 @@
|
||||
color="primary"
|
||||
class="mr-1 pr-2"
|
||||
v-if="can(USER_PERMISSIONS.manageProjectResources)"
|
||||
@click="appsMixin.activeAppIds.length > 0 || editItem('new')"
|
||||
>
|
||||
{{ $t('newTemplate') }}
|
||||
<v-icon v-if="appsMixin.activeAppIds.length > 0">mdi-chevron-down</v-icon>
|
||||
<span v-else class="pl-2"></span>
|
||||
<v-icon>mdi-chevron-down</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-list>
|
||||
|
Loading…
Reference in New Issue
Block a user