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

chore: Add code-split for injecting JIT pull in app CI/CD #38270

Merged
merged 3 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -322,4 +322,9 @@ public Application getNewArtifact(String workspaceId, String repoName) {
public Mono<Application> publishArtifactPostCommit(Artifact committedArtifact) {
return publishArtifact(committedArtifact, true);
}

@Override
public Mono<? extends Artifact> validateAndPublishArtifact(Artifact artifact, boolean publish) {
return publishArtifact(artifact, publish);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2245,10 +2245,8 @@ public Mono<? extends Artifact> discardChanges(String branchedArtifactId, Artifa

Mono<? extends Artifact> branchedArtifactMonoCached =
gitArtifactHelper.getArtifactById(branchedArtifactId, artifactEditPermission);
Mono<? extends Artifact> discardChangeMono;

// Rehydrate the artifact from local file system
discardChangeMono = branchedArtifactMonoCached
Mono<? extends Artifact> discardChangeMono = branchedArtifactMonoCached
.flatMap(branchedArtifact -> {
GitArtifactMetadata branchedGitData = branchedArtifact.getGitArtifactMetadata();
if (branchedGitData == null || !hasText(branchedGitData.getDefaultArtifactId())) {
Expand Down Expand Up @@ -2288,14 +2286,19 @@ public Mono<? extends Artifact> discardChanges(String branchedArtifactId, Artifa
artifactExchangeJson,
branchName))
// Update the last deployed status after the rebase
.flatMap(importedArtifact -> publishArtifact(importedArtifact, true));
.flatMap(importedArtifact ->
gitApplicationHelper.validateAndPublishArtifact(importedArtifact, true));
})
.flatMap(branchedArtifact -> releaseFileLock(
branchedArtifact.getGitArtifactMetadata().getDefaultArtifactId())
.then(this.addAnalyticsForGitOperation(
AnalyticsEvents.GIT_DISCARD_CHANGES, branchedArtifact, null)))
.flatMap(branchedArtifact ->
this.addAnalyticsForGitOperation(AnalyticsEvents.GIT_DISCARD_CHANGES, branchedArtifact, null))
.name(GitSpan.OPS_DISCARD_CHANGES)
.tap(Micrometer.observation(observationRegistry));
.tap(Micrometer.observation(observationRegistry))
.doFinally(signalType -> {
branchedArtifactMonoCached
.flatMap(branchedArtifact -> releaseFileLock(
branchedArtifact.getGitArtifactMetadata().getDefaultArtifactId()))
.subscribe();
});

return Mono.create(
sink -> discardChangeMono.subscribe(sink::success, sink::error, null, sink.currentContext()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,6 @@ public interface GitArtifactHelperCE<T extends Artifact> {
T getNewArtifact(String workspaceId, String repoName);

Mono<T> publishArtifactPostCommit(Artifact committedArtifact);

Mono<? extends Artifact> validateAndPublishArtifact(Artifact artifact, boolean publish);
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ public void setupGitRepository(
// checkout to the new branch
gitExecutor.createAndCheckoutToBranch(suffix, branchName).block();

commitArtifact(workspaceId, applicationId, branchName, repoName, applicationJson, "commit message two");
}

public void commitArtifact(
String workspaceId,
String applicationId,
String branchName,
String repoName,
ApplicationJson applicationJson,
String commitMessage)
throws GitAPIException, IOException {
Path suffix = Paths.get(workspaceId, applicationId, repoName);
// saving the files into the git repository from application json
// The files would later be saved in this git repository from resources section instead of applicationJson
commonGitFileUtils
Expand All @@ -72,7 +84,7 @@ public void setupGitRepository(

// commit the application
gitExecutor
.commitArtifact(suffix, "commit message two", "user", "[email protected]", true, false)
.commitArtifact(suffix, commitMessage, "user", "[email protected]", true, false)
.block();
}

Expand Down
Loading