Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(repo-server): completely clean up Git working directory (#3683) #13001

Merged
merged 2 commits into from
May 27, 2023

Conversation

yann-soubeyrand
Copy link
Contributor

@yann-soubeyrand yann-soubeyrand commented Mar 24, 2023

In some cases, for example when a Git submodule wasn’t present anymore in a Git revision, the repo-server didn’t completely clean up its Git working directory.

Fixes #3683

Note on DCO:

If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.

Please see Contribution FAQs if you have questions about your pull-request.

@codecov
Copy link

codecov bot commented Mar 24, 2023

Codecov Report

Patch coverage: 37.50% and project coverage change: -0.01 ⚠️

Comparison is base (0a8a71e) 49.17% compared to head (aaba605) 49.17%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #13001      +/-   ##
==========================================
- Coverage   49.17%   49.17%   -0.01%     
==========================================
  Files         248      248              
  Lines       42872    42872              
==========================================
- Hits        21084    21081       -3     
- Misses      19687    19689       +2     
- Partials     2101     2102       +1     
Impacted Files Coverage Δ
util/git/client.go 50.00% <37.50%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@blakepettersson
Copy link
Member

Looks good! Would it be possible to add an E2E test that exercises that this works as intended?

@yann-soubeyrand yann-soubeyrand force-pushed the fix-3683 branch 6 times, most recently from 1f6d7b6 to 7b5b290 Compare April 7, 2023 11:45
@yann-soubeyrand
Copy link
Contributor Author

yann-soubeyrand commented Apr 7, 2023

Hello @blakepettersson, it’s done 😉

Adding this test showed me that my PR wasn’t correct, as git checkout --recurse-submodule failed due to a missing submodule commit. So I introduced a new parameter to the Fetch() function to use git fetch --recurse-submodule when submodules are enabled, which made me modify a lot of code (essentially tests though). But I finally realized that adding a double f argument to the git clean command should be sufficient and I removed the --recurse-submodule argument of the git checkout command.

Copy link
Member

@blakepettersson blakepettersson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM at least, good stuff! Will need to add a few more eyes on this though.

Copy link
Member

@ishitasequeira ishitasequeira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR looks good!!

…nt with runCmd() one

Signed-off-by: Yann Soubeyrand <yann.soubeyrand@camptocamp.com>
In some cases, for example when a Git submodule wasn’t present anymore
in a Git revision, the repo-server didn’t completely clean up its Git
working directory.

Fixes argoproj#3683

Signed-off-by: Yann Soubeyrand <yann.soubeyrand@camptocamp.com>
Copy link
Member

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks @yann-soubeyrand!

@crenshaw-dev crenshaw-dev merged commit 41e91d5 into argoproj:master May 27, 2023
@yann-soubeyrand yann-soubeyrand deleted the fix-3683 branch May 29, 2023 09:39
@chris-ng-scmp
Copy link
Contributor

chris-ng-scmp commented Jun 28, 2023

Seems the fix has not released in version 2.5 / 2.6 / 2.7 yet
Currently, my ArgoCD v2.4 can't go for any upgrade due to migrating CMP from configmap to sidecar with the bug.

Keen to see if we can have this fix release for v2.5 as part of the upgrade path from v2.4

@yann-soubeyrand
Copy link
Contributor Author

I don’t know if I can run these commands, but just trying 😉

/cherry-pick release-2.7

@chris-ng-scmp
Copy link
Contributor

I don’t know if I can run these commands, but just trying 😉

/cherry-pick release-2.7

Seems not working... haha

Just checked the new release for both 2.7 / 2.6 / 2.5, not including these changes as well

@yann-soubeyrand
Copy link
Contributor Author

Hi @crenshaw-dev, I can’t issue cherry-pick commands myself, could you do it please? Or tell me if I should open cherry-pick PRs instead.

@ldacey
Copy link

ldacey commented Jul 29, 2023

I believe this is the fix required to get Gitlab to sync properly. Any idea if it will be in 2.8? I just updated to 2.7.9 a bit ago and my Gitlab app has an error

@blakepettersson
Copy link
Member

It should be @ldacey, try out the latest 2.8-rc and see if that helps.

yyzxw pushed a commit to yyzxw/argo-cd that referenced this pull request Aug 9, 2023
…#3683) (argoproj#13001)

* refactor(util/git/client): make runCredentialedCmd() signature coherent with runCmd() one

Signed-off-by: Yann Soubeyrand <yann.soubeyrand@camptocamp.com>

* fix(repo-server): completely clean up Git working directory

In some cases, for example when a Git submodule wasn’t present anymore
in a Git revision, the repo-server didn’t completely clean up its Git
working directory.

Fixes argoproj#3683

Signed-off-by: Yann Soubeyrand <yann.soubeyrand@camptocamp.com>

---------

Signed-off-by: Yann Soubeyrand <yann.soubeyrand@camptocamp.com>
tesla59 pushed a commit to tesla59/argo-cd that referenced this pull request Dec 16, 2023
…#3683) (argoproj#13001)

* refactor(util/git/client): make runCredentialedCmd() signature coherent with runCmd() one

Signed-off-by: Yann Soubeyrand <yann.soubeyrand@camptocamp.com>

* fix(repo-server): completely clean up Git working directory

In some cases, for example when a Git submodule wasn’t present anymore
in a Git revision, the repo-server didn’t completely clean up its Git
working directory.

Fixes argoproj#3683

Signed-off-by: Yann Soubeyrand <yann.soubeyrand@camptocamp.com>

---------

Signed-off-by: Yann Soubeyrand <yann.soubeyrand@camptocamp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Repo-server doesn't fully clean workspace
6 participants