Skip to content
This repository has been archived by the owner on Jan 27, 2024. It is now read-only.

feat: modularize script #13

Merged
merged 1 commit into from
Dec 22, 2023
Merged

feat: modularize script #13

merged 1 commit into from
Dec 22, 2023

Conversation

fi-krish
Copy link
Owner

@fi-krish fi-krish commented Dec 22, 2023

Summary by CodeRabbit

  • Refactor

    • Updated the build process to retrieve and execute a build script from an external source for enhanced maintainability.
  • Chores

    • Simplified CI configuration by removing an unused environment variable.

Copy link

coderabbitai bot commented Dec 22, 2023

Walkthrough

The build process for a Go application has been refactored. An environment variable used during cross-compilation is removed, and the build script now fetches and executes a separate script from a GitHub gist, altering how the application is built.

Changes

File Change Summary
.github/.../ci.yml Removed APP_NAME env variable from CROSS_BUILD command
scripts/build.sh Updated to fetch and execute a script from GitHub gist

Poem

🐇💻

In the realm of code, a hop, a skip,
A build script changed, just a blip.
No longer direct, it fetches with glee,
A rabbit's refactor, as clever as can be. 🎉

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


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • You can directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
  • You can tag CodeRabbit on specific lines of code or entire files in the PR by tagging @coderabbitai in a comment. Examples:
  • You can tag @coderabbitai in a PR comment and ask questions about the PR and the codebase. Use quoted replies to pass the context for follow-up questions. Examples:
    • @coderabbitai render interesting statistics about this repository as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai generate unit tests for the src/utils.ts file.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

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

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@fi-krish fi-krish merged commit 401fc4a into main Dec 22, 2023
2 of 3 checks passed
@delete-merged-branch delete-merged-branch bot deleted the feat-modularize-script branch December 22, 2023 14:21
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.

Review Status

Actionable comments generated: 3

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 709e563 and fe8487a.
Files selected for processing (2)
  • .github/workflows/ci.yml (1 hunks)
  • scripts/build.sh (1 hunks)
Additional comments: 1
.github/workflows/ci.yml (1)
  • 157-157: The removal of APP_NAME from the CROSS_BUILD command may impact the build process if APP_NAME is used within the build.sh script or elsewhere. Verify that this change aligns with the intended build behavior.

@@ -1,53 +1,6 @@
cwd=$(pwd)
SCRIPT_CONTENT=$(curl -fsSL https://gist.github.com/xkrishguptaa/3c633f4c75f2b319e18880f3b68b1d23/raw/7b82e4f0209b39055565593735bda4ea89e43c61/go-application-builder.bash)
Copy link

Choose a reason for hiding this comment

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

Fetching and executing a script from a remote source can introduce security risks. Ensure that the source is trusted, the content is signed or verified, and consider pinning to a specific commit to avoid unexpected changes.

- SCRIPT_CONTENT=$(curl -fsSL https://gist.github.com/xkrishguptaa/3c633f4c75f2b319e18880f3b68b1d23/raw/7b82e4f0209b39055565593735bda4ea89e43c61/go-application-builder.bash)
+ # Ensure the script content is verified or consider pinning to a specific commit for security

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.

Suggested change
SCRIPT_CONTENT=$(curl -fsSL https://gist.github.com/xkrishguptaa/3c633f4c75f2b319e18880f3b68b1d23/raw/7b82e4f0209b39055565593735bda4ea89e43c61/go-application-builder.bash)
# Ensure the script content is verified or consider pinning to a specific commit for security

Comment on lines +3 to +4
export APP_NAME="go-todo-api"
export GO_BUILD_TAGS="jsoniter"
Copy link

Choose a reason for hiding this comment

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

Hardcoding APP_NAME and GO_BUILD_TAGS reduces the script's flexibility. Consider passing them as arguments or environment variables if they need to be configurable.

- export APP_NAME="go-todo-api"
- export GO_BUILD_TAGS="jsoniter"
+ # Consider making these values configurable

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.

Suggested change
export APP_NAME="go-todo-api"
export GO_BUILD_TAGS="jsoniter"
# Consider making these values configurable

fi

cd $cwd
echo "$SCRIPT_CONTENT" | sh
Copy link

Choose a reason for hiding this comment

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

Piping script content directly to sh can make error handling and debugging more difficult. Consider saving the script to a file and executing it, which would allow for better error checking and readability.

- echo "$SCRIPT_CONTENT" | sh
+ # Consider saving the script to a file for better error handling and readability

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.

Suggested change
echo "$SCRIPT_CONTENT" | sh
# Consider saving the script to a file for better error handling and readability

fi-krish added a commit that referenced this pull request Dec 22, 2023
fi-krish added a commit that referenced this pull request Dec 22, 2023
fi-krish added a commit that referenced this pull request Dec 22, 2023
fi-krish added a commit that referenced this pull request Dec 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant