-
Notifications
You must be signed in to change notification settings - Fork 4.5k
chore: added git resource map consumption #38470
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
927fc5d
added git resource map
sondermanish 41f5faa
added reviewed comments
sondermanish f464a95
added changes
sondermanish 7a3406e
review comments
sondermanish 70ad2a1
modified mocking for test failures
sondermanish 8877a5b
more mocking
sondermanish File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -364,9 +364,9 @@ private boolean checkIsDatasourceNameConflict( | |
| @Override | ||
| public Mono<? extends Artifact> checkoutReference( | ||
| String referenceArtifactId, | ||
| ArtifactType artifactType, | ||
| GitRefDTO gitRefDTO, | ||
| boolean addFileLock, | ||
| ArtifactType artifactType, | ||
| GitType gitType) { | ||
|
|
||
| if (gitRefDTO == null || !hasText(gitRefDTO.getRefName())) { | ||
|
|
@@ -423,6 +423,7 @@ protected Mono<? extends Artifact> checkoutReference( | |
| ArtifactJsonTransformationDTO jsonTransformationDTO = new ArtifactJsonTransformationDTO(); | ||
| jsonTransformationDTO.setWorkspaceId(baseArtifact.getWorkspaceId()); | ||
| jsonTransformationDTO.setBaseArtifactId(baseGitMetadata.getDefaultArtifactId()); | ||
| jsonTransformationDTO.setRefName(finalRefName); | ||
| jsonTransformationDTO.setRefType(refType); | ||
| jsonTransformationDTO.setArtifactType(baseArtifact.getArtifactType()); | ||
| jsonTransformationDTO.setRepoName(baseGitMetadata.getRepoName()); | ||
|
|
@@ -474,7 +475,7 @@ protected Mono<? extends Artifact> checkoutReference( | |
| } | ||
|
|
||
| protected Mono<? extends Artifact> checkoutRemoteReference( | ||
| String baseArtifactId, GitRefDTO gitRefDTO, ArtifactType artifactType, GitType gitType) { | ||
| String baseArtifactId, ArtifactType artifactType, GitRefDTO gitRefDTO, GitType gitType) { | ||
|
|
||
| GitArtifactHelper<?> gitArtifactHelper = gitArtifactHelperResolver.getArtifactHelper(artifactType); | ||
| AclPermission artifactEditPermission = gitArtifactHelper.getArtifactEditPermission(); | ||
|
|
@@ -559,7 +560,7 @@ private Mono<? extends Artifact> checkoutRemoteReference( | |
|
|
||
| @Override | ||
| public Mono<? extends Artifact> createReference( | ||
| String referencedArtifactId, GitRefDTO refDTO, ArtifactType artifactType, GitType gitType) { | ||
| String referencedArtifactId, ArtifactType artifactType, GitRefDTO refDTO, GitType gitType) { | ||
|
|
||
| /* | ||
| 1. Check if the src artifact is available and user have sufficient permissions | ||
|
|
@@ -689,7 +690,7 @@ protected Mono<? extends Artifact> createReference( | |
| }) | ||
| // after the branch is created, we need to reset the older branch to the | ||
| // clean status, i.e. last commit | ||
| .doOnSuccess(newImportedArtifact -> discardChanges(sourceArtifact, gitType)); | ||
| .flatMap(newImportedArtifact -> discardChanges(sourceArtifact, gitType)); | ||
| }) | ||
| .flatMap(newImportedArtifact -> gitRedisUtils | ||
| .releaseFileLock( | ||
|
|
@@ -729,7 +730,7 @@ protected Mono<Boolean> isValidationForRefCreationComplete( | |
|
|
||
| @Override | ||
| public Mono<? extends Artifact> deleteGitReference( | ||
| String baseArtifactId, GitRefDTO gitRefDTO, ArtifactType artifactType, GitType gitType) { | ||
| String baseArtifactId, ArtifactType artifactType, GitRefDTO gitRefDTO, GitType gitType) { | ||
|
|
||
| String refName = gitRefDTO.getRefName(); | ||
| RefType refType = gitRefDTO.getRefType(); | ||
|
|
@@ -867,19 +868,19 @@ protected Mono<? extends Artifact> deleteGitReference( | |
| * Each artifact is equal to a repo in the git(and each branch creates a new artifact with default artifact as parent) | ||
| * | ||
| * @param baseArtifactId : artifactId of the artifact which is getting connected to git | ||
| * @param gitConnectDTO artifactId - this is used to link the local git repo to an artifact | ||
| * remoteUrl - used for connecting to remote repo etc | ||
| * @param originHeader | ||
| * @param artifactType | ||
| * @param gitConnectDTO artifactId - this is used to link the local git repo to an artifact | ||
| * remoteUrl - used for connecting to remote repo etc | ||
| * @param originHeader | ||
| * @param gitType | ||
| * @return an artifact with git metadata | ||
| */ | ||
| @Override | ||
| public Mono<? extends Artifact> connectArtifactToGit( | ||
| String baseArtifactId, | ||
| ArtifactType artifactType, | ||
| GitConnectDTO gitConnectDTO, | ||
| String originHeader, | ||
| ArtifactType artifactType, | ||
| GitType gitType) { | ||
| /* | ||
| * Connecting the artifact for the first time | ||
|
|
@@ -1473,31 +1474,31 @@ private boolean isBaseGitMetadataInvalid(GitArtifactMetadata gitArtifactMetadata | |
| } | ||
|
|
||
| private Mono<GitStatusDTO> getStatusAfterComparingWithRemote( | ||
| String baseArtifactId, boolean isFileLock, ArtifactType artifactType, GitType gitType) { | ||
| return getStatus(baseArtifactId, isFileLock, true, artifactType, gitType); | ||
| String baseArtifactId, ArtifactType artifactType, boolean isFileLock, GitType gitType) { | ||
| return getStatus(baseArtifactId, artifactType, isFileLock, true, gitType); | ||
| } | ||
|
|
||
| @Override | ||
| public Mono<GitStatusDTO> getStatus( | ||
| String branchedArtifactId, boolean compareRemote, ArtifactType artifactType, GitType gitType) { | ||
| return getStatus(branchedArtifactId, true, compareRemote, artifactType, gitType); | ||
| String branchedArtifactId, ArtifactType artifactType, boolean compareRemote, GitType gitType) { | ||
| return getStatus(branchedArtifactId, artifactType, true, compareRemote, gitType); | ||
| } | ||
|
|
||
| /** | ||
| * Get the status of the artifact for given branched id | ||
| * | ||
| * @param branchedArtifactId branched id of the artifact | ||
| * @param artifactType Type of artifact in context | ||
| * @param isFileLock if the locking is required, since the status API is used in the other flows of git | ||
| * Only for the direct hits from the client the locking will be added | ||
| * @param artifactType Type of artifact in context | ||
| * @param gitType Type of the service | ||
| * @return Map of json file names which are added, modified, conflicting, removed and the working tree if this is clean | ||
| */ | ||
| private Mono<GitStatusDTO> getStatus( | ||
| String branchedArtifactId, | ||
| ArtifactType artifactType, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Look out for potential concurrency pitfalls. Multiple calls to |
||
| boolean isFileLock, | ||
| boolean compareRemote, | ||
| ArtifactType artifactType, | ||
| GitType gitType) { | ||
|
|
||
| Mono<Tuple2<? extends Artifact, ? extends Artifact>> baseAndBranchedArtifacts = | ||
|
|
@@ -1867,14 +1868,14 @@ public Mono<String> fetchRemoteChanges( | |
| * 1. Checkout (if required) to the branch to make sure we are comparing the right branch | ||
| * 2. Run a git fetch command to fetch the latest changes from the remote | ||
| * | ||
| * @param refArtifactId id of the reference | ||
| * @param isFileLock whether to add file lock or not | ||
| * @param refArtifactId id of the reference | ||
| * @param artifactType | ||
| * @param isFileLock whether to add file lock or not | ||
| * @return Mono of {@link BranchTrackingStatus} | ||
| */ | ||
| @Override | ||
| public Mono<String> fetchRemoteChanges( | ||
| String refArtifactId, boolean isFileLock, ArtifactType artifactType, GitType gitType, RefType refType) { | ||
| String refArtifactId, ArtifactType artifactType, boolean isFileLock, GitType gitType, RefType refType) { | ||
| GitArtifactHelper<?> artifactGitHelper = gitArtifactHelperResolver.getArtifactHelper(artifactType); | ||
| AclPermission artifactEditPermission = artifactGitHelper.getArtifactEditPermission(); | ||
|
|
||
|
|
@@ -2066,15 +2067,15 @@ protected Mono<? extends Artifact> discardChanges(Artifact branchedArtifact, Git | |
| } | ||
|
|
||
| public Mono<List<GitBranchDTO>> listBranchForArtifact( | ||
| String branchedArtifactId, Boolean pruneBranches, ArtifactType artifactType, GitType gitType) { | ||
| return getBranchList(branchedArtifactId, pruneBranches, true, artifactType, gitType); | ||
| String branchedArtifactId, ArtifactType artifactType, Boolean pruneBranches, GitType gitType) { | ||
| return getBranchList(branchedArtifactId, artifactType, pruneBranches, true, gitType); | ||
| } | ||
|
|
||
| protected Mono<List<GitBranchDTO>> getBranchList( | ||
| String branchedArtifactId, | ||
| ArtifactType artifactType, | ||
| Boolean pruneBranches, | ||
| boolean syncDefaultBranchWithRemote, | ||
| ArtifactType artifactType, | ||
| GitType gitType) { | ||
|
|
||
| GitArtifactHelper<?> gitArtifactHelper = gitArtifactHelperResolver.getArtifactHelper(artifactType); | ||
|
|
@@ -2176,9 +2177,9 @@ private Mono<String> syncDefaultBranchNameFromRemote( | |
| // default branch has been changed in remote | ||
| return updateDefaultBranchName( | ||
| metadata.getDefaultArtifactId(), | ||
| artifactType, | ||
| defaultBranchNameInRemote, | ||
| jsonTransformationDTO, | ||
| artifactType, | ||
| gitType) | ||
| .then() | ||
| .thenReturn(defaultBranchNameInRemote); | ||
|
|
@@ -2191,9 +2192,9 @@ private Mono<String> syncDefaultBranchNameFromRemote( | |
|
|
||
| private Flux<? extends Artifact> updateDefaultBranchName( | ||
| String baseArtifactId, | ||
| ArtifactType artifactType, | ||
| String newDefaultBranchName, | ||
| ArtifactJsonTransformationDTO jsonTransformationDTO, | ||
| ArtifactType artifactType, | ||
| GitType gitType) { | ||
| // Get the artifact from DB by new defaultBranchName | ||
| GitArtifactHelper<?> gitArtifactHelper = gitArtifactHelperResolver.getArtifactHelper(artifactType); | ||
|
|
@@ -2391,7 +2392,7 @@ private Mono<List<GitBranchDTO>> getBranchListWithDefaultBranchName( | |
|
|
||
| @Override | ||
| public Mono<List<String>> updateProtectedBranches( | ||
| String baseArtifactId, List<String> branchNames, ArtifactType artifactType) { | ||
| String baseArtifactId, ArtifactType artifactType, List<String> branchNames) { | ||
|
|
||
| GitArtifactHelper<?> gitArtifactHelper = gitArtifactHelperResolver.getArtifactHelper(artifactType); | ||
| AclPermission artifactManageProtectedBranchPermission = | ||
|
|
@@ -2508,7 +2509,7 @@ public Mono<Boolean> toggleAutoCommitEnabled(String baseArtifactId, ArtifactType | |
|
|
||
| @Override | ||
| public Mono<AutoCommitResponseDTO> getAutoCommitProgress( | ||
| String artifactId, String branchName, ArtifactType artifactType) { | ||
| String artifactId, ArtifactType artifactType, String branchName) { | ||
| return gitAutoCommitHelper.getAutoCommitProgress(artifactId, branchName); | ||
| } | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.