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: Added capability of running ITs using ok-to-test #38355

Merged
merged 19 commits into from
Jan 1, 2025
Merged

Conversation

nidhi-nair
Copy link
Contributor

@nidhi-nair nidhi-nair commented Dec 24, 2024

Description

Tip

Add a TL;DR when the description is longer than 500 words or extremely technical (helps the content, marketing, and DevRel team).

Please also include relevant motivation and context. List any dependencies that are required for this change. Add links to Notion, Figma or any other documents that might be relevant to the PR.

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.Git" it=true

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12548211703
Commit: 28ec34d
Cypress dashboard.
Tags: @tag.Git
Spec:


Mon, 30 Dec 2024 15:48:17 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Added optional integration tests trigger across multiple GitHub Actions workflows
    • Enhanced test configuration and reporting mechanisms
  • Chores

    • Updated workflow input parameters and descriptions
    • Improved test execution and artifact management
  • Documentation

    • Added clarifying comments in test scripts about test prerequisites

@nidhi-nair nidhi-nair requested review from sharat87 and a team as code owners December 24, 2024 14:18
Copy link
Contributor

coderabbitai bot commented Dec 24, 2024

Walkthrough

This pull request introduces enhancements to GitHub Actions workflows and associated scripts, focusing on adding a new its (Integration Test) parameter across multiple configuration files. The changes enable more flexible test execution, particularly for integration tests, by introducing a new output variable and modifying parsing logic. The modifications span workflow files like pr-automation.yml, server-build.yml, pr-cypress.yml, and the test tag parser script.

Changes

File Change Summary
.github/workflows/pr-automation.yml Added its output variable in parse-tags job
.github/workflows/scripts/test-tag-parser.js Enhanced command parsing to capture its parameter with regex
.github/workflows/server-build.yml Added its input parameter for integration test control
.github/workflows/server-integration-tests.yml New workflow for server integration tests
.github/workflows/pr-cypress.yml Added its input and new server-it job
app/server/appsmith-server/src/test/it/... Added comment about RTS requirement for tests

Sequence Diagram

sequenceDiagram
    participant PR as Pull Request
    participant Parser as Tag Parser
    participant Workflow as GitHub Actions
    participant Tests as Integration Tests

    PR ->> Parser: Trigger tag parsing
    Parser -->> Workflow: Return parsed tags and 'its' flag
    Workflow ->> Tests: Conditionally run tests based on 'its'
Loading

Possibly related PRs

Suggested Labels

CI

Suggested Reviewers

  • sharat87
  • ApekshaBhosale

Poem

🤖 Workflows dance, parameters sing,
Integration tests take their wing!
its flag waves, a digital breeze,
Automating tests with elegant ease.
CI/CD magic, code's sweet delight! 🚀


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Dec 24, 2024
@nidhi-nair nidhi-nair added the ok-to-test Required label for CI label Dec 24, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
app/server/appsmith-server/src/test/utils/com/appsmith/server/git/GitServerInitializerExtension.java (1)

40-40: Ensure null-safety on the injected ArtifactService.

While Spring typically injects this service correctly, consider verifying that it is not null before use, especially for test scenarios.

.github/workflows/server-build.yml (1)

223-231: Remove trailing whitespace on line 223.

The test execution logic is correct, but there's a formatting issue.

-            
+
🧰 Tools
🪛 yamllint (1.35.1)

[error] 223-223: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c0d393a and 292b79d.

📒 Files selected for processing (6)
  • .github/workflows/pr-automation.yml (1 hunks)
  • .github/workflows/scripts/test-tag-parser.js (1 hunks)
  • .github/workflows/server-build.yml (3 hunks)
  • app/server/appsmith-server/src/test/it/com/appsmith/server/git/templates/contexts/GitContext.java (1 hunks)
  • app/server/appsmith-server/src/test/utils/com/appsmith/server/git/GitServerInitializerExtension.java (3 hunks)
  • app/server/pom.xml (3 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/pr-automation.yml

139-139: property "its" is not defined in object type {matrix: string; spec: string; tags: string}

(expression)


143-143: input "its" is typed as string by reusable workflow "./.github/workflows/server-build.yml". bool value cannot be assigned

(expression)


144-144: input "is-pg-build" is typed as string by reusable workflow "./.github/workflows/server-build.yml". bool value cannot be assigned

(expression)

🪛 yamllint (1.35.1)
.github/workflows/server-build.yml

[error] 223-223: trailing spaces

(trailing-spaces)

🔇 Additional comments (10)
app/server/appsmith-server/src/test/it/com/appsmith/server/git/templates/contexts/GitContext.java (1)

28-28: Storing the artifactType in the context store looks good.

This addition helps keep the artifact type readily accessible for downstream test extensions and setups.

app/server/appsmith-server/src/test/utils/com/appsmith/server/git/GitServerInitializerExtension.java (3)

4-4: Importing ArtifactService is appropriate.

Replacing ApplicationService with ArtifactService aligns with the move toward a dedicated artifact management approach.


59-59: Make sure the artifact type is present in the store.

If artifactType is missing or null, the subsequent SSH key generation may fail. Consider adding a fallback or appropriate error handling.


67-67: Verify the error handling of the createOrUpdateSshKeyPair call.

This call returns a reactive type. Ensure any exceptions are properly handled, e.g., logging or cleanup if the call fails.

app/server/pom.xml (4)

114-130: Unit test configuration is well-structured.

The maven-surefire-plugin is properly configured for unit tests with appropriate skip conditions and dependencies.


131-148: Integration test configuration is properly set up.

The maven-failsafe-plugin configuration correctly separates integration tests and includes necessary system properties.


46-48: LGTM! Test skip properties are well-structured.

The properties follow Maven conventions and provide granular control over test execution.

Let's verify these properties are used consistently across the project:

✅ Verification successful

Properties are correctly configured and used in the Maven build

The verification shows that the skip properties are used consistently within the app/server/pom.xml:

  • skipTests is correctly used as the master switch
  • skipITs and skipUTs are properly referenced in their respective build configurations
  • No conflicting or inconsistent usage found in other pom files
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for usage of skip properties in pom files
rg -U "skip(ITs|UTs|Tests)" -g "pom.xml"

Length of output: 356


80-103: Test source directories are properly configured.

The build-helper-maven-plugin configuration correctly adds multiple test source directories.

Let's verify the test directory structure exists:

.github/workflows/server-build.yml (2)

8-28: Workflow inputs are well-defined and documented.

The input parameters are clearly described with appropriate defaults.

Also applies to: 42-46


238-238: LGTM! Maven command correctly uses 'verify' phase.

The change to 'mvn verify' is appropriate for running both unit and integration tests.

.github/workflows/scripts/test-tag-parser.js Outdated Show resolved Hide resolved
.github/workflows/pr-automation.yml Outdated Show resolved Hide resolved
@nidhi-nair nidhi-nair changed the base branch from release to chore/mvn-its December 24, 2024 14:37
Base automatically changed from chore/mvn-its to release December 24, 2024 20:38
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
.github/workflows/pr-automation.yml (1)

138-145: ⚠️ Potential issue

Fix type mismatches in perform-it job inputs

The reusable workflow expects string inputs, but boolean expressions are being passed directly.

Apply this diff to fix the type mismatches:

  perform-it:
    needs: [ parse-tags ]
    if: success() && needs.parse-tags.outputs.its == 'true'
    uses: ./.github/workflows/server-build.yml
    secrets: inherit
    with:
-     its: 'true'
-     is-pg-build: ${{ github.event.pull_request.base.ref == 'pg' }}
+     its: 'true'
+     is-pg-build: ${{ github.event.pull_request.base.ref == 'pg' && 'true' || 'false' }}
🧰 Tools
🪛 actionlint (1.7.4)

144-144: input "its" is typed as string by reusable workflow "./.github/workflows/server-build.yml". bool value cannot be assigned

(expression)


145-145: input "is-pg-build" is typed as string by reusable workflow "./.github/workflows/server-build.yml". bool value cannot be assigned

(expression)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 63db037 and cb3fd9c.

📒 Files selected for processing (2)
  • .github/workflows/pr-automation.yml (2 hunks)
  • .github/workflows/scripts/test-tag-parser.js (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/scripts/test-tag-parser.js
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/pr-automation.yml

144-144: input "its" is typed as string by reusable workflow "./.github/workflows/server-build.yml". bool value cannot be assigned

(expression)


145-145: input "is-pg-build" is typed as string by reusable workflow "./.github/workflows/server-build.yml". bool value cannot be assigned

(expression)

.github/workflows/pr-automation.yml Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
.github/workflows/server-build.yml (3)

Line range hint 8-46: Consider using a reusable inputs definition

The input parameters are duplicated between workflow_call and workflow_dispatch triggers. Consider using a composite action or a reusable workflow to define these inputs once.

# Example approach using a composite action:
# Create .github/actions/server-inputs/action.yml
inputs:
  pr:
    description: "PR number for the workflow"
    required: false
    type: number
  # ... other inputs ...

# Then in this file:
on:
  workflow_call:
    inputs: ${{ uses: ./.github/actions/server-inputs }}
  workflow_dispatch:
    inputs: ${{ uses: ./.github/actions/server-inputs }}

224-230: LGTM! Consider adding a comment block

The test execution logic correctly handles the separation of unit and integration tests. Consider adding a comment block explaining the mutual exclusivity of these test types.

+ # Note: This workflow is designed to run either unit tests or integration tests,
+ # but not both simultaneously. The `its` parameter determines which type to run.
  # Check if this run is requesting for unit tests or integration tests
  # As of today, we don't expect both to get triggered in the same workflow

223-223: Remove trailing whitespace

There's a trailing whitespace on line 223.

-            
+
🧰 Tools
🪛 yamllint (1.35.1)

[error] 223-223: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 30e69a8 and 31a00dc.

📒 Files selected for processing (2)
  • .github/workflows/server-build.yml (4 hunks)
  • app/server/README.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • app/server/README.md
🧰 Additional context used
🪛 yamllint (1.35.1)
.github/workflows/server-build.yml

[error] 223-223: trailing spaces

(trailing-spaces)

🔇 Additional comments (1)
.github/workflows/server-build.yml (1)

384-384: Verify artifact upload skip behavior

The condition to skip artifact upload during integration tests looks correct, but let's verify this doesn't impact dependent workflows.

✅ Verification successful

Skipping artifact upload for integration tests is safe

The condition to skip artifact upload during integration tests is correct and safe. Several workflows depend on the server-build artifact, but they all use the reusable workflow with their own parameters and are not affected by the integration test runs:

  • github-release.yml: Uses artifacts for release packaging
  • build-docker-image.yml: Downloads artifacts for Docker image creation
  • test-build-docker-image.yml: Uses artifacts for testing and Docker builds
  • pr-cypress.yml: Uses artifacts for Cypress testing

Each workflow either calls server-build.yml with its own parameters or downloads previously created artifacts, so skipping artifact upload during integration tests won't impact them.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for workflows that depend on the server-build artifact

# Search for workflow files that download the server-build artifact
echo "Checking for dependent workflows..."
rg -l "uses: actions/download-artifact@.*\n.*name: server-build" .github/workflows/

Length of output: 358


Script:

#!/bin/bash
# Description: Check for workflows that depend on the server-build artifact with multiline support

# Search for workflow files that download the server-build artifact
echo "Checking for dependent workflows..."
rg -U "uses: actions/download-artifact@.*\n.*name: server-build" .github/workflows/

# Also check for direct references to server-build artifact
echo -e "\nChecking for direct references to server-build artifact..."
rg "server-build" .github/workflows/ -C 2

Length of output: 13295

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
.github/workflows/server-integration-tests.yml (1)

83-109: Inconsistency in test execution logging.

The workflow uses mvn verify but logs to mvn_integration_test.log. This could cause confusion with the log parsing logic.

Apply this diff to maintain consistency:

-            mvn verify -DskipUTs=true "${args[@]}" | tee mvn_integration_test.log
+            mvn verify -DskipUTs=true "${args[@]}" | tee mvn_verify.log
🧰 Tools
🪛 actionlint (1.7.4)

93-93: property "run_result" is not defined in object type {}

(expression)

.github/workflows/server-build.yml (1)

214-220: Improve test execution clarity.

The test execution logic could be more explicit about the mutual exclusivity of unit and integration tests.

Add a comment explaining the test execution strategy:

+            # Note: This workflow is designed to run either unit tests or integration tests exclusively,
+            # but not both in the same run. This is controlled by the 'its' input parameter.
             if [[ "${{ inputs.its }}" == "true" ]]; then
                 args+=("-DskipUTs=true")
             else
                 args+=("-DskipITs=true")
             fi
app/server/appsmith-server/src/test/it/com/appsmith/server/git/GitBranchesIT.java (1)

215-216: LGTM! Consider enhancing the RTS prerequisite check

The comment about RTS requirement is valuable. However, we could make this more robust by adding a programmatic check.

Consider adding a prerequisite check before the test:

    @TestTemplate
    @WithUserDetails(value = "api_user")
    void test(GitContext gitContext, ExtensionContext extensionContext) throws IOException, GitAPIException, InterruptedException {
+        // Verify RTS is running
+        try {
+            // Add RTS health check here
+            new Socket("localhost", RTS_PORT).close();
+        } catch (IOException e) {
+            throw new IllegalStateException("RTS must be running locally before executing this test", e);
+        }

        ExtensionContext.Store contextStore = extensionContext.getStore(ExtensionContext.Namespace.create(ArtifactBuilderExtension.class));
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 31a00dc and 982bbd8.

📒 Files selected for processing (4)
  • .github/workflows/pr-automation.yml (2 hunks)
  • .github/workflows/server-build.yml (3 hunks)
  • .github/workflows/server-integration-tests.yml (1 hunks)
  • app/server/appsmith-server/src/test/it/com/appsmith/server/git/GitBranchesIT.java (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/server-integration-tests.yml

43-43: property "run_result" is not defined in object type {}

(expression)


43-43: property "changed-files-specific" is not defined in object type {}

(expression)


50-50: property "skip-tests" is not defined in object type {is-pg-build: string; pr: number}

(expression)


93-93: property "run_result" is not defined in object type {}

(expression)

.github/workflows/server-build.yml

374-374: property "its" is not defined in object type {branch: string; is-pg-build: string; pr: number; skip-tests: string}

(expression)

.github/workflows/pr-automation.yml

145-145: input "is-pg-build" is typed as string by reusable workflow "./.github/workflows/server-integration-tests.yml". bool value cannot be assigned

(expression)

🪛 yamllint (1.35.1)
.github/workflows/server-integration-tests.yml

[error] 66-66: trailing spaces

(trailing-spaces)


[warning] 110-110: too many blank lines

(2 > 0) (empty-lines)

.github/workflows/server-build.yml

[error] 213-213: trailing spaces

(trailing-spaces)

🔇 Additional comments (5)
.github/workflows/server-integration-tests.yml (3)

3-16: LGTM! Well-structured workflow inputs.

The input parameters are well-defined with clear descriptions and appropriate types.


18-40: LGTM! Proper job setup and conditional logic.

The job configuration properly handles both PR and non-PR scenarios with appropriate checkout conditions.


55-82: LGTM! Comprehensive artifact handling.

The workflow properly manages server and RTS artifacts with appropriate extraction and setup steps.

🧰 Tools
🪛 yamllint (1.35.1)

[error] 66-66: trailing spaces

(trailing-spaces)

.github/workflows/pr-automation.yml (1)

74-74: LGTM! Added missing its output.

The its output is properly added to the parse-tags job outputs, addressing the previous review comment.

.github/workflows/server-build.yml (1)

374-374: LGTM! Smart artifact upload condition.

The condition correctly skips artifact upload for integration test runs, which don't need to be deployed.

🧰 Tools
🪛 actionlint (1.7.4)

374-374: property "its" is not defined in object type {branch: string; is-pg-build: string; pr: number; skip-tests: string}

(expression)

Comment on lines 138 to 145
perform-it:
needs: [ parse-tags, perform-test ]
if: success() && needs.parse-tags.outputs.its == 'true'
uses: ./.github/workflows/server-integration-tests.yml
secrets: inherit
with:
pr: ${{ github.event.number }}
is-pg-build: ${{ github.event.pull_request.base.ref == 'pg' }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix type mismatch in is-pg-build parameter.

The is-pg-build parameter needs to be converted to string as the workflow expects a string input.

Apply this diff to fix the type mismatch:

-      is-pg-build: ${{ github.event.pull_request.base.ref == 'pg' }}
+      is-pg-build: ${{ github.event.pull_request.base.ref == 'pg' && 'true' || 'false' }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
perform-it:
needs: [ parse-tags, perform-test ]
if: success() && needs.parse-tags.outputs.its == 'true'
uses: ./.github/workflows/server-integration-tests.yml
secrets: inherit
with:
pr: ${{ github.event.number }}
is-pg-build: ${{ github.event.pull_request.base.ref == 'pg' }}
perform-it:
needs: [ parse-tags, perform-test ]
if: success() && needs.parse-tags.outputs.its == 'true'
uses: ./.github/workflows/server-integration-tests.yml
secrets: inherit
with:
pr: ${{ github.event.number }}
is-pg-build: ${{ github.event.pull_request.base.ref == 'pg' && 'true' || 'false' }}
🧰 Tools
🪛 actionlint (1.7.4)

145-145: input "is-pg-build" is typed as string by reusable workflow "./.github/workflows/server-integration-tests.yml". bool value cannot be assigned

(expression)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
.github/workflows/pr-cypress.yml (1)

6-9: LGTM! Consider adding parameter description.

The input parameter is correctly defined. Consider adding a description field to document its purpose.

 its:
   required: false
   type: string
   default: "false"
+  description: "Set to 'true' to run integration tests"
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 982bbd8 and f5eef46.

📒 Files selected for processing (2)
  • .github/workflows/pr-automation.yml (2 hunks)
  • .github/workflows/pr-cypress.yml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/pr-automation.yml
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/pr-cypress.yml

59-59: input "is-pg-build" is typed as string by reusable workflow "./.github/workflows/server-integration-tests.yml". bool value cannot be assigned

(expression)

🔇 Additional comments (1)
.github/workflows/pr-cypress.yml (1)

52-59: ⚠️ Potential issue

Fix type mismatch in workflow input parameter.

The is-pg-build parameter needs to be converted to string to match the expected type in the reusable workflow.

-      is-pg-build: ${{ github.event.pull_request.base.ref == 'pg' }}
+      is-pg-build: ${{ github.event.pull_request.base.ref == 'pg' && 'true' || 'false' }}

Let's verify the referenced workflow exists:

✅ Verification successful

Boolean expression in workflow input needs string conversion

The verification confirms that is-pg-build is defined as a string input in the reusable workflow, so the suggested fix is correct. The boolean expression needs to be converted to a string value.

  • .github/workflows/server-integration-tests.yml expects is-pg-build as type: string with default: "false"
  • Current boolean expression ${{ github.event.pull_request.base.ref == 'pg' }} needs to be converted to string
-      is-pg-build: ${{ github.event.pull_request.base.ref == 'pg' }}
+      is-pg-build: ${{ github.event.pull_request.base.ref == 'pg' && 'true' || 'false' }}
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the server-integration-tests.yml workflow exists and check its inputs
if [ -f ".github/workflows/server-integration-tests.yml" ]; then
    echo "Workflow exists"
    grep -A 10 "workflow_call:" .github/workflows/server-integration-tests.yml
else
    echo "Workflow not found"
fi

Length of output: 489

🧰 Tools
🪛 actionlint (1.7.4)

59-59: input "is-pg-build" is typed as string by reusable workflow "./.github/workflows/server-integration-tests.yml". bool value cannot be assigned

(expression)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
.github/workflows/server-integration-tests.yml (1)

8-16: LGTM! Consider enhancing input descriptions.

The input parameters are well-defined. However, the pr input could benefit from a clearer description specifying that it's used for checking out the PR's merge commit.

       pr:
-        description: "This is the PR number in case the workflow is being called in a pull request"
+        description: "PR number used to checkout the merge commit for testing"
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f5eef46 and 960682d.

📒 Files selected for processing (2)
  • .github/workflows/pr-cypress.yml (3 hunks)
  • .github/workflows/server-integration-tests.yml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/pr-cypress.yml

59-59: input "is-pg-build" is typed as string by reusable workflow "./.github/workflows/server-integration-tests.yml". bool value cannot be assigned

(expression)

.github/workflows/server-integration-tests.yml

43-43: property "run_result" is not defined in object type {}

(expression)


43-43: property "changed-files-specific" is not defined in object type {}

(expression)


50-50: property "skip-tests" is not defined in object type {is-pg-build: string; pr: number}

(expression)


87-87: property "run_result" is not defined in object type {}

(expression)

🪛 yamllint (1.35.1)
.github/workflows/server-integration-tests.yml

[error] 60-60: trailing spaces

(trailing-spaces)


[warning] 104-104: too many blank lines

(2 > 0) (empty-lines)

🔇 Additional comments (3)
.github/workflows/server-integration-tests.yml (2)

21-24: LGTM! Fork safety and checkout logic are well implemented.

The conditional checkout logic correctly handles both PR and non-PR scenarios while maintaining security with fork checks.

Also applies to: 30-39


77-92: LGTM! Environment and database configuration are well structured.

The environment variables and conditional database URL selection are properly configured.

🧰 Tools
🪛 actionlint (1.7.4)

87-87: property "run_result" is not defined in object type {}

(expression)

.github/workflows/pr-cypress.yml (1)

85-85: LGTM! Job dependency update is correct.

Adding server-it to the needs array ensures proper workflow sequencing while always() condition maintains result reporting.

Comment on lines 42 to 43
- name: Set up JDK 17
if: steps.run_result.outputs.run_result != 'success' && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix JDK setup condition.

The condition references undefined step outputs run_result and changed-files-specific, which could prevent JDK setup from running.

-        if: steps.run_result.outputs.run_result != 'success'  && (steps.changed-files-specific.outputs.any_changed == 'true' ||  github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
+        if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Set up JDK 17
if: steps.run_result.outputs.run_result != 'success' && (steps.changed-files-specific.outputs.any_changed == 'true' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
- name: Set up JDK 17
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call'
🧰 Tools
🪛 actionlint (1.7.4)

43-43: property "run_result" is not defined in object type {}

(expression)


43-43: property "changed-files-specific" is not defined in object type {}

(expression)

Comment on lines 96 to 98
if [[ "${{ steps.run_result.outputs.run_result }}" == "failedtest" ]]; then
failed_tests="${{ steps.failed_tests.outputs.tests }}"
args+=("-DfailIfNoTests=false" "-Dsurefire.failIfNoSpecifiedTests=false" "-Dtest=${failed_tests}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix test retry logic.

The condition references undefined step outputs run_result and failed_tests, which could cause issues with test retries.

-            if [[ "${{ steps.run_result.outputs.run_result }}" == "failedtest" ]]; then
-                failed_tests="${{ steps.failed_tests.outputs.tests }}"
+            if [[ -n "${FAILED_TESTS:-}" ]]; then
+                failed_tests="${FAILED_TESTS}"

Committable suggestion skipped: line range outside the PR's diff.

.github/workflows/pr-cypress.yml Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (2)
.github/workflows/server-integration-tests.yml (2)

42-43: ⚠️ Potential issue

Fix JDK setup condition.

The condition references undefined step outputs which could prevent JDK setup from running.

-        if: steps.run_result.outputs.run_result != 'success'  && (steps.changed-files-specific.outputs.any_changed == 'true' ||  github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
+        if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call'
🧰 Tools
🪛 actionlint (1.7.4)

43-43: property "run_result" is not defined in object type {}

(expression)


43-43: property "changed-files-specific" is not defined in object type {}

(expression)


96-98: ⚠️ Potential issue

Fix test retry logic.

The condition references undefined step outputs which could cause issues with test retries.

-            if [[ "${{ steps.run_result.outputs.run_result }}" == "failedtest" ]]; then
-                failed_tests="${{ steps.failed_tests.outputs.tests }}"
+            if [[ -n "${FAILED_TESTS:-}" ]]; then
+                failed_tests="${FAILED_TESTS}"
🧹 Nitpick comments (2)
.github/workflows/server-integration-tests.yml (2)

38-39: Add comment explaining the PR=0 condition.

Consider adding a comment explaining that PR=0 represents non-pull request scenarios for better maintainability.


55-72: Remove trailing whitespace.

Remove trailing whitespace on line 60 to maintain consistent formatting.

🧰 Tools
🪛 yamllint (1.35.1)

[error] 60-60: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 960682d and 4aa2f3a.

📒 Files selected for processing (1)
  • .github/workflows/server-integration-tests.yml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/server-integration-tests.yml

43-43: property "run_result" is not defined in object type {}

(expression)


43-43: property "changed-files-specific" is not defined in object type {}

(expression)


50-50: property "skip-tests" is not defined in object type {is-pg-build: string; pr: number}

(expression)


87-87: property "run_result" is not defined in object type {}

(expression)

🪛 yamllint (1.35.1)
.github/workflows/server-integration-tests.yml

[error] 60-60: trailing spaces

(trailing-spaces)


[warning] 104-104: too many blank lines

(2 > 0) (empty-lines)

🔇 Additional comments (2)
.github/workflows/server-integration-tests.yml (2)

1-17: LGTM! Well-structured workflow configuration.

The workflow triggers and input parameters are properly defined with clear descriptions.


18-27: LGTM! Secure job configuration.

Good security practice checking repository ownership before running tests.

.github/workflows/server-integration-tests.yml Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
.github/workflows/server-integration-tests.yml (2)

51-52: Consider enhancing PostgreSQL container configuration.

While the current setup works, consider adding:

  1. Health check to ensure PostgreSQL is ready
  2. Volume mount for data persistence
  3. Environment variables for database name and user
 docker run --name appsmith-pg -p 5432:5432 -d -e POSTGRES_PASSWORD=password postgres:alpine postgres -N 1500
+docker run --name appsmith-pg \
+  -p 5432:5432 \
+  -e POSTGRES_PASSWORD=password \
+  -e POSTGRES_DB=appsmith \
+  -e POSTGRES_USER=appsmith \
+  -v pgdata:/var/lib/postgresql/data \
+  --health-cmd pg_isready \
+  --health-interval=10s \
+  --health-timeout=5s \
+  --health-retries=5 \
+  -d postgres:alpine postgres -N 1500

59-59: Minor formatting issues.

  • Remove trailing spaces on line 59
  • Remove extra blank lines at the end of file

Also applies to: 98-98

🧰 Tools
🪛 yamllint (1.35.1)

[error] 59-59: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4aa2f3a and 9df624e.

📒 Files selected for processing (1)
  • .github/workflows/server-integration-tests.yml (1 hunks)
🧰 Additional context used
🪛 yamllint (1.35.1)
.github/workflows/server-integration-tests.yml

[error] 59-59: trailing spaces

(trailing-spaces)


[warning] 98-98: too many blank lines

(2 > 0) (empty-lines)

🔇 Additional comments (3)
.github/workflows/server-integration-tests.yml (3)

1-17: LGTM! Well-structured workflow configuration.

The workflow triggers and input parameters are properly defined with appropriate descriptions and types.


18-27: LGTM! Good security practice with repository validation.

The job configuration includes proper security checks to prevent unauthorized executions from forked repositories.


28-40: LGTM! Proper handling of PR and non-PR checkouts.

The checkout configuration correctly handles both scenarios using mutually exclusive conditions.

Comment on lines +72 to +75
- name: Run rts using the untarred files
run: |
nohup -- node app/client/packages/rts/dist/bundle/server.js &

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add verification for RTS server startup.

The RTS server is started in the background, but there's no verification that it started successfully.

 nohup -- node app/client/packages/rts/dist/bundle/server.js &
+# Wait for RTS server to be ready
+for i in {1..30}; do
+  if curl -s http://localhost:8091/health >/dev/null; then
+    echo "RTS server is ready"
+    break
+  fi
+  if [ $i -eq 30 ]; then
+    echo "RTS server failed to start"
+    exit 1
+  fi
+  echo "Waiting for RTS server... ($i/30)"
+  sleep 1
+done
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Run rts using the untarred files
run: |
nohup -- node app/client/packages/rts/dist/bundle/server.js &
- name: Run rts using the untarred files
run: |
nohup -- node app/client/packages/rts/dist/bundle/server.js &
# Wait for RTS server to be ready
for i in {1..30}; do
if curl -s http://localhost:8091/health >/dev/null; then
echo "RTS server is ready"
break
fi
if [ $i -eq 30 ]; then
echo "RTS server failed to start"
exit 1
fi
echo "Waiting for RTS server... ($i/30)"
sleep 1
done

Comment on lines 93 to 97
args=()

# Run tests and capture logs
mvn verify -DskipUTs=true "${args[@]}" | tee mvn_integration_test.log

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add test failure handling and retry mechanism.

The current implementation doesn't handle test failures or provide a retry mechanism for flaky tests.

 args=()
+max_retries=2
+retry_count=0
+
+while [ $retry_count -lt $max_retries ]; do
+  # Run tests and capture logs
+  if mvn verify -DskipUTs=true "${args[@]}" | tee mvn_integration_test.log; then
+    echo "Tests passed successfully"
+    exit 0
+  fi
+  
+  retry_count=$((retry_count + 1))
+  if [ $retry_count -lt $max_retries ]; then
+    echo "Tests failed, attempting retry $retry_count of $max_retries"
+    sleep 30  # Wait before retry
+  fi
+done
 
-# Run tests and capture logs
-mvn verify -DskipUTs=true "${args[@]}" | tee mvn_integration_test.log
+echo "Tests failed after $max_retries attempts"
+exit 1
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
args=()
# Run tests and capture logs
mvn verify -DskipUTs=true "${args[@]}" | tee mvn_integration_test.log
args=()
max_retries=2
retry_count=0
while [ $retry_count -lt $max_retries ]; do
# Run tests and capture logs
if mvn verify -DskipUTs=true "${args[@]}" | tee mvn_integration_test.log; then
echo "Tests passed successfully"
exit 0
fi
retry_count=$((retry_count + 1))
if [ $retry_count -lt $max_retries ]; then
echo "Tests failed, attempting retry $retry_count of $max_retries"
sleep 30 # Wait before retry
fi
done
echo "Tests failed after $max_retries attempts"
exit 1

Copy link

Failed server tests

  • com.appsmith.server.git.ServerSchemaMigrationEnforcerTest#saveGitRepo_ImportAndThenExport_diffOccurs

1 similar comment
Copy link

Failed server tests

  • com.appsmith.server.git.ServerSchemaMigrationEnforcerTest#saveGitRepo_ImportAndThenExport_diffOccurs

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (4)
.github/workflows/server-build.yml (2)

8-23: Enhance input parameter descriptions for better clarity.

While the descriptions are functional, they could be more informative:

  • For skip-tests: Specify what tests are skipped
  • For is-pg-build: Clarify what PG means (PostgreSQL)
-        description: "Skip tests flag"
+        description: "Skip running unit tests if set to true"
-        description: "Flag for PG build"
+        description: "Use PostgreSQL instead of MongoDB if set to true"

213-213: LGTM! Clean implementation of array-based Maven arguments.

The array-based approach for Maven test arguments is clean and maintainable. Consider extracting the test result processing logic into a separate script file for better maintainability.

.github/workflows/server-integration-tests.yml (2)

28-35: Add Redis container configuration and health check.

The Redis service container lacks resource limits and health check configuration, which could affect test reliability.

 redis:
   image: redis
+  options: >-
+    --health-cmd "redis-cli ping"
+    --health-interval 10s
+    --health-timeout 5s
+    --health-retries 5
+  env:
+    REDIS_MAXMEMORY: "256mb"
+    REDIS_MAXMEMORY_POLICY: "allkeys-lru"
   ports:
     - 6379:6379

57-62: Add PostgreSQL container health check.

The PostgreSQL container startup should be verified before proceeding.

 docker run --name appsmith-pg -p 5432:5432 -d -e POSTGRES_PASSWORD=password postgres:alpine postgres -N 1500
+# Wait for PostgreSQL to be ready
+for i in {1..30}; do
+  if docker exec appsmith-pg pg_isready -U postgres >/dev/null 2>&1; then
+    echo "PostgreSQL is ready"
+    break
+  fi
+  if [ $i -eq 30 ]; then
+    echo "PostgreSQL failed to start"
+    exit 1
+  fi
+  echo "Waiting for PostgreSQL... ($i/30)"
+  sleep 1
+done
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9df624e and 28ec34d.

📒 Files selected for processing (2)
  • .github/workflows/server-build.yml (2 hunks)
  • .github/workflows/server-integration-tests.yml (1 hunks)
🧰 Additional context used
🪛 yamllint (1.35.1)
.github/workflows/server-integration-tests.yml

[error] 68-68: trailing spaces

(trailing-spaces)


[warning] 108-108: too many blank lines

(2 > 0) (empty-lines)

🔇 Additional comments (4)
.github/workflows/server-integration-tests.yml (4)

1-17: LGTM! Well-structured workflow configuration.

The workflow triggers and inputs are properly defined with appropriate descriptions and default values.


37-49: LGTM! Proper checkout configuration.

The checkout steps correctly handle both PR and non-PR scenarios using the latest checkout action.


81-84: Add RTS server health check.

The RTS server is started in the background without verifying its successful startup.


85-107: Add test failure handling and retry mechanism.

The current implementation doesn't handle test failures or provide a retry mechanism for flaky tests.

Copy link

Failed server tests

  • com.appsmith.server.git.ServerSchemaMigrationEnforcerTest#saveGitRepo_ImportAndThenExport_diffOccurs

@nidhi-nair nidhi-nair merged commit d718437 into release Jan 1, 2025
43 of 45 checks passed
@nidhi-nair nidhi-nair deleted the ci/its branch January 1, 2025 10:00
@coderabbitai coderabbitai bot mentioned this pull request Jan 1, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants