test(api): restore

This commit is contained in:
samerbahri98 2024-02-07 17:45:34 +01:00
parent a9e91e224b
commit 9c0b53a216
No known key found for this signature in database
GPG Key ID: 0EFE47488753FEE6
2 changed files with 37 additions and 42 deletions

View File

@ -133,19 +133,22 @@ definitions:
ProjectBackup:
type: object
example: {"meta":{"name":"homelab","alert":true,"alert_chat":"Test","max_parallel_tasks":0},"templates":[{"inventory":"Build","repository":"Demo","environment":"Empty","name":"Build","playbook":"build.yml","arguments":"[]","allow_override_args_in_task":false,"description":"Build Job","vault_key":null,"type":"build","start_version":"1.0.0","build_template":null,"view":"Build","autorun":false,"survey_vars":"null","suppress_success_alerts":false,"cron":"* * * * *"}],"repositories":[{"name":"Demo","git_url":"https://github.com/semaphoreui/demo-project.git","git_branch":"main","ssh_key":"None"}],"keys":[{"name":"None","type":"none"},{"name":"Vault Password","type":"login_password"}],"views":[{"name":"Build","position":0}],"inventories":[{"name":"Build","inventory":"","ssh_key":"None","become_key":"None","type":"static"},{"name":"Dev","inventory":"","ssh_key":"None","become_key":"None","type":"file"},{"name":"Prod","inventory":"","ssh_key":"None","become_key":"None","type":"file"}],"environments":[{"name":"Empty","password":null,"json":"{}","env":null}]}
properties:
meta:
type: object
properties:
name:
type: string
example: demo
alert:
type: boolean
alert_chat:
type: string
type:
- string
- 'null'
max_parallel_tasks:
type: integer
minimum: 0
templates:
type: array
items:
@ -153,53 +156,50 @@ definitions:
properties:
inventory:
type: string
example: Build
repository:
type: string
example: Demo
environment:
type: string
example: Empty
view:
type: string
example: null
name:
type: string
example: Build
playbook:
type: string
example: build.yml
arguments:
type: string
example: null
type:
- string
- 'null'
description:
type: string
example: Hello, World!
allow_override_args_in_task:
type: boolean
example: false
suppress_success_alerts:
type: boolean
example: true
cron:
type: string
example: null
type:
- string
- 'null'
build_template:
type: string
example: null
type:
- string
- 'null'
autorun:
type: boolean
survey_vars:
type: string
type:
- string
- 'null'
start_version:
type: string
example: '1.0.0'
type:
- string
- 'null'
type:
type: string
example: build
vault_key:
type: string
example: null
type:
- string
- 'null'
repositories:
type: array
items:
@ -207,16 +207,12 @@ definitions:
properties:
name:
type: string
example: Demo
git_url:
type: string
example: https://github.com/semaphoreui/demo-project.git
git_branch:
type: string
example: main
ssh_key:
type: string
example: None
keys:
type: array
items:
@ -224,11 +220,9 @@ definitions:
properties:
name:
type: string
example: None
type:
type: string
enum: [ssh, login_password, none]
example: none
views:
type: array
items:
@ -236,10 +230,9 @@ definitions:
properties:
name:
type: string
example: Build
position:
type: integer
example: 0
minimum: 0
inventories:
type: array
items:
@ -247,14 +240,16 @@ definitions:
properties:
name:
type: string
example: Test
inventory:
type: string
example: ""
ssh_key:
type: string
type:
- string
- 'null'
become_key:
type: string
type:
- string
- 'null'
type:
type: string
enum: [static, static-yaml, file]
@ -265,16 +260,16 @@ definitions:
properties:
name:
type: string
example: Empty
password:
type: string
example: null
type:
- string
- 'null'
json:
type: string
example: '{}'
env:
type: string
example: null
type:
- string
- 'null'
APIToken:
type: object

View File

@ -295,7 +295,7 @@ func (backup *BackupFormat) Restore(store db.Store) (*db.Project, error) {
Name: backup.Meta.Name,
Alert: backup.Meta.Alert,
MaxParallelTasks: backup.Meta.MaxParallelTasks,
AlertChat: b.meta.AlertChat,
AlertChat: backup.Meta.AlertChat,
},
)
if err != nil {