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: Update dispatch option #37066

Merged
merged 1 commit into from
Oct 25, 2024
Merged

chore: Update dispatch option #37066

merged 1 commit into from
Oct 25, 2024

Conversation

sagar-qa007
Copy link
Contributor

@sagar-qa007 sagar-qa007 commented Oct 24, 2024

Description

We’ve often faced challenges in running server-specific tests efficiently for individual PRs. To streamline this process and improve testing speed, I’ve implemented the workflow dispatch feature, enabling quick and on-demand execution of server tests.

Fixes #37060

Automation

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

🔍 Cypress test results

Warning

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/11497895741
Commit: 48c3cd9
Cypress dashboard.
Tags: @tag.IDE
Spec:
It seems like no tests ran 😔. We are not able to recognize it, please check workflow here.


Fri, 25 Oct 2024 05:13:19 UTC

Communication

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

  • Yes
  • No

@sagar-qa007 sagar-qa007 requested a review from sharat87 as a code owner October 24, 2024 10:47
Copy link
Contributor

coderabbitai bot commented Oct 24, 2024

Walkthrough

The changes introduce a workflow_dispatch trigger to the GitHub Actions workflow in .github/workflows/server-build.yml. This allows for manual triggering of the workflow with specific input parameters: pr, skip-tests, branch, and is-pg-build. The job structure remains unchanged, ensuring the workflow's existing logic for handling pull requests and tests is preserved while enhancing usability for manual builds and testing scenarios.

Changes

File Path Change Summary
.github/workflows/server-build.yml Added workflow_dispatch trigger and input parameters: pr, skip-tests, branch, is-pg-build.

Assessment against linked issues

Objective Addressed Explanation
Adding dispatch option in server workflow for server unit test verification (#37060)

Possibly related PRs

Suggested labels

Task, skip-changelog, ok-to-test

Suggested reviewers

  • sharat87
  • yatinappsmith

In the land of code where workflows thrive,
A new dispatch trigger helps builds come alive.
With inputs like pr and branch in tow,
Manual testing's now a breeze, don’t you know?
So raise your flags and let the builds run free,
For our server workflow is as smooth as can be! 🎉


🪧 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 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 Oct 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: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 0b93768 and 48c3cd9.

📒 Files selected for processing (1)
  • .github/workflows/server-build.yml (1 hunks)
🔇 Additional comments (2)
.github/workflows/server-build.yml (2)

26-45: Implementation aligns with PR objectives.

The addition of workflow_dispatch successfully implements the requirement for manual server test execution while maintaining compatibility with existing automation. The input parameters mirror the workflow_call configuration, ensuring consistent behavior across different trigger methods.


26-45: Verify workflow integration with existing conditions.

The workflow uses these inputs in multiple conditions. For example:

if: inputs.skip-tests != 'true'
if: inputs.is-pg-build == 'true'

These string comparisons will need updates if you switch to boolean types.

Let's verify all usage of these parameters:

✅ Verification successful

The previous command might have failed due to escaping issues. Let's try a simpler approach to find all workflow files and examine their content for these input parameters.


Let's try a different approach by examining each yaml file separately and looking for these specific input usages. This should help us identify where and how these inputs are being used in conditions.


Let's focus our search specifically on GitHub workflow files since the original review comment was about .github/workflows/server-build.yml. This should help us find where these input parameters are actually being used in conditions.


Let's examine the entire content of the server-build.yml file directly to see how these input parameters are being used in the workflow. This will help us verify if there are any string comparisons using these inputs that would need updates.


No changes needed for string comparisons in workflow conditions

After examining the server-build.yml workflow file, I found that the input parameters are correctly used in conditions. The string comparisons are intentionally using string values 'true'/'false' because:

  1. The input parameters are explicitly defined as type: string with default: "false"
  2. The conditions in the workflow are correctly comparing with string literals:
    • if: inputs.skip-tests != 'true'
    • if: inputs.is-pg-build == 'true'

This is the standard way to handle boolean flags in GitHub Actions workflows, as workflow inputs of type string with 'true'/'false' values are a common pattern.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Find all conditions using these input parameters
rg "inputs\.(skip-tests|is-pg-build)" -A 2 -B 2

Length of output: 49


Script:

#!/bin/bash
# Let's try a different approach to find these workflow inputs usage
# Search in all yaml/yml files
fd -e yml -e yaml -x grep -l "inputs" {} \; | xargs cat | grep -A 2 -B 2 "inputs\.\(skip-tests\|is-pg-build\)"

Length of output: 113


Script:

#!/bin/bash
# Let's try one more time with simpler grep approach
fd -e yml -e yaml | while read -r file; do
  echo "=== $file ==="
  grep -A 2 -B 2 "inputs\.skip-tests\|inputs\.is-pg-build" "$file" || true
done

Length of output: 8947


Script:

#!/bin/bash
# Let's try searching in GitHub workflow files specifically
fd -e yml -e yaml -p '.github/workflows' | while read -r file; do
  echo "=== $file ==="
  grep -A 2 -B 2 "inputs\." "$file" || true
done

Length of output: 55


Script:

#!/bin/bash
# Try a direct approach with the specific file
if [ -f ".github/workflows/server-build.yml" ]; then
    echo "=== Content of server-build.yml ==="
    cat ".github/workflows/server-build.yml"
fi

Length of output: 16995

Comment on lines +26 to +45
workflow_dispatch:
inputs:
pr:
description: "PR number for the workflow"
required: false
type: number
skip-tests:
description: "Skip tests flag"
required: false
type: string
default: "false"
branch:
description: "Branch for the build"
required: false
type: string
is-pg-build:
description: "Flag for PG build"
required: false
type: string
default: "false"
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

Consider using boolean type for flag parameters.

The skip-tests and is-pg-build parameters are boolean flags but defined as string type with "false" default. Using the native boolean type would be more appropriate and consistent with GitHub Actions best practices.

   workflow_dispatch:
     inputs:
       pr:
         description: "PR number for the workflow"
         required: false
         type: number
       skip-tests:
         description: "Skip tests flag"
         required: false
-        type: string
-        default: "false"
+        type: boolean
+        default: false
       branch:
         description: "Branch for the build"
         required: false
         type: string
       is-pg-build:
         description: "Flag for PG build"
         required: false
-        type: string
-        default: "false"
+        type: boolean
+        default: 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
workflow_dispatch:
inputs:
pr:
description: "PR number for the workflow"
required: false
type: number
skip-tests:
description: "Skip tests flag"
required: false
type: string
default: "false"
branch:
description: "Branch for the build"
required: false
type: string
is-pg-build:
description: "Flag for PG build"
required: false
type: string
default: "false"
workflow_dispatch:
inputs:
pr:
description: "PR number for the workflow"
required: false
type: number
skip-tests:
description: "Skip tests flag"
required: false
type: boolean
default: false
branch:
description: "Branch for the build"
required: false
type: string
is-pg-build:
description: "Flag for PG build"
required: false
type: boolean
default: false

@sagar-qa007 sagar-qa007 added the ok-to-test Required label for CI label Oct 24, 2024
@yatinappsmith yatinappsmith merged commit abc064b into release Oct 25, 2024
49 of 51 checks passed
@yatinappsmith yatinappsmith deleted the chore/addinngdispatch branch October 25, 2024 05:15
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.

3 participants