-
Notifications
You must be signed in to change notification settings - Fork 118
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
Introduce new mirroring and credential settings format and REST API #880
Merged
Merged
Changes from 18 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
8b51e01
Add Mirroring and Credential REST API
ikhoon eabb4d1
Merge branch 'main' into mirror-api
ikhoon eb28015
fix compile errors
ikhoon 785e8dc
clean up
ikhoon 1de0159
Migrate the legacy single file format to directory based format
ikhoon 9444f37
Fix broken mirror and credential tests
ikhoon 62533e4
Fix the wrong package name and update documentation
ikhoon 3b644b3
Remove redundant validation
ikhoon ad000b7
Address comments by @minwoox
ikhoon 2abe5c4
--wip-- [skip ci]
ikhoon ed4da7d
Merge branch 'main' into mirror-api
ikhoon 62c6851
Use MIRROR_PROVIDERS to check if Git mirror is enabled
ikhoon 2083cdb
Address all comments
ikhoon 9ae68a0
lint
ikhoon a7cb15d
clean up
ikhoon bfefa1a
javadoc
ikhoon 157d3a6
Add TODO
ikhoon 280c82e
Add integration tests with ZooKeeper cluster
ikhoon 52af015
Add validation
ikhoon 92ecae9
Merge branch 'main' into mirror-api
ikhoon faf081e
Read backup files to check if mirror migration was performed
ikhoon 4ce5319
Follow up after merging
ikhoon a9213fb
Add rollback logic
ikhoon f3da444
fix compile error
ikhoon bc200ef
Fix flakyness
ikhoon 3399bfb
lint
ikhoon f8091ae
Merge branch 'main' into mirror-api
ikhoon 2611954
Merge branch 'main' into mirror-api
ikhoon 28e1023
handle flakiness
ikhoon 6dee7fb
lint
ikhoon 069841e
reject legacy file formats in ContentServiceV1
ikhoon b6189ed
clean up and bug in rolback file names
ikhoon 621ec19
Add more tests
ikhoon ca95ef6
lint and fix a bug
ikhoon c80bd88
lint again
ikhoon f0184f0
Merge remote-tracking branch 'origin/main' into mirror-api
jrhee17 e5adacd
pushedAt
ikhoon a80425c
remove class level annotation
ikhoon b44ba6b
Address comments by @jrhee17
ikhoon c7686ae
fix the test failure
ikhoon bc5bb2e
Address comments by @minwoox
ikhoon 8acab6c
remove jdk8
ikhoon c128bf5
fix a test failure
ikhoon 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 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 |
---|---|---|
|
@@ -135,6 +135,7 @@ typings/ | |
|
||
# next.js build output | ||
.next | ||
.swc | ||
|
||
# macOS folder meta-data | ||
.DS_Store |
This file contains 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 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 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
194 changes: 194 additions & 0 deletions
194
common/src/main/java/com/linecorp/centraldogma/internal/api/v1/MirrorDto.java
This file contains 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 |
---|---|---|
@@ -0,0 +1,194 @@ | ||
/* | ||
* Copyright 2023 LINE Corporation | ||
* | ||
* LINE Corporation licenses this file to you under the Apache License, | ||
* version 2.0 (the "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at: | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
*/ | ||
|
||
package com.linecorp.centraldogma.internal.api.v1; | ||
|
||
import static com.google.common.base.MoreObjects.firstNonNull; | ||
import static java.util.Objects.requireNonNull; | ||
|
||
import java.util.Objects; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonInclude.Include; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.google.common.base.MoreObjects; | ||
|
||
@JsonInclude(Include.NON_NULL) | ||
public final class MirrorDto { | ||
|
||
private final String id; | ||
private final boolean enabled; | ||
private final String projectName; | ||
private final String schedule; | ||
private final String direction; | ||
private final String localRepo; | ||
private final String localPath; | ||
private final String remoteScheme; | ||
private final String remoteUrl; | ||
private final String remotePath; | ||
private final String remoteBranch; | ||
@Nullable | ||
private final String gitignore; | ||
private final String credentialId; | ||
|
||
@JsonCreator | ||
public MirrorDto(@JsonProperty("id") String id, | ||
@JsonProperty("enabled") @Nullable Boolean enabled, | ||
@JsonProperty("projectName") String projectName, | ||
@JsonProperty("schedule") String schedule, | ||
@JsonProperty("direction") String direction, | ||
@JsonProperty("localRepo") String localRepo, | ||
@JsonProperty("localPath") String localPath, | ||
@JsonProperty("remoteScheme") String remoteScheme, | ||
@JsonProperty("remoteUrl") String remoteUrl, | ||
@JsonProperty("remotePath") String remotePath, | ||
@JsonProperty("remoteBranch") String remoteBranch, | ||
@JsonProperty("gitignore") @Nullable String gitignore, | ||
@JsonProperty("credentialId") String credentialId) { | ||
this.id = id; | ||
ikhoon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
this.enabled = firstNonNull(enabled, true); | ||
this.projectName = requireNonNull(projectName, "projectName"); | ||
this.schedule = requireNonNull(schedule, "schedule"); | ||
this.direction = requireNonNull(direction, "direction"); | ||
this.localRepo = requireNonNull(localRepo, "localRepo"); | ||
this.localPath = requireNonNull(localPath, "localPath"); | ||
this.remoteScheme = requireNonNull(remoteScheme, "remoteScheme"); | ||
this.remoteUrl = requireNonNull(remoteUrl, "remoteUrl"); | ||
this.remotePath = requireNonNull(remotePath, "remotePath"); | ||
this.remoteBranch = requireNonNull(remoteBranch, "remoteBranch"); | ||
this.gitignore = gitignore; | ||
this.credentialId = requireNonNull(credentialId, "credentialId"); | ||
} | ||
|
||
@JsonProperty("id") | ||
public String id() { | ||
return id; | ||
} | ||
|
||
@JsonProperty("enabled") | ||
public boolean enabled() { | ||
return enabled; | ||
} | ||
|
||
@JsonProperty("projectName") | ||
public String projectName() { | ||
return projectName; | ||
} | ||
|
||
@JsonProperty("schedule") | ||
public String schedule() { | ||
return schedule; | ||
} | ||
|
||
@JsonProperty("direction") | ||
public String direction() { | ||
return direction; | ||
} | ||
|
||
@JsonProperty("localRepo") | ||
public String localRepo() { | ||
return localRepo; | ||
} | ||
|
||
@JsonProperty("localPath") | ||
public String localPath() { | ||
return localPath; | ||
} | ||
|
||
@JsonProperty("remoteScheme") | ||
public String remoteScheme() { | ||
return remoteScheme; | ||
} | ||
|
||
@JsonProperty("remoteUrl") | ||
public String remoteUrl() { | ||
return remoteUrl; | ||
} | ||
|
||
@JsonProperty("remotePath") | ||
public String remotePath() { | ||
return remotePath; | ||
} | ||
|
||
@JsonProperty("remoteBranch") | ||
public String remoteBranch() { | ||
return remoteBranch; | ||
} | ||
|
||
@Nullable | ||
@JsonProperty("gitignore") | ||
public String gitignore() { | ||
return gitignore; | ||
} | ||
|
||
@JsonProperty("credentialId") | ||
public String credentialId() { | ||
return credentialId; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (!(o instanceof MirrorDto)) { | ||
return false; | ||
} | ||
final MirrorDto mirrorDto = (MirrorDto) o; | ||
return id.equals(mirrorDto.id) && | ||
enabled == mirrorDto.enabled && | ||
projectName.equals(mirrorDto.projectName) && | ||
schedule.equals(mirrorDto.schedule) && | ||
direction.equals(mirrorDto.direction) && | ||
localRepo.equals(mirrorDto.localRepo) && | ||
localPath.equals(mirrorDto.localPath) && | ||
remoteScheme.equals(mirrorDto.remoteScheme) && | ||
remoteUrl.equals(mirrorDto.remoteUrl) && | ||
remotePath.equals(mirrorDto.remotePath) && | ||
remoteBranch.equals(mirrorDto.remoteBranch) && | ||
Objects.equals(gitignore, mirrorDto.gitignore) && | ||
credentialId.equals(mirrorDto.credentialId); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(id, projectName, schedule, direction, localRepo, localPath, remoteScheme, | ||
remoteUrl, remotePath, remoteBranch, gitignore, credentialId, enabled); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return MoreObjects.toStringHelper(this) | ||
.omitNullValues() | ||
.add("id", id) | ||
.add("enabled", enabled) | ||
.add("projectName", projectName) | ||
.add("schedule", schedule) | ||
.add("direction", direction) | ||
.add("localRepo", localRepo) | ||
.add("localPath", localPath) | ||
.add("remoteScheme", remoteScheme) | ||
.add("remoteUrl", remoteUrl) | ||
.add("remotePath", remotePath) | ||
.add("gitignore", gitignore) | ||
.add("credentialId", credentialId) | ||
.toString(); | ||
} | ||
} |
This file contains 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 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 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need to remove this line.