rht-labs / labs-ci-cd

👻UNMAINTAINED - A collection of Red Hat Open Innovation Labs CI/CD components
Apache License 2.0
101 stars 70 forks source link

Delete projects before creating to ensure clean slate #174

Closed Tompage1994 closed 6 years ago

Tompage1994 commented 6 years ago

closes #108

Also probably closes #107 as well?

springdo commented 6 years ago

@makentenza - is there a nice way in OCP land to verify all content has been deleted for a given namespace?

makentenza commented 6 years ago

Not really @springdo. Apart of "oc get all" or doing custom API calls, there are still lot of content on global objects related to one particular namespace you can't directly query. Relationship for RBAC mechanism, or relations between namespace's SA and global SCCs....

AFAIR, the only way to get the info was from ETCD as normally all related namespace objects are on the same tree, but using this approach for this process is to complicate things too much I guess.

One solution we normally use for other repos is to get a ready process to delete all the objects created from a given automation, as you know perfectly which objects have been created. If you have that info stored somewhere as an inventory from the deployment, then remove these objects is much more easy.

makentenza commented 6 years ago

@springdo check this "solution", it would help

https://access.redhat.com/solutions/3340581

Tompage1994 commented 6 years ago

@makentenza I think the 'dump-projects.sh' solution may have been a bit overkill for this. @ckyriakidou thought waiting for 'oc get ' to fail may be a better solution.

springdo commented 6 years ago

@Tompage1994 - there has been a request from the team to delete the things created by CI for the labs CI/CD if the build has been succesful.... So I would suggest you replay your command string at the end of the parallel when the job has finished executing.

makentenza commented 6 years ago

@Tompage1994 As I said, oc get all will not cover any object that has been modified out from the scope of the namespace you are working on. The dump-projects.sh is an example to get all the info around one particular project, I'm not suggesting to use that here, as it takes a lot of time to get all the info, it was just an example.

My suggestion around logging all the objects created by this repository to use the info later is probably the better approach and the easiest to implement.

Tompage1994 commented 6 years ago

@springdo I have now run command at the end as well to cover what you mentioned.

@makentenza myself and Donal discussed this earlier and decided it possibly wasn't a problem if images etc. still exist due to the fact that if the image wont have changed then it doesn't matter if it pulls it... if it should have changed then it will build from scratch anyway. Not sure if there would be any unintended side-effects though?

springdo commented 6 years ago

@Tompage1994 - I cannot run this through our CI-CD to test it cuz of the weird setup we have for pulling branches and the robot etc. I'll add you as a contributor to the repo; can you add your code to a branch there and PR again please?

Tompage1994 commented 6 years ago

Closing due to #181