Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Inventory ID when creating tasks #2284

Merged
merged 3 commits into from
Aug 22, 2024
Merged

Conversation

gaoyue1989
Copy link
Contributor

see #2283

InventoryID *int `db:"inventory_id" json:"inventory_id"`

I saw that the inventory ID has been defined in the database task table, which means we can pass it in from the API, but it has not been processed in the future. I think we can override the inventory in
// get inventory
if t.Template.InventoryID != nil {
t.Inventory, err = t.pool.store.GetInventory(t.Template.ProjectID, *t.Template.InventoryID)
if err != nil {
return t.prepareError(err, "Template Inventory not found!")
}
}
to make this configuration effective

@fiftin
Copy link
Collaborator

fiftin commented Aug 18, 2024

Hi @gaoyue1989 will old scenario work if user don't provide inventory id in task?

@gaoyue1989
Copy link
Contributor Author

Hi @gaoyue1989 will old scenario work if user don't provide inventory id in task?

Hi @gaoyue1989 will old scenario work if user don't provide inventory id in task?

thinks, now the code if i don't provide inventory id in task is will be use inventory id in template,and if not find inventory id is also use inventory id in template

@fiftin
Copy link
Collaborator

fiftin commented Aug 20, 2024

@gaoyue1989 did you test it?

TestPopulateDetailsInventory is testing the Inventory id in task
TestPopulateDetailsInventory1 is testing the  Inventory id in task  is nil
@gaoyue1989
Copy link
Contributor Author

@gaoyue1989 did you test it?

企业微信截图_3d546207-ae10-4df8-bc24-a1b92fae4730

I add tow test in askRunner_test.go one is inventory id in task and one is inventory id is nil in task
and I also run the changed docker ues api test

@fiftin
Copy link
Collaborator

fiftin commented Aug 22, 2024

Thank you @gaoyue1989 !

@fiftin fiftin merged commit 53f125a into semaphoreui:develop Aug 22, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants