Verigreen / verigreen

Verigreen is a lightweight, server side solution for verification of git commits. It is a gated check-in process which will not allow any failed CI commit to go into an integration/release/any protected branch. We keep it green (hence the name).
Apache License 2.0
57 stars 19 forks source link

Verigreen does not clean the temporary branches it creates, even after they are removed from the Verigreen UI #131

Closed aleitamar closed 6 years ago

soninob commented 6 years ago

@aleitamar - temporary branches are getting deleted immidiatly in case you get the green light. In case the build failed then there is a policy to delete the branches (to allow you to work on the bad code). this is part of our WIKI - let me know if t helps.

aleitamar commented 6 years ago

@soninob I see in the log that the BranchCleanerJob is running, but for some reason Verigreen does not clean the branches on our environment.

I ended up creating a Jenkins job that cleans vg_* branches every night.

Do you have any instructions on how to run Verigreen collector in a debugger? It will be a lot easier to understand the root cause that way.

soninob commented 6 years ago

@aleitamar can you post your proeprties file with the relevant info? let's see if we miss something. regarding debugging - jast like any other application. in your case you need to debug the collector (not the git-hook).

aleitamar commented 6 years ago

@soninob Thank you for looking into it.

I noticed that i am using code that contains this pull request: https://github.com/Verigreen/verigreen/pull/123 From looking at the code it doesn't seem likely that it can affect anything... (maybe the JGit version upgrade can cause problems?) When i find some time to test it with the latest official release i'll report back...

Below is the configuration file I have omitted the comments and changed confidential data.

jenkins.url=http://jenkins:8080/ jenkins.user=user jenkins.password=password jenkins.jobName=verigreen jenkins.branchParamName=branch_name jenkins.timeoutInSeconds=3600 git.user=user git.password=password git.repositoryLocation=/repo git.protectedBranches=refs/heads/master git.permittedUsers=someone@somewhere.com commited.by.collector=VeriGreen email.address=someone@somewhere.com mail.server=mail.somewhere.com collectors=collector collector.address=http://123.123.123:8091/rest faq.offline=false daysThreashold=1 repeatHourlyForever=24 repeatSecondlyForever=10 timeout.counter=1 default_count=1 number.commits=5 job.retry.counter=1 hash.password=c21e299d9ec8db9718e162aca10689317d94f34f full.push=disabled jenkinsparam.mode=params jenkinsparam.longid=false jenkinsparam.parent=false jenkinsparam.protected=false jenkinsparam.commitid=false jenkinsparam.committer=true faq.offline.git=faqpage.html#q-i-got-a-git_failure-status-what-does-it-mean faq.offline.timeout=faqpage.html#q-i-got-a-time_out-status-what-does-it-mean faq.online.git=https://github.com/Verigreen/verigreen/wiki/Verigreen-FAQ#q-i-got-a-git_failure-status-what-does-it-mean faq.online.trigger=https://github.com/Verigreen/verigreen/wiki/Verigreen-FAQ#q-i-got-a-trigger_failed-status-what-does-it-mean faq.online.timeout=https://github.com/Verigreen/verigreen/wiki/Verigreen-FAQ#q-i-got-a-time_out-status-what-does-it-mean faq.offline.git=faqpage.html#q-i-got-a-git_failure-status-what-does-it-mean faq.offline.trigger=faqpage.html#q-i-got-a-trigger_failed-status-what-does-it-mean faq.offline.timeout=faqpage.html#q-i-got-a-time_out-status-what-does-it-mean

soninob commented 6 years ago

@aleitamar - According to you config - you will keep failed branch for one day, the first check will be after 24 h from collector startup. the relevant fields are (from the original file):

Verigreen Internal Configuration

CacheCleanerJob and BranchCleanerJob configuration.

0 => Remove all but Running commits.

daysThreashold=3

How many hours to wait before Verigreen runs its cache and branch cleaning jobs.

repeatHourlyForever=24

is this what you see?

soninob commented 6 years ago

@aleitamar - did you check? can we close this?

aleitamar commented 6 years ago

@soninob The good: We only see verigreen items in verigreen UI that are less than 1 day old. The bad: We see all temporary branches are not cleaned up. Even the branches that pass.

soninob commented 6 years ago

@aleitamar this is strange - can you paste one of the vg temp branches name? maybe you have a rule that changes the prefix of the branches names? it should be something like vg_userName_linuxtime...

aleitamar commented 6 years ago

origin/vg_f5b0bed_Itamar_Ben_Laysh_new_1519556629038 origin/vg_f5b0bed_Itamar_Ben_Laysh

soninob commented 6 years ago

It looks right. @aleitamar I think the problem is in the git.repositoryLocation please change it to git.repositoryLocation=/repo/.git If this is only what you paste due to security reasons and you have the right value in your property file, I'll suggest to debug the BranchCleanerJob. Check the deleteBranches and the branchesToBeDelete methods - see if you get any value...

aleitamar commented 6 years ago

@soninob Thank you for the support I'll try that and get back to you

aleitamar commented 6 years ago

@soninob Changing the repositoryLocation did not solve the issue...

soninob commented 6 years ago

please check then what value you are getting in debug. let me know if you are seeing the list or any uncauthexception in the deletion....

aleitamar commented 6 years ago

@soninob It will take me a while to get to this. I'll update when i do

soninob commented 6 years ago

@aleitamar - any news about this, can we close it?

soninob commented 6 years ago

@aleitamar - I'm closing this one, if you still think it is needed, please reopen.