git-plugin icon indicating copy to clipboard operation
git-plugin copied to clipboard

Jenkins 13493 - Automatic git cache maintenance

Open Hrushi20 opened this issue 3 years ago • 18 comments

JENKINS-13493 - Automatic git cache maintenance

This PR adds git maintenance to the Jenkins controller to optimize the git caches on the controller.

Please refer to Project Page for reference and design: https://www.jenkins.io/projects/gsoc/2022/projects/automatic-git-cache-maintenance/

Checklist

  • [x] I have read the CONTRIBUTING doc
  • [x] I have referenced the Jira issue related to my changes in one or more commit messages
  • [x] I have added tests that verify my changes
  • [x] Unit tests pass locally with my changes
  • [x] I have added documentation as necessary
  • [x] No Javadoc warnings were introduced with my changes
  • [x] No spotbugs warnings were introduced with my changes
  • [ ] Documentation in README has been updated as necessary
  • [ ] Online help has been added and reviewed for any new or modified fields
  • [x] I have interactively tested my changes
  • [x] Any dependent changes have been merged and published in upstream modules (like git-client-plugin)

Types of changes

  • [x] New feature (non-breaking change which adds functionality)

Hrushi20 avatar May 31 '22 22:05 Hrushi20

Thank You @MarkEWaite for fixing those tests.

Hrushi20 avatar Jun 19 '22 20:06 Hrushi20

@Hrushi20 it appears there are testing failing in the CI job that were not failing before. I'm on vacation and won't be able to investigate for several weeks. If you have time over the next few weeks, it would be very nice if you could investigate the test failures.

MarkEWaite avatar Oct 22 '22 06:10 MarkEWaite

Sure @MarkEWaite I'll look into it. Enjoy your vacation.

Hrushi20 avatar Oct 24 '22 15:10 Hrushi20

Hello @MarkEWaite, I have gone through the failed tests. I realized that the below code is not creating a cache on the Jenkins controller.

        sampleRepo1.init();
        sampleRepo1.git("checkout", "-b", "bug/JENKINS-42817");
        sampleRepo1.write("file", "modified");
        sampleRepo1.git("commit", "--all", "--message=dev");

        SCMFileSystem fs = SCMFileSystem.of(j.createFreeStyleProject(), new GitSCM(GitSCM.createRepoList(sampleRepo1.toString(), null), Collections.singletonList(new BranchSpec("*/bug/JENKINS-42817")), null, null, Collections.emptyList()));

Before I could access the caches, but now I am not able to create caches. Also, Java 8 clears all the tests. Java 11 and Java 17 fails this test.

Is there a way to create a MultibranchPipeline so that it handle creating the caches.

Hrushi20 avatar Oct 25 '22 20:10 Hrushi20

Hello @MarkEWaite, can you help me fix these failing tests. The problem I am facing right now is that I am not able to create fake caches during tests.

Hrushi20 avatar Dec 20 '22 14:12 Hrushi20

Hello @MarkEWaite, can you help me fix these failing tests. The problem I am facing right now is that I am not able to create fake caches during tests.

I won't be able to help with these tests until after I've completed the release of git client plugin 4.0.0 and git plugin 5.0.0. Those releases are getting all the time that I can allocate to the git plugin and git client plugin.

MarkEWaite avatar Dec 20 '22 14:12 MarkEWaite

Hey @MarkEWaite, incremental repack is failing. I'm getting task timeout error. Can you help me with that. I fixed all the other tests. Looking forward to getting this feature merged.

Hrushi20 avatar Jul 30 '23 17:07 Hrushi20

Hey @MarkEWaite, I've updated the code to use ArrayList instead of LinkedList. As we are only storing atmost 5 records per cache, I thought it's an overhead to use LinkedList.

Hrushi20 avatar Jul 31 '23 19:07 Hrushi20

Hey @MarkEWaite, I've fixed all the Unit test Issues. I ran a git rebase and the code is up to date with latest master. There are 2 spotbug issues, I am facing. Should I use the Spotbug flag to neglect such an issue? Looking forward to getting this merged.

Hrushi20 avatar Oct 28 '23 00:10 Hrushi20

Hey @MarkEWaite, I've fixed all the Unit test Issues. I ran a git rebase and the code is up to date with latest master. There are 2 spotbug issues, I am facing. Should I use the Spotbug flag to neglect such an issue? Looking forward to getting this merged.

Hrushi20 avatar Dec 10 '23 07:12 Hrushi20

Hey @MarkEWaite, can we get this code merged?

Hrushi20 avatar Feb 03 '24 03:02 Hrushi20