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

Add appimage packaging #225

Merged
merged 1 commit into from
Jan 4, 2024
Merged

Add appimage packaging #225

merged 1 commit into from
Jan 4, 2024

Conversation

DropSnorz
Copy link
Owner

@DropSnorz DropSnorz commented Jan 2, 2024

Summary by CodeRabbit

  • New Features

    • Introduced AppImage packaging for Linux, providing a new distribution option.
    • Added desktop integration with a new .desktop file for the OwlPlug application.
  • Chores

    • Renamed the packaging job for clarity and better CI/CD process organization.
  • Documentation

    • Updated workflow documentation to reflect new packaging and distribution methods.

Copy link

coderabbitai bot commented Jan 2, 2024

Walkthrough

The project has evolved to enhance its Linux distribution capabilities. It now includes an AppImage packaging option, alongside the existing Debian package format. The workflow has been updated to handle the new packaging process, and necessary files for AppImage support, such as the application runner and desktop entry, have been added. The script to package the AppImage has also been introduced, streamlining the build process for this portable format.

Changes

File Path Change Summary
.github/workflows/main.yml Renamed package-linux to package-linux-deb, added package-linux-appimage job, adjusted artifact names for installers.
.../OwlPlug.AppDir/AppRun Added shell script to set up environment and execute specified application.
.../OwlPlug.AppDir/OwlPlug.desktop Introduced desktop entry for the OwlPlug application.
build/package-appimage.sh Added script for preparing OwlPlug AppImage package.

🐇✨
A hop of code, a leap of build,
Now Linux users, your patience is fulfilled.
With AppImage packed, and desktop aligned,
OwlPlug's wings spread wide, in the penguin's sky it shines. 🐧🚀

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 with CodeRabbit Bot (@coderabbitai)

  • You can directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • You can tag CodeRabbit on specific lines of code or entire files in the PR by tagging @coderabbitai in a comment. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • You can tag @coderabbitai in a PR comment and ask questions about the PR and the codebase. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid.
    • @coderabbitai read the files in the src/scheduler package and generate README in the markdown format.

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.

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.

@DropSnorz DropSnorz self-assigned this Jan 2, 2024
@DropSnorz
Copy link
Owner Author

@coderabbitai review

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

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between cd4461b and 6f6fffd.
Files selected for processing (4)
  • .github/workflows/main.yml (2 hunks)
  • build/OwlPlug.AppDir/AppRun (1 hunks)
  • build/OwlPlug.AppDir/OwlPlug.desktop (1 hunks)
  • build/package-appimage.sh (1 hunks)
Files skipped from review due to trivial changes (1)
  • build/OwlPlug.AppDir/OwlPlug.desktop
Additional comments: 2
build/package-appimage.sh (1)
  • 1-26: The script package-appimage.sh follows the standard practices for creating an AppImage, including setting up necessary files, using jpackage, and copying resources. The steps are clear and maintainable.
.github/workflows/main.yml (1)
  • 228-268: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [205-267]

The changes to the CI workflow are well-structured and clear. The separation of jobs for Debian (package-linux-deb) and AppImage (package-linux-appimage) packaging is a good practice. The steps for building the AppImage, including setting up dependencies and renaming the output file to include the version, are correctly implemented.

build/OwlPlug.AppDir/AppRun Show resolved Hide resolved
.github/workflows/main.yml Outdated Show resolved Hide resolved
@DropSnorz DropSnorz marked this pull request as ready for review January 3, 2024 17:58
@DropSnorz
Copy link
Owner Author

@coderabbitai review

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

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between cd4461b and 6adcf3f.
Files selected for processing (4)
  • .github/workflows/main.yml (3 hunks)
  • build/OwlPlug.AppDir/AppRun (1 hunks)
  • build/OwlPlug.AppDir/OwlPlug.desktop (1 hunks)
  • build/package-appimage.sh (1 hunks)
Files skipped from review due to trivial changes (1)
  • build/OwlPlug.AppDir/OwlPlug.desktop
Additional comments: 11
build/OwlPlug.AppDir/AppRun (4)
  • 1-1: Ensure the shebang line is using a portable path to sh.

  • 2-2: Verify that readlink -f is the best choice for portability across different Linux distributions as some may not support it.

  • 4-4: Appending to the PATH variable without prior sanitization may pose a security risk. Ensure that the directories being added are secure.

Verification successful

Based on the output from the executed scripts, we have the following information regarding the directories added to the PATH variable in the AppRun script:

  • The directory build/OwlPlug.AppDir/usr/bin/ exists and has the permissions drwxr-xr-x. This indicates that it is a directory (d), readable (r), writable (w), and executable (x) by the owner (presumably the creator of the AppImage), readable and executable by the group, and readable and executable by others.
  • The directories build/OwlPlug.AppDir/usr/sbin/, build/OwlPlug.AppDir/usr/games/, build/OwlPlug.AppDir/bin/, and build/OwlPlug.AppDir/sbin/ do not exist in the repository.

Given this information, the following points can be made:

  • The existing directory usr/bin/ within the AppImage build directory has standard permissions that do not pose an immediate security risk based on the output provided. It is not writable by group or others, which is a good security practice.
  • The other directories do not exist in the repository, so they do not pose a security risk in the context of this repository. However, if these directories were to be created during the AppImage build process or at runtime, their permissions would need to be verified to ensure they are secure.

In conclusion, the only directory we can verify (usr/bin/) is set with permissions that are typical and do not indicate a security risk. For the other directories, since they do not exist in the repository, we cannot assess their security. If these directories are meant to be created during the AppImage build or execution, it would be necessary to ensure that their permissions are set securely at that time.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the directories added to PATH are secure and intended
fd --exec ls -ld {} +

Length of output: 71371



Script:

#!/bin/bash
# List the permissions of the directories within build/OwlPlug.AppDir that correspond to the ones added to the PATH variable in the AppRun script.

ls -ld build/OwlPlug.AppDir/usr/bin/
ls -ld build/OwlPlug.AppDir/usr/sbin/
ls -ld build/OwlPlug.AppDir/usr/games/
ls -ld build/OwlPlug.AppDir/bin/
ls -ld build/OwlPlug.AppDir/sbin/

Length of output: 561

* 6-6: Confirm that the executable referenced by `EXEC` is intended to be run with any passed arguments (`"$@"`).
Verification successful

The content of the AppRun file has been successfully retrieved, and it includes the line:

exec "${EXEC}" "$@"

This confirms that the script is designed to execute the command referenced by the EXEC variable with any arguments passed to the script ("$@"). Therefore, the review comment asking to confirm that the executable referenced by EXEC is intended to be run with any passed arguments has been verified.

  • The EXEC variable is set by searching for an 'Exec=' entry in a .desktop file within the same directory.
  • The exec command then uses this variable to run the specified executable, passing all arguments received by the script.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Check if the executable accepts variable arguments
ast-grep --lang sh --pattern $'exec "$_" "$@"'

Length of output: 152



Script:

#!/bin/bash
# Use rg to search for the pattern 'exec "${EXEC}" "$@"' in the AppRun file
rg 'exec "\${EXEC}" "\$@"' build/OwlPlug.AppDir/AppRun

Length of output: 169



Script:

#!/bin/bash
# Correct the regex pattern to properly escape special characters
rg 'exec "\\\${EXEC}" "\\\$@"' build/OwlPlug.AppDir/AppRun

Length of output: 179



Script:

#!/bin/bash
# Use a simpler pattern to search for the line containing 'exec "${EXEC}" "$@"'
rg 'exec "\${EXEC}" "\$@"' build/OwlPlug.AppDir/AppRun

Length of output: 169



Script:

#!/bin/bash
# Output the content of the AppRun file to manually verify the line
cat build/OwlPlug.AppDir/AppRun

Length of output: 309

build/package-appimage.sh (3)
  • 7-7: Verify that the relative path used in cp is correct and that the LICENSE file exists at the expected location.
Verification successful

The output from the shell script indicates that a LICENSE file does exist at the root of the repository. Given that the cp command in the build/package-appimage.sh script uses a relative path from the script's location, we need to verify that the script's directory is one level deep from the root (i.e., build/) to ensure that the ../LICENSE path is correct.

To confirm the script's location, we can use the fd command to find the package-appimage.sh script and then infer its directory structure from the output.


The output confirms that the package-appimage.sh script is located in the build/ directory. Since the LICENSE file is at the root of the repository, the relative path ../LICENSE used in the cp command within the package-appimage.sh script is indeed correct. The script is in the build/ directory, so ../ would navigate one directory up to the root where the LICENSE file is located.

Based on this information, the relative path used in the cp command is correct, and the LICENSE file exists at the expected location.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Check if the LICENSE file exists in the expected directory
fd LICENSE

Length of output: 20



Script:

#!/bin/bash
# Find the location of the package-appimage.sh script
fd package-appimage.sh

Length of output: 50

* 11-11: Check for the existence of the source jar file before attempting to copy it to prevent runtime errors.
  • 15-17: Ensure that jpackage is used correctly and that all the options provided are valid and necessary.
.github/workflows/main.yml (4)
  • 181-181: The artifact name change for the Windows installer is consistent with the other changes and follows a clear naming convention.

  • 206-206: The artifact name change for the macOS installer is consistent with the other changes and follows a clear naming convention.

  • 231-231: The artifact name change for the Linux installer is consistent with the other changes and follows a clear naming convention.

  • 233-267: The addition of the package-linux-appimage job is consistent with the PR objectives. Ensure that all steps are necessary and that the use of sudo is justified and secure.

Verification successful

Based on the provided output, the package-linux-appimage job in the .github/workflows/main.yml file includes the following steps:

  1. Checkout the repository.
  2. Set up JDK 17.
  3. Get the version of the project.
  4. Install the Jar artifact.
  5. Package the installer using the package-appimage.sh script.
  6. Download the FUSE dependency.
  7. Download the AppImage Tool.
  8. Allow execution of the AppImage Tool.
  9. Run the AppImage Tool to create the AppImage.
  10. Rename the OwlPlug AppImage.
  11. Upload the Installer Artifact.

Each step in the job appears to be necessary for the AppImage packaging process:

  • Steps 1-4 are standard setup steps for a build job.
  • Step 5 packages the installer, which is the main objective of the job.
  • Steps 6-9 are specific to the creation of an AppImage, which requires the FUSE library and the AppImage Tool.
  • Step 10 renames the AppImage for clarity and versioning.
  • Step 11 uploads the artifact, which is the final output of the job.

The use of sudo in step 6 is justified as it is required to install system packages on Ubuntu, and it is a common practice in CI/CD environments to use elevated privileges for such tasks. However, it is always recommended to ensure that the commands executed with sudo are from trusted sources and do not pose security risks.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify the necessity of each step in the package-linux-appimage job
rg --type yaml 'package-linux-appimage'

Length of output: 188



Script:

#!/bin/bash
# Search for the 'package-linux-appimage' job in the workflow files without specifying file type
rg 'package-linux-appimage'

Length of output: 27



Script:

#!/bin/bash
# Find the GitHub Actions workflow files and search for the 'package-linux-appimage' job within them
fd 'main\.yml' --exec rg 'package-linux-appimage' {}

Length of output: 54



Script:

#!/bin/bash
# Output the contents of the .github/workflows/main.yml file to analyze the steps manually
cat .github/workflows/main.yml

Length of output: 10255

build/OwlPlug.AppDir/AppRun Show resolved Hide resolved
build/package-appimage.sh Show resolved Hide resolved
build/package-appimage.sh Show resolved Hide resolved
build/package-appimage.sh Show resolved Hide resolved
@DropSnorz DropSnorz merged commit d2c5679 into dev Jan 4, 2024
10 checks passed
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.

1 participant