Skip to content

Commit

Permalink
chore: Add code-split for injecting JIT pull in app CI/CD (#38270)
Browse files Browse the repository at this point in the history
## Description
EE counterpart PR: appsmithorg/appsmith-ee#5780


Fixes #`Issue Number`  
_or_  
Fixes `Issue URL`
> [!WARNING]  
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._

## Automation

/ok-to-test tags="@tag.Sanity"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/12471975301>
> Commit: f0a7b1e
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12471975301&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Sanity`
> Spec:
> <hr>Mon, 23 Dec 2024 20:06:14 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Summary by CodeRabbit

- **New Features**
- Introduced a method for validating and publishing artifacts before
discarding changes.
- Added functionality to commit artifacts to a Git repository with
customizable commit messages.
- Expanded interface capabilities with a new method for validating
artifacts.

- **Bug Fixes**
- Enhanced error handling in the discard changes process to improve
resource management during failures.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
subrata71 authored and “NandanAnantharamu” committed Dec 27, 2024
1 parent 61769dc commit 23cb56a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
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 @@ -2288,12 +2288,16 @@ 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 ->
gitArtifactHelper.validateAndPublishArtifact(importedArtifact, true));
})
.flatMap(branchedArtifact -> releaseFileLock(
branchedArtifact.getGitArtifactMetadata().getDefaultArtifactId())
.then(this.addAnalyticsForGitOperation(
AnalyticsEvents.GIT_DISCARD_CHANGES, branchedArtifact, null)))
.onErrorResume(error -> branchedArtifactMonoCached.flatMap(branchedArtifact -> releaseFileLock(
branchedArtifact.getGitArtifactMetadata().getDefaultArtifactId())
.then(Mono.error(error))))
.name(GitSpan.OPS_DISCARD_CHANGES)
.tap(Micrometer.observation(observationRegistry));

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

0 comments on commit 23cb56a

Please sign in to comment.