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

Fix build issues in CI #248

Merged
merged 2 commits into from
Jul 24, 2024
Merged

Fix build issues in CI #248

merged 2 commits into from
Jul 24, 2024

Conversation

minai621
Copy link
Contributor

@minai621 minai621 commented Jul 23, 2024

What this PR does / why we need it:

  1. Add Puppeteer environment setup to Dockerfile.
  2. Improve HTML rendering in PDF export.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Re-enable the previously disabled DownloadMenu button.

Additional documentation:

NONE

Checklist:

  • Added relevant tests or not required
  • Didn't break anything

Summary by CodeRabbit

  • New Features

    • Enhanced support for automated browser interactions by integrating Chromium and configuring Puppeteer.
    • Improved markdown processing through a more configurable setup in the FilesService.
  • Bug Fixes

    • Addressed type clarity for the markdown property in the FilesService.

* Feat enable rendering of <img> tags in markdown

* Feat add chromium dependencies to Dockerfile
Copy link
Contributor

coderabbitai bot commented Jul 23, 2024

Walkthrough

The recent updates enhance the backend service by integrating headless browser capabilities through the installation of Chromium and its dependencies in the Docker configuration. Additionally, the FilesService class has been improved with a clearer initialization of the markdown property, allowing for better Markdown processing. These changes aim to streamline automated browser interactions and improve code clarity.

Changes

File Change Summary
backend/Dockerfile Added installation of Chromium and dependencies; configured Puppeteer environment variables.
backend/src/files/files.service.ts Modified markdown property declaration for clearer type specification and initialization with options in the constructor.

Poem

In a world of code, where bunnies hop,
We’ve added Chromium, oh, what a swap!
With Markdown now clear, our service can sing,
Automate tasks, let the joy spring!
Hopping through changes, with a skip and a cheer,
Let’s celebrate coding, our path is now clear! 🐇✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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
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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c97340f and fc0add6.

Files selected for processing (2)
  • backend/Dockerfile (1 hunks)
  • backend/src/files/files.service.ts (1 hunks)
Additional comments not posted (5)
backend/Dockerfile (3)

20-26: LGTM! The package installations are appropriate.

The addition of these packages is necessary for enabling headless browser functionality with Puppeteer.


28-28: LGTM! The environment variable is correctly set.

Setting PUPPETEER_SKIP_CHROMIUM_DOWNLOAD to true optimizes the build process by avoiding redundant Chromium downloads.


29-29: LGTM! The environment variable is correctly set.

Setting PUPPETEER_EXECUTABLE_PATH ensures Puppeteer uses the installed Chromium executable.

backend/src/files/files.service.ts (2)

22-22: LGTM! The type declaration enhances type clarity.

Explicitly typing the markdown property as MarkdownIt improves code readability and TypeScript support.


29-33: LGTM! The initialization is clear and configurable.

Initializing markdown with specific options enhances configurability and makes the setup more explicit.

Copy link
Member

@krapie krapie left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution.
I have left some comments on formatting the file 😄

backend/Dockerfile Outdated Show resolved Hide resolved
backend/Dockerfile Show resolved Hide resolved
@krapie krapie added the bug 🐞 Something isn't working label Jul 24, 2024
@krapie krapie requested a review from devleejb July 24, 2024 11:28
* Chore add description for install puppeteer in Dockerfile

* Chore add newline in Dockerfile according to POSIX
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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between fc0add6 and 8d78d9d.

Files selected for processing (1)
  • backend/Dockerfile (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • backend/Dockerfile

@minai621 minai621 requested a review from krapie July 24, 2024 12:34
@krapie krapie removed the request for review from devleejb July 24, 2024 12:41
Copy link
Member

@krapie krapie left a comment

Choose a reason for hiding this comment

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

LGTM. Let's check the docker build will work.

@krapie krapie merged commit 0bdc6d3 into yorkie-team:main Jul 24, 2024
2 checks passed
@krapie
Copy link
Member

krapie commented Jul 24, 2024

@minai621 Seems like it has failed again: https://github.com/yorkie-team/codepair/actions/runs/10076846631

krapie added a commit that referenced this pull request Jul 24, 2024
@krapie
Copy link
Member

krapie commented Jul 24, 2024

@minai621 Well I think the current puppeteer version 10.4.2 in html-pdf-node module does not support the latest chromium 126.x.x. I think we need to upgrade the version of puppeteer or downgrade chromium version.

Is there any other module to make pdf? Because the latest version of html-pdf-node was released 3 years ago.

@devleejb
Copy link
Member

I think that we have to change approach to export markdown.
If we use browser to build file, it requires very high resource.

@krapie
Copy link
Member

krapie commented Jul 25, 2024

@minai621 @devleejb Okay I think I have fixed the issue. I thought the image building stage of the Dockerfile was failing, but the build was actually failing in the CI stage of the Dockerfile.

I will revert all the undos and enable this feature into the main.

Edit: Actually, I think we don't need to CI in the Dockerfile, since the purpose of the Dockerfile is to build container image. I think checking integrity with CI in Dockerfile is out of scope.

@devleejb
Copy link
Member

@krapie
Right, it fails when running npm run ci.

I mistakenly thought the build tests were being conducted in the CI. Because of this, I believed the CI passed due to the different environment when building the Dockerfile. It seems necessary to test the build in the CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants