mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-12-04 15:21:05 +01:00
feat: add destroy flag and rename env to var groups
This commit is contained in:
parent
9e6439b20f
commit
d5fc539aae
@ -15,6 +15,7 @@ type DefaultTaskParams struct {
|
||||
|
||||
type TerraformTaskParams struct {
|
||||
Plan bool `json:"plan"`
|
||||
Destroy bool `json:"destroy"`
|
||||
AutoApprove bool `json:"auto_approve"`
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,11 @@ const (
|
||||
SurveyVarEnum TemplateType = "enum"
|
||||
)
|
||||
|
||||
type TerraformTemplateParams struct {
|
||||
AllowDestroy bool `json:"allow_destroy"`
|
||||
AllowAutoApprove bool `json:"allow_auto_approve"`
|
||||
}
|
||||
|
||||
type SurveyVarEnumValue struct {
|
||||
Name string `json:"name" backup:"name"`
|
||||
Value string `json:"value" backup:"value"`
|
||||
|
@ -238,11 +238,25 @@ func (t *LocalJob) getTerraformArgs(username string, incomingVersion *string) (a
|
||||
return
|
||||
}
|
||||
|
||||
for name, value := range extraVars {
|
||||
if name == "semaphore_vars" {
|
||||
continue
|
||||
var params db.TerraformTaskParams
|
||||
err = t.Task.GetParams(¶ms)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
args = append(args, "-var", fmt.Sprintf("%s=%s", name, value))
|
||||
|
||||
if params.Destroy {
|
||||
args = append(args, "-destroy")
|
||||
}
|
||||
|
||||
for name, value := range extraVars {
|
||||
|
||||
var v []byte
|
||||
v, err = json.Marshal(value)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
args = append(args, "-var", fmt.Sprintf("%s=%s", name, v))
|
||||
}
|
||||
|
||||
for _, secret := range t.Environment.Secrets {
|
||||
|
@ -20,8 +20,15 @@
|
||||
class="mb-4"
|
||||
></v-text-field>
|
||||
|
||||
<v-tabs grow v-model="tab">
|
||||
<v-tab key="variables">Variables</v-tab>
|
||||
<v-tab key="secrets">Secrets</v-tab>
|
||||
</v-tabs>
|
||||
|
||||
<v-tabs-items v-model="tab">
|
||||
<v-tab-item key="variables">
|
||||
<v-subheader class="px-0">
|
||||
<v-icon class="mr-1">mdi-variable</v-icon> {{ $t('extraVariables') }}
|
||||
{{ $t('extraVariables') }}
|
||||
|
||||
<v-tooltip bottom color="black" open-delay="300" max-width="400">
|
||||
<template v-slot:activator="{ on, attrs }">
|
||||
@ -168,10 +175,12 @@
|
||||
>{{ $t('New Environment Variable') }}</v-btn>
|
||||
</div>
|
||||
</div>
|
||||
</v-tab-item>
|
||||
<v-tab-item key="secrets">
|
||||
|
||||
<div>
|
||||
<v-subheader class="px-0 mt-4">
|
||||
<v-icon class="mr-1">mdi-lock</v-icon>{{ $t('Secrets') }}
|
||||
{{ $t('Secrets') }}
|
||||
</v-subheader>
|
||||
|
||||
<v-data-table
|
||||
@ -258,6 +267,9 @@
|
||||
|
||||
</div>
|
||||
|
||||
</v-tab-item>
|
||||
</v-tabs-items>
|
||||
|
||||
</v-form>
|
||||
</template>
|
||||
|
||||
@ -342,6 +354,8 @@ export default {
|
||||
env: [],
|
||||
secrets: [],
|
||||
|
||||
tab: 'variables',
|
||||
|
||||
cmOptions: {
|
||||
tabSize: 2,
|
||||
mode: 'application/json',
|
||||
|
@ -74,7 +74,11 @@
|
||||
|
||||
<v-row>
|
||||
<v-col cols="12" md="6" class="pb-0">
|
||||
<v-card class="mb-6" :color="$vuetify.theme.dark ? '#212121' : 'white'">
|
||||
<v-card
|
||||
class="mb-6"
|
||||
:color="$vuetify.theme.dark ? '#212121' : 'white'"
|
||||
style="background: #8585850f"
|
||||
>
|
||||
<v-tabs
|
||||
fixed-tabs
|
||||
v-model="itemTypeIndex"
|
||||
|
@ -43,7 +43,7 @@ export default {
|
||||
youHaveReadonlyAccess: 'You have read-only access',
|
||||
taskTemplates: 'Task Templates',
|
||||
inventory: 'Inventory',
|
||||
environment: 'Environment Variables',
|
||||
environment: 'Variable Groups',
|
||||
keyStore: 'Key Store',
|
||||
repositories: 'Repositories',
|
||||
darkMode: 'Dark Mode',
|
||||
@ -68,10 +68,10 @@ export default {
|
||||
cancel: 'Cancel',
|
||||
noViews: 'No views',
|
||||
addView: 'Add view',
|
||||
editEnvironment: 'Edit Environment',
|
||||
deleteEnvironment: 'Delete environment',
|
||||
newEnvironment: 'New Environment',
|
||||
environmentName: 'Environment Name',
|
||||
editEnvironment: 'Edit Variable Group',
|
||||
deleteEnvironment: 'Delete variable group',
|
||||
newEnvironment: 'New Group',
|
||||
environmentName: 'Group Name',
|
||||
extraVariables: 'Extra variables',
|
||||
enterExtraVariablesJson: 'Enter extra variables JSON...',
|
||||
environmentVariables: 'Environment variables',
|
||||
@ -177,7 +177,7 @@ export default {
|
||||
exampleSiteyml: 'Example: site.yml',
|
||||
inventory2: 'Inventory *',
|
||||
repository: 'Repository',
|
||||
environment3: 'Environment *',
|
||||
environment3: 'Variable Group *',
|
||||
vaultPassword: 'Vault Password',
|
||||
vaultPassword2: 'Vault Password',
|
||||
view: 'View',
|
||||
|
Loading…
Reference in New Issue
Block a user