CentOS / container-pipeline-service

Code, infrastructure and deployment backend for the CentOS Container Pipeline backing up build system for registry.centos.org
https://registry.centos.org
GNU General Public License v3.0
49 stars 27 forks source link

Gracefully delete the buildConfigs while removing stale projects #641

Closed navidshaikh closed 6 years ago

navidshaikh commented 6 years ago

Index reader identifies stale projects and deletes the respective buildConfigs. We were deleting all the buildConfigs without grace period between deleting all the buildConfigs in identified stale projects list, which could result into inconsistencies in the console view of the Projects. The projects deleted could still show up on the console.

In order to avoid this, we have added 5 seconds delay in between deleting the stale projects. After deleting each buildConfig from the list of stale buildConfigs, index reader sleeps for 5 seconds.

Also added --ignore-not-found=true --now=true --include-uninitialized=true flags.

navidshaikh commented 6 years ago

After updating the oc delete command as in the PR,

excerpts from the seed-job logs

List of stale projects:
wscan-dharmit-beanstalkd-latest
dharmit-golang-1.8
wscan-dharmit-dotnet20-latest
wscan-devcloud-wget-latest
wscan-dharmit-base-latest
dharmit-python-2.7
dharmit-base-latest
dharmit-beanstalkd-latest
wscan-dharmit-python-2.7
wscan-dharmit-golang-1.8
devcloud-wget-latest
dharmit-dotnet20-latest
wscan-dharmit-python-3.5
dharmit-python-3.5
Deleting buildConfig wscan-dharmit-beanstalkd-latest
Deleting buildConfig dharmit-golang-1.8
Deleting buildConfig wscan-dharmit-dotnet20-latest
Deleting buildConfig wscan-devcloud-wget-latest
Deleting buildConfig wscan-dharmit-base-latest
Deleting buildConfig dharmit-python-2.7
Deleting buildConfig dharmit-base-latest
Deleting buildConfig dharmit-beanstalkd-latest
Deleting buildConfig wscan-dharmit-python-2.7
Deleting buildConfig wscan-dharmit-golang-1.8
Deleting buildConfig devcloud-wget-latest
Deleting buildConfig dharmit-dotnet20-latest
Deleting buildConfig wscan-dharmit-python-3.5
Deleting buildConfig dharmit-python-3.5

and listing of bc showing the desired projects (and not the ones deleted above)

oc get bc
NAME                                       TYPE              FROM               LATEST
centos-passenger-40-centos7-latest         JenkinsPipeline   Git@master         1
centos-php-71-centos7-latest               JenkinsPipeline   Git@master         1
centos-python-27-centos7-latest            JenkinsPipeline   Git@master         1
centos-ruby-24-centos7-latest              JenkinsPipeline   Git@master         1
nshaikh-build-fail-test-latest             JenkinsPipeline   Git@master         1
seed-job                                   JenkinsPipeline   Git@master         3
test-anomaly-latest                        JenkinsPipeline   Git@lint-failure   1
test-python-release                        JenkinsPipeline   Git@master         1
wscan-centos-passenger-40-centos7-latest   JenkinsPipeline                      0
wscan-centos-php-71-centos7-latest         JenkinsPipeline                      0
wscan-centos-python-27-centos7-latest      JenkinsPipeline                      0
wscan-centos-ruby-24-centos7-latest        JenkinsPipeline                      0
wscan-nshaikh-build-fail-test-latest       JenkinsPipeline                      0
wscan-test-anomaly-latest                  JenkinsPipeline                      0
wscan-test-python-release                  JenkinsPipeline                      0
bamachrn commented 6 years ago

dotests

navidshaikh commented 6 years ago

dotests