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

workflow which ensures that talawa Api app starts in docker #2759

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

prayanshchh
Copy link

@prayanshchh prayanshchh commented Dec 14, 2024

What kind of change does this PR introduce?
Changing workflow to ensure that talawa api starts in docker

Issue Number:
#2638

Fixes #

Did you add tests for your changes?
No

Snapshots/Videos:

If relevant, did you update the documentation?

Summary

Does this PR introduce a breaking change?

Other information

Have you read the contributing guide?

Summary by CodeRabbit

  • New Features

    • Introduced a new Docker-Check job in the CI/CD workflow to ensure the Talawa API functions correctly within a Docker container.
  • Bug Fixes

    • Corrected minor syntax issues in the Docker-Check job configuration.

Copy link

coderabbitai bot commented Dec 14, 2024

Walkthrough

This pull request introduces a new Docker-Check job to the GitHub Actions workflow for the Talawa API project. The job ensures that the application can successfully start within a Docker container during the CI/CD pipeline. It performs comprehensive checks including repository checkout, dependency caching, container startup, and health checks for MongoDB, Redis, and the Talawa API itself. The addition aims to improve the reliability of the continuous integration process by verifying the application's Docker deployment capabilities.

Changes

File Change Summary
.github/workflows/pull-request.yml Added Docker-Check job with steps to:
- Checkout repository
- Setup Node.js
- Cache dependencies
- Verify Docker container startup
- Perform health checks for MongoDB, Redis, and Talawa API

Possibly related issues

Possibly related PRs

Suggested reviewers

  • palisadoes
  • varshith257

Poem

🐰 Docker checks, oh what a delight!
Containers spinning, everything tight
Workflows dancing, tests taking flight
No bug shall escape our rabbit's might
CI/CD magic, shining so bright! 🚢

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. This feature will be included in our Pro Plan when released.


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.

Copy link

Our Pull Request Approval Process

Thanks for contributing!

Testing Your Code

Remember, your PRs won't be reviewed until these criteria are met:

  1. We don't merge PRs with poor code quality.
    1. Follow coding best practices such that CodeRabbit.ai approves your PR.
  2. We don't merge PRs with failed tests.
    1. When tests fail, click on the Details link to learn more.
    2. Write sufficient tests for your changes (CodeCov Patch Test). Your testing level must be better than the target threshold of the repository
    3. Tests may fail if you edit sensitive files. Ask to add the ignore-sensitive-files-pr label if the edits are necessary.
  3. We cannot merge PRs with conflicting files. These must be fixed.

Our policies make our code better.

Reviewers

Do not assign reviewers. Our Queue Monitors will review your PR and assign them.
When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

CONTRIBUTING.md

Read our CONTRIBUTING.md file. Most importantly:

  1. PRs with issues not assigned to you will be closed by the reviewer
  2. Fix the first comment in the PR so that each issue listed automatically closes

Other

  1. 🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.
  2. Read the CONTRIBUTING.md file make

Copy link

@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: 5

🧹 Outside diff range and nitpick comments (2)
.github/workflows/pull-request.yml (2)

366-372: Use environment variable for health check URL

The health check URL is hardcoded. Consider using the HEALTH_CHECK_URL environment variable:

-until docker-compose -f docker-compose.dev.yaml exec -T talawa-api-dev curl -sf "http://talawa-api-dev:4000/health" 2>&1 || [ $timeout -eq 0 ]; do
+until docker-compose -f docker-compose.dev.yaml exec -T talawa-api-dev curl -sf "${HEALTH_CHECK_URL}/health" 2>&1 || [ $timeout -eq 0 ]; do
🧰 Tools
🪛 actionlint (1.7.4)

372-372: could not parse as YAML: yaml: line 372: could not find expected ':'

(syntax-check)

🪛 yamllint (1.35.1)

[error] 366-366: trailing spaces

(trailing-spaces)


392-407: Fix environment variables indentation

The env: section should be at the same level as steps::

-  env:
-      HEALTH_CHECK_URL: http://localhost:4000
-      COMPOSE_PROJECT_NAME: pr-${{ github.event.pull_request.number }}
+    env:
+      HEALTH_CHECK_URL: http://localhost:4000
+      COMPOSE_PROJECT_NAME: pr-${{ github.event.pull_request.number }}
🧰 Tools
🪛 yamllint (1.35.1)

[error] 407-407: 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 6bd0fec and 4fa5812.

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

372-372: could not parse as YAML: yaml: line 372: could not find expected ':'

(syntax-check)

🪛 yamllint (1.35.1)
.github/workflows/pull-request.yml

[error] 322-322: trailing spaces

(trailing-spaces)


[error] 323-323: trailing spaces

(trailing-spaces)


[error] 327-327: trailing spaces

(trailing-spaces)


[error] 366-366: trailing spaces

(trailing-spaces)


[error] 407-407: trailing spaces

(trailing-spaces)


[error] 374-374: syntax error: could not find expected ':'

(syntax)

.github/workflows/pull-request.yml Outdated Show resolved Hide resolved
.github/workflows/pull-request.yml Outdated Show resolved Hide resolved
.github/workflows/pull-request.yml Outdated Show resolved Hide resolved
.github/workflows/pull-request.yml Outdated Show resolved Hide resolved
Comment on lines 299 to 407
with:
node-version: '22.x'

- name: Cache Node.js dependencies
uses: actions/cache@v4
with:
path: |
~/.npm
node_modules
key: ${{ runner.os }}-docker-check-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-docker-check-

- name: Check if Talawa API starts in Docker
run : |
# Ensure no containers are running
docker-compose -f docker-compose.dev.yaml down -v || true

# Verify docker-compose file exists
if [! -f "docker-compose.dev.yaml"]; then
echo "Error: docker-compose.dev.yaml not found"
exit 1
fi

# Start containers
if ! docker-compose -f docker-compose.dev.yaml up -d --build; then
echo "Failed to start containers"
docker-compose -f docker-compose.dev.yaml logs
exit 1
fi

# Wait for MongoDB and Redis to be ready
echo "Waiting for MongoDB..."
timeout=30
until docker-compose -f docker-compose.dev.yaml exec -T mongodb mongo --eval "db.runCommand('ping').ok">/dev/null 2>&1 || [ $timeout -eq 0]; do
sleep 1
((timeout--))
done
if [ $timeout -eq 0 ]; then
echo "Error: MongoDB failed to start within timeout"
docker-compose -f docker-compose.dev.yaml logs mongodb
docker-compose -f docker-compose.dev.yaml down -v
exit 1
fi

echo "Waiting for Redis..."
timeout=30
until docker-compose -f docker-compose.dev.yaml exec -T redis-stack-server redis-cli ping >dev/null 2>&1 || [ $timemout -eq 0]; do
sleep 1
((timeout--))
done
if[ $timeout -eq 0 ]; then
echo "Error: Redis failed to start within timeout"
docker-compose -f docker-compose.dev.yaml logs redis-stack-server
docker-compose -f docker-compose.dev.yaml down -v
exit 1
fi

# Wait for TALAWA API to be healthy
timeout=60
until docker-compose -f docker-compose.dev.yaml exec -T talawa-api-dev curl -sf "http://talawa-api-dev:4000/health" 2>&1 || [ $timeout -eq 0 ]; do
echo "Waiting for API to start... ($timeout seconds remaining)"
sleep 1
((timeout--))
done

if [ $timeout -eq 0 ]; then
echo "Error: API failed to start within timeout"
docker-compose -f docker-compose.dev.yaml logs
docker-compose -f docker-compose.dev.yaml down -v
exit 1
fi

echo "API started successfully"

# Ensure cleanup runs even if the script fails
cleanup() {
echo "Cleaning up containers..."
if ! docker-compose -f docker-compose.dev.yaml down -v; then
echo "Warning: Failed to cleanup containers"
fi
}

trap cleanup EXIT
env:
HEALTH_CHECK_URL: http://localhost:4000
COMPOSE_PROJECT_NAME: pr-${{ github.event.pull_request.number }}
MONGO_DB_URL: mongodb://mongodb:27017/talawa-test-db
REDIS_HOST: redis-stack-server
REDIS_PORT: 6379
ACCESS_TOKEN_SECRET: ${{ github.event.repository.name }}_access_${{ github.sha }}
REFRESH_TOKEN_SECRET: ${{ github.event.repository.name }}_refresh_${{ github.sha }}
LAST_RESORT_SUPERADMIN_EMAIL: "[email protected]"
COLORIZE_LOGS: "true"
LOG_LEVEL: "info"
RECAPTCHA_SITE_KEY: ${{secrets.RECAPTCHA_SITE_KEY}}
RECAPTCHA_SECRET_KEY: ${{secrets.RECAPTCHA_SECRET_KEY}}
MAIL_USERNAME: ${{secrets.MAIL_USERNAME}}
MAIL_PASSWORD: ${{secrets.MAIL_PASSWORD}}

Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Docker configuration needs adjustments for health checks and environment variables

The workflow implementation has a few mismatches with the actual docker-compose.dev.yaml configuration:

  • The health check URL in the workflow uses port 4000, but the docker-compose file doesn't expose this port for talawa-api-dev service
  • Some environment variables set in the workflow (like ACCESS_TOKEN_SECRET, MAIL_USERNAME) are not configured in the docker-compose file
  • The MongoDB URL format differs between workflow (talawa-test-db) and docker-compose configuration

Required changes:

  • Add port mapping for talawa-api-dev service: - "4000:4000"
  • Add missing environment variables to talawa-api-dev service configuration
  • Align MongoDB URL format between workflow and docker-compose
🔗 Analysis chain

Overall implementation looks good with minor improvements needed

The Docker check implementation is well-structured with proper error handling, timeouts, and cleanup. It successfully addresses the PR objective of ensuring the Talawa API starts in Docker. The suggested fixes are primarily syntax-related and should be addressed for better reliability.

Let's verify the docker-compose file existence and content:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify docker-compose file and its configuration
if [ -f "docker-compose.dev.yaml" ]; then
  echo "docker-compose.dev.yaml exists"
  # Check for required services
  yq e '.services | keys' docker-compose.dev.yaml
  # Check for required environment variables
  yq e '.services.*.environment[]' docker-compose.dev.yaml
else
  echo "docker-compose.dev.yaml not found"
  exit 1
fi

Length of output: 402


Script:

#!/bin/bash
# Let's verify the docker-compose file content directly using cat
if [ -f "docker-compose.dev.yaml" ]; then
  echo "docker-compose.dev.yaml exists"
  cat docker-compose.dev.yaml
else
  echo "docker-compose.dev.yaml not found"
  exit 1
fi

Length of output: 1570

🧰 Tools
🪛 actionlint (1.7.4)

372-372: could not parse as YAML: yaml: line 372: could not find expected ':'

(syntax-check)

🪛 yamllint (1.35.1)

[error] 322-322: trailing spaces

(trailing-spaces)


[error] 323-323: trailing spaces

(trailing-spaces)


[error] 327-327: trailing spaces

(trailing-spaces)


[error] 366-366: trailing spaces

(trailing-spaces)


[error] 407-407: trailing spaces

(trailing-spaces)


[error] 374-374: syntax error: could not find expected ':'

(syntax)

@prayanshchh
Copy link
Author

making changes as suggested

…ansh-talawa-api into api_fail_docker

merge# Please enter a commit message to explain why this merge is necessary,
Copy link

@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

🧹 Outside diff range and nitpick comments (2)
.github/workflows/pull-request.yml (2)

311-320: Optimize cache configuration

Consider adding package-lock.json to the cache key for better cache hits.

 - name: Cache Node.js dependencies
   uses: actions/cache@v4
   with:
     path: |
       ~/.npm
       node_modules
-    key: ${{ runner.os }}-docker-check-${{ hashFiles('**/package-lock.json') }}
+    key: ${{ runner.os }}-docker-check-node-${{ hashFiles('package-lock.json') }}
     restore-keys: |
-      ${{ runner.os }}-docker-check-
+      ${{ runner.os }}-docker-check-node-

333-337: Improve error handling in container startup

Consider capturing and displaying the exit code for better debugging.

-if ! timeout 300 docker-compose -f docker-compose.dev.yaml up -d --build; then
+if ! timeout 300 docker-compose -f docker-compose.dev.yaml up -d --build; then
+  exit_code=$?
   echo "Failed to start containers"
+  echo "Exit code: $exit_code"
   docker-compose -f docker-compose.dev.yaml logs
   exit 1
 fi
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4fa5812 and 57ae541.

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

372-372: could not parse as YAML: yaml: line 372: could not find expected ':'

(syntax-check)

🪛 yamllint (1.35.1)
.github/workflows/pull-request.yml

[error] 322-322: trailing spaces

(trailing-spaces)


[error] 323-323: trailing spaces

(trailing-spaces)


[error] 327-327: trailing spaces

(trailing-spaces)


[error] 366-366: trailing spaces

(trailing-spaces)


[error] 407-407: trailing spaces

(trailing-spaces)


[error] 374-374: syntax error: could not find expected ':'

(syntax)

🔇 Additional comments (2)
.github/workflows/pull-request.yml (2)

307-307: Fix action step configuration syntax

The Node.js setup step has incorrect syntax.

-- uses: actions/setup-node@v4
+ - uses: actions/setup-node@v4

392-407: Verify environment variable configuration

Please verify that these environment variables match the ones in docker-compose.dev.yaml.

🧰 Tools
🪛 yamllint (1.35.1)

[error] 407-407: trailing spaces

(trailing-spaces)

.github/workflows/pull-request.yml Outdated Show resolved Hide resolved
.github/workflows/pull-request.yml Outdated Show resolved Hide resolved
Copy link

@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: 4

🧹 Outside diff range and nitpick comments (2)
.github/workflows/pull-request.yml (2)

393-407: LGTM: Environment variables are well configured

The environment variables are properly set with appropriate use of secrets. Just remove trailing spaces at line 407.

-      MAIL_PASSWORD: ${{secrets.MAIL_PASSWORD}}
-             
+      MAIL_PASSWORD: ${{secrets.MAIL_PASSWORD}}

299-407: Consider enhancing the Docker health check implementation

Some suggestions to improve the implementation:

  1. Consider using Docker's built-in HEALTHCHECK instruction in Dockerfile instead of shell-based health checks
  2. Consider implementing exponential backoff for health checks instead of fixed intervals
  3. Consider adding container resource limits to prevent resource exhaustion

These changes would make the health checks more robust and maintainable.

🧰 Tools
🪛 actionlint (1.7.4)

372-372: could not parse as YAML: yaml: line 372: could not find expected ':'

(syntax-check)

🪛 yamllint (1.35.1)

[error] 322-322: trailing spaces

(trailing-spaces)


[error] 323-323: trailing spaces

(trailing-spaces)


[error] 327-327: trailing spaces

(trailing-spaces)


[error] 366-366: trailing spaces

(trailing-spaces)


[error] 374-374: syntax error: could not find expected ':'

(syntax)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 57ae541 and cfec867.

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

372-372: could not parse as YAML: yaml: line 372: could not find expected ':'

(syntax-check)

🪛 yamllint (1.35.1)
.github/workflows/pull-request.yml

[error] 322-322: trailing spaces

(trailing-spaces)


[error] 323-323: trailing spaces

(trailing-spaces)


[error] 327-327: trailing spaces

(trailing-spaces)


[error] 366-366: trailing spaces

(trailing-spaces)


[error] 408-408: trailing spaces

(trailing-spaces)


[error] 374-374: syntax error: could not find expected ':'

(syntax)

🔇 Additional comments (2)
.github/workflows/pull-request.yml (2)

299-320: LGTM: Job configuration follows best practices

The job configuration is well-structured with proper dependency management and caching strategy.


353-364: ⚠️ Potential issue

Fix Redis health check syntax

There's a syntax error in the if condition:

-          if[ $timeout -eq 0 ]; then
+          if [ $timeout -eq 0 ]; then

Likely invalid or redundant comment.

.github/workflows/pull-request.yml Outdated Show resolved Hide resolved
.github/workflows/pull-request.yml Outdated Show resolved Hide resolved
.github/workflows/pull-request.yml Outdated Show resolved Hide resolved
.github/workflows/pull-request.yml Outdated Show resolved Hide resolved
Copy link

@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

🧹 Outside diff range and nitpick comments (2)
.github/workflows/pull-request.yml (2)

321-337: Fix formatting and enhance error logging.

  1. Remove trailing spaces after run : and in the if condition
  2. Add container logs to the error message when docker-compose file is not found
-        run : | 
+        run: |
           # Ensure no containers are running
           docker-compose -f docker-compose.dev.yaml down -v || true

           # Verify docker-compose file exists
-          if [ ! -f "docker-compose.dev.yaml" ]; then 
+          if [ ! -f "docker-compose.dev.yaml" ]; then
             echo "Error: docker-compose.dev.yaml not found"
+            docker-compose -f docker-compose.dev.yaml logs
             exit 1
           fi
🧰 Tools
🪛 yamllint (1.35.1)

[error] 322-322: trailing spaces

(trailing-spaces)


[error] 327-327: trailing spaces

(trailing-spaces)


366-382: Enhance API health check implementation.

Consider adding additional health check parameters to ensure comprehensive API readiness:

  1. Add request timeout to curl command
  2. Check for specific health check response content
-          until docker-compose -f docker-compose.dev.yaml exec -T talawa-api-dev curl -sf "http://localhost:4000/health" 2>&1 || [ $timeout -eq 0 ]; do
+          until docker-compose -f docker-compose.dev.yaml exec -T talawa-api-dev curl -sf --max-time 5 "http://localhost:4000/health" 2>&1 | grep -q '"status":"healthy"' || [ $timeout -eq 0 ]; do
🧰 Tools
🪛 yamllint (1.35.1)

[error] 366-366: 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 cfec867 and 1544502.

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

384-384: could not parse as YAML: yaml: line 384: could not find expected ':'

(syntax-check)

🪛 yamllint (1.35.1)
.github/workflows/pull-request.yml

[error] 322-322: trailing spaces

(trailing-spaces)


[error] 327-327: trailing spaces

(trailing-spaces)


[error] 366-366: trailing spaces

(trailing-spaces)


[error] 409-409: trailing spaces

(trailing-spaces)


[error] 388-388: syntax error: could not find expected ':'

(syntax)

🔇 Additional comments (2)
.github/workflows/pull-request.yml (2)

299-320: LGTM! Job configuration follows best practices.

The job configuration is well-structured with proper dependency setup, Node.js configuration, and dependency caching.


299-409: Overall implementation achieves the PR objective.

The Docker check implementation successfully verifies that the Talawa API starts correctly in a Docker environment. It includes proper health checks, timeouts, and cleanup procedures. The remaining issues are mostly syntax and formatting related, which have been addressed in previous comments.

🧰 Tools
🪛 actionlint (1.7.4)

384-384: could not parse as YAML: yaml: line 384: could not find expected ':'

(syntax-check)

🪛 yamllint (1.35.1)

[error] 322-322: trailing spaces

(trailing-spaces)


[error] 327-327: trailing spaces

(trailing-spaces)


[error] 366-366: trailing spaces

(trailing-spaces)


[error] 409-409: trailing spaces

(trailing-spaces)


[error] 388-388: syntax error: could not find expected ':'

(syntax)

.github/workflows/pull-request.yml Outdated Show resolved Hide resolved
Copy link

@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

🧹 Outside diff range and nitpick comments (2)
.github/workflows/pull-request.yml (2)

367-380: Fix indentation in API health check.

The indentation is inconsistent in this section, which affects readability.

-            # Wait for TALAWA API to be healthy 
-          until docker-compose -f docker-compose.dev.yaml exec -T talawa-api-dev curl -sf "http://localhost:4000/health" 2>&1 || [ $timeout -eq 0 ]; do
-            echo "Waiting for API to start... ($timeout seconds remaining)"
-            sleep 1
-            ((timeout--))
-           done
+          # Wait for TALAWA API to be healthy 
+          until docker-compose -f docker-compose.dev.yaml exec -T talawa-api-dev curl -sf "http://localhost:4000/health" 2>&1 || [ $timeout -eq 0 ]; do
+            echo "Waiting for API to start... ($timeout seconds remaining)"
+            sleep 1
+            ((timeout--))
+          done
🧰 Tools
🪛 yamllint (1.35.1)

[error] 367-367: trailing spaces

(trailing-spaces)


394-409: Fix trailing spaces in environment variables section.

Remove trailing spaces to maintain consistent formatting.

-        MAIL_PASSWORD: ${{secrets.MAIL_PASSWORD}}
-             
+        MAIL_PASSWORD: ${{secrets.MAIL_PASSWORD}}
+
🧰 Tools
🪛 yamllint (1.35.1)

[warning] 395-395: wrong indentation: expected 6 but found 8

(indentation)


[error] 409-409: 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 1544502 and 0b6ef08.

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

322-322: shellcheck reported issue in this script: SC1069:error:38:3: You need a space before the [

(shellcheck)

🪛 yamllint (1.35.1)
.github/workflows/pull-request.yml

[error] 367-367: trailing spaces

(trailing-spaces)


[warning] 395-395: wrong indentation: expected 6 but found 8

(indentation)


[error] 409-409: trailing spaces

(trailing-spaces)

🔇 Additional comments (5)
.github/workflows/pull-request.yml (5)

299-320: LGTM! Job configuration follows best practices.

The job configuration is well-structured with proper dependency management, Node.js setup, and dependency caching.


321-338: LGTM! Docker startup implementation is robust.

The implementation includes proper error handling, timeouts, and cleanup of existing containers.

🧰 Tools
🪛 actionlint (1.7.4)

322-322: shellcheck reported issue in this script: SC1069:error:38:3: You need a space before the [

(shellcheck)


343-343: Fix MongoDB health check syntax.

There's a syntax error in the until condition that needs to be fixed.

-until docker-compose -f docker-compose.dev.yaml exec -T mongodb mongo --eval "db.runCommand('ping').ok">/dev/null 2>&1 || [ $timeout -eq 0]; do
+until docker-compose -f docker-compose.dev.yaml exec -T mongodb mongo --eval "db.runCommand('ping').ok" >/dev/null 2>&1 || [ $timeout -eq 0 ]; do

360-365: Fix Redis health check syntax and indentation.

There are syntax errors in the Redis health check implementation.

-if[ $timeout -eq 0 ]; then
+if [ $timeout -eq 0 ]; then

384-393: LGTM! Cleanup implementation follows best practices.

The cleanup function correctly preserves the exit code and uses trap for proper cleanup on script exit.

@Cioppolo14
Copy link
Contributor

There isn’t an issue assigned to you for this PR. Please follow the guidelines in our PR_GUIDELINES.md file. We have the procedures in place so that everyone has a fair chance of contributing. I will be closing this pull request. Please follow the procedures and resubmit when ready.

@Cioppolo14 Cioppolo14 closed this Dec 14, 2024
@prayanshchh
Copy link
Author

@Cioppolo14 I accidently tagged the wrong issue, but I am assigned to this issue: #2638..please re-open this

@palisadoes palisadoes reopened this Dec 15, 2024
@palisadoes
Copy link
Contributor

Please make sure all tests pass and coderabbit.ai approves the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants