opendevstack / ods-provisioning-app

Provisioning app, which triggers project and component provisions (including Jira / Confluence / BitBucket and OCP resource creation)
Apache License 2.0
15 stars 20 forks source link

DELETE_COMPONENTS API stores and returns project data with deleted quickstarter #702

Closed clemensutschig closed 2 years ago

clemensutschig commented 2 years ago

Describe the bug

To Reproduce Steps to reproduce the behavior:

Expected behavior The project structure returned does NOT contain the deleted quickstarter anymore (only the repo which we DO NOT delete by design)

Affected version (please complete the following information):

Log Output (ensure to remove any confidential information like tokens, project names, etc. delete_componet request:

[2021-11-24T06:00:41.707Z]     amazon-ebs: {
[2021-11-24T06:00:41.707Z]     amazon-ebs:   "projectKey" : "ODSVERIFY",
[2021-11-24T06:00:41.707Z]     amazon-ebs:   "quickstarters" : [
[2021-11-24T06:00:41.707Z]     amazon-ebs:     {
[2021-11-24T06:00:41.707Z]     amazon-ebs:       "component_type" : "docker-plain",
[2021-11-24T06:00:41.707Z]     amazon-ebs:       "component_id" : "plain"
[2021-11-24T06:00:41.707Z]     amazon-ebs:     }
[2021-11-24T06:00:41.707Z]     amazon-ebs:   ]
[2021-11-24T06:00:41.707Z]     amazon-ebs: }

result from the api call

"quickstarters":
    [{"component_type":"docker-plain","component_id":"plain",
        "git_url_ssh":"ssh://git@bitbucket.odsbox.lan:7999/odsverify/odsverify-plain.git",
        "git_url_http":"http://bitbucket.odsbox.lan:7990/scm/odsverify/odsverify-plain.git",
        "GROUP_ID":"org.opendevstack.odsverify",
        "PROJECT_ID":"odsverify",
        "PACKAGE_NAME":"org.opendevstack.odsverify.plain",
        "ODS_NAMESPACE":"ods",
        "ODS_BITBUCKET_PROJECT":"opendevstack","ODS_IMAGE_TAG":"latest","ODS_GIT_REF":"4.x"}]   
stitakis commented 2 years ago

@clemensutschig I'll take a deeper look at this, just a thought in advance, I think we should just return OK (HTTP code 200) if the process of the request was successful or otherwise an error of course. This should be enough feedback for any client.

clemensutschig commented 2 years ago

@stitakis - let me play a little... there is something wrong in our tests as well, because they should check this (and for some reason the e2e test works ..)

clemensutschig commented 2 years ago

the culprit is https://github.com/opendevstack/ods-provisioning-app/blob/master/src/main/java/org/opendevstack/provision/controller/ProjectApiController.java#L924

depending what you send via API it will remove it (hashcode!) or not.

I am still trying to figure out why our tests don't catch this

clemensutschig commented 2 years ago

Hurray - I have a fix :)

clemensutschig commented 2 years ago

@clemensutschig I'll take a deeper look at this, just a thought in advance, I think we should just return OK (HTTP code 200) if the process of the request was successful or otherwise an error of course. This should be enough feedback for any client.

I left the return structure as is, wihch is also nice for a consumer 🗡️