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 race condition in AppProjectRepository reconciliation and remove RepositoryCredential field #594

Conversation

jgwest
Copy link
Member

@jgwest jgwest commented Aug 6, 2023

Description:

  • The logic for determining what AppProjectRepository rows should exist in the database is now entirely within the reconcileAppProjectRepositories function of the shared resource loop
  • This avoids a potential race condition where multiple GitOpsDeployments/RepositoryCredentials were reconciling AppProjects at the same time.
    • To be clear: this race condition was due to a flaw in my proposal in the original design document, and not an issue with the implementation itself by the GitOps Service EE team.
  • The existing AppProjectRepository reconcile functions now call the shared resource loop function

Link to JIRA Story (if applicable): https://issues.redhat.com/browse/GITOPSRVCE-705

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 6, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 6, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jgwest

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved label Aug 6, 2023
@jgwest
Copy link
Member Author

jgwest commented Aug 6, 2023

/test all

@jgwest jgwest changed the title Remove RepositoryCredential field from AppProjectRepository and fix race condition Fix race condition in AppProjectRepository reconciliation and remove RepositoryCredential field Aug 6, 2023
@codecov
Copy link

codecov bot commented Aug 6, 2023

Codecov Report

Patch coverage: 65.36% and project coverage change: +0.07% 🎉

Comparison is base (73b2188) 56.06% compared to head (6b992e6) 56.14%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #594      +/-   ##
==========================================
+ Coverage   56.06%   56.14%   +0.07%     
==========================================
  Files         100      100              
  Lines       17612    17676      +64     
==========================================
+ Hits         9875     9925      +50     
- Misses       6515     6523       +8     
- Partials     1222     1228       +6     
Files Changed Coverage Δ
backend-shared/db/app_project_repository.go 24.64% <0.00%> (-5.22%) ⬇️
backend-shared/db/db_field_constants.go 100.00% <ø> (ø)
backend-shared/db/queries.go 76.19% <ø> (ø)
backend-shared/db/types.go 81.81% <ø> (ø)
...event_loop/application_event_runner_deployments.go 65.17% <42.42%> (-0.35%) ⬇️
...ce_loop/sharedresourceloop_repositorycredential.go 63.04% <57.14%> (+0.23%) ⬆️
...entloop/shared_resource_loop/sharedresourceloop.go 62.54% <72.50%> (+3.82%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jgwest jgwest marked this pull request as ready for review August 11, 2023 07:27
@jgwest jgwest removed the request for review from raghavi101 August 11, 2023 07:27
@jgwest jgwest force-pushed the fix-app-project-race-condition-bug-july-2023 branch 2 times, most recently from ce60471 to 847bb8f Compare August 12, 2023 09:00
@jgwest
Copy link
Member Author

jgwest commented Aug 15, 2023


Summarizing 1 Failure:
  [FAIL] GitOpsDeployment E2E tests Create, Update and Delete a GitOpsDeployment  [It] should ensure that when 2 GitOpsDeployments are created and point to the same repo url, and one is deleted, the AppProjectRepository for the other still exists
  /go/src/github.com/redhat-appstudio/managed-gitops/tests-e2e/core/gitopsdeployment_test.go:272
Ran 57 of 60 Specs in 2286.788 seconds
FAIL! -- 56 Passed | 1 Failed | 0 Pending | 3 Skipped

@jgwest
Copy link
Member Author

jgwest commented Aug 17, 2023

Known CI flake
/retest

@jgwest jgwest force-pushed the fix-app-project-race-condition-bug-july-2023 branch from db1b583 to dae9175 Compare August 18, 2023 00:11
@Rizwana777
Copy link
Contributor

@jgwest LGTM, just a minor typos

@jgwest
Copy link
Member Author

jgwest commented Aug 22, 2023

Thanks @Rizwana777!

@jgwest jgwest merged commit ab9e0f4 into redhat-appstudio:main Aug 22, 2023
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants