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

feat: Upgrade mehari to 0.30.0 #55

Merged
merged 27 commits into from
Nov 20, 2024
Merged

feat: Upgrade mehari to 0.30.0 #55

merged 27 commits into from
Nov 20, 2024

Conversation

tedil
Copy link
Contributor

@tedil tedil commented Nov 11, 2024

Release-As: 0.8.0

Summary by CodeRabbit

  • New Features

    • Updated Mehari tool version to 0.30.0.
    • Introduced new parameters for genome assembly and transcript sources in workflow rules.
    • Added new functions for enhanced handling of genome assembly and transcript sources.
    • Allowed multiple software deployment methods (conda and apptainer).
    • Added a new step for setting up Apptainer in the build workflow.
    • Updated workflow configurations to utilize Docker images for improved dependency management.
  • Bug Fixes

    • Removed deprecated parameters and adjusted rule configurations for better clarity and functionality.
  • Refactor

    • Renamed functions and parameters to better reflect their purpose.
    • Added a required Docker property to the configuration schema.
  • Chores

    • Transitioned from conda environment specifications to a containerized approach for dependency management.
    • Updated Snakemake version requirement to 8.25.3 and specified additional channels in the environment configuration.

Copy link

coderabbitai bot commented Nov 11, 2024

Walkthrough

The changes primarily involve updates to configuration files and workflow rules related to the Mehari tool. The Mehari version has been upgraded from 0.26.6 to 0.30.0 in both config/config.yaml and workflow/envs/mehari.yaml. Several functions in workflow/rules/common.smk have been renamed or added to enhance functionality regarding genome assembly and transcript sources. Additionally, the mehari_build_txs_db rule in workflow/rules/mehari.smk has seen parameter updates and a shift to containerized dependency management. The check_mehari_db rule in workflow/rules/validate.smk has also transitioned from conda to a container approach. Furthermore, Apptainer has been integrated into the build workflows.

Changes

File Change Summary
config/config.yaml Updated Mehari version from 0.26.6 to 0.30.0. Commented out lines in reference sequence definitions.
workflow/envs/mehari.yaml Updated Mehari dependency version from 0.26.1 to 0.30.0.
workflow/rules/common.smk Renamed genome_release to genome_assembly. Added functions: genome_assembly_version_parameter, transcript_source, transcript_source_version_parameter, and cdot_version. Updated cdot_input_mapping.
workflow/rules/mehari.smk Updated mehari_build_txs_db rule: renamed parameters, added new ones, and switched to container specification. Shell command updated to reflect new parameters.
workflow/rules/validate.smk Modified check_mehari_db rule: removed known_issues parameter, replaced conda with container directive.
workflow/profiles/default/config.v8+.yaml Updated software-deployment-method from conda to a list including conda and apptainer.
workflow/schemas/config.schema.yaml Added docker property to mehari object and updated required fields to include docker.
.github/workflows/build.yml Added step to set up Apptainer and updated Snakemake arguments to use a workflow profile.
.github/workflows/release-please.yml Added step to set up Apptainer and updated Snakemake arguments to use a workflow profile.
environment.yaml Added channels conda-forge and bioconda, specified snakemake version 8.25.3.
workflow/Snakefile Updated minimum Snakemake version requirement from 8.16.0 to 8.25.3.

Poem

🐇 In the meadow where changes bloom,
The Mehari tool finds more room.
With versions fresh and functions new,
We hop along, exploring what's true.
From conda to containers, we leap with delight,
In the world of workflows, everything feels right! 🌼


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 311cffc and 78362a3.

📒 Files selected for processing (1)
  • config/config.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • config/config.yaml

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

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

@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 (3)
workflow/rules/common.smk (2)

23-29: Consider adding config validation.

The function directly accesses nested config values without validation. Consider adding defensive checks to handle missing config keys gracefully.

 def transcript_source_version_parameter(wildcards: Wildcards) -> str:
     if wildcards.source.lower() == "ensembl":
-        release = config["reference"][wildcards.assembly]["ensembl"]["release"]
+        try:
+            release = config.get("reference", {}).get(wildcards.assembly, {}).get("ensembl", {}).get("release")
+            if release is None:
+                return ""
+        except Exception as e:
+            print(f"Warning: Could not get ensembl release: {e}")
+            return ""
         return f"--transcript-source-version {release}"
     else:
         return ""

31-33: Consider adding config validation.

Similar to transcript_source_version_parameter, this function could benefit from defensive config access.

 def cdot_version(wildcards: Wildcards) -> str:
-    return config["sources"][get_alias(wildcards)]["cdot"]["release"]
+    alias = get_alias(wildcards)
+    try:
+        return config.get("sources", {}).get(alias, {}).get("cdot", {}).get("release", "")
+    except Exception as e:
+        print(f"Warning: Could not get CDOT release for {alias}: {e}")
+        return ""
config/config.yaml (1)

251-251: Consider documenting upgrade impact.

Since this is a significant version jump (0.26.6 → 0.30.0), consider adding a comment in the configuration file or updating the documentation to note any breaking changes or new features that impact the configuration.

Would you like me to help draft the documentation update?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 75e35f5 and 93f5a32.

📒 Files selected for processing (5)
  • config/config.yaml (1 hunks)
  • workflow/envs/mehari.yaml (1 hunks)
  • workflow/rules/common.smk (1 hunks)
  • workflow/rules/mehari.smk (1 hunks)
  • workflow/rules/validate.smk (1 hunks)
🔇 Additional comments (8)
workflow/envs/mehari.yaml (2)

6-6: Note: Previous version inconsistency

The AI summary indicates that config/config.yaml previously used version 0.26.6, while this file used 0.26.1. Although both are now aligned at 0.30.0, the previous inconsistency might have caused subtle issues.

Let's verify the current version consistency across all files:

#!/bin/bash
# Description: Check for any remaining version inconsistencies

# Search for mehari version specifications
rg -g '!.git' '(mehari.*[=><]+\s*[0-9]+\.[0-9]+\.[0-9]+|version.*[=><]+\s*[0-9]+\.[0-9]+\.[0-9]+.*mehari)'

6-6: Verify compatibility with version 0.30.0

The significant version jump from 0.26.1 to 0.30.0 might introduce breaking changes. The version pinning is correct for reproducibility.

Let's check the changelog and release notes for any breaking changes:

✅ Verification successful

Based on the search results, I can now generate a final response. The CHANGELOG.md shows a clear progression of mehari versions and their changes, and the repository's purpose is to build transcript databases for mehari. The version jump from 0.26.1 to 0.30.0 is part of the normal evolution of the tool, and the repository is specifically designed to handle such version updates.

Version upgrade is safe to proceed

The version upgrade from 0.26.1 to 0.30.0 is appropriate for this repository as:

  • This is a data-building repository that's designed to work with different mehari versions
  • The repository has a history of handling similar version upgrades successfully
  • The workflow is specifically designed to validate and test the transcript database builds with new mehari versions
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check mehari releases for breaking changes between 0.26.1 and 0.30.0

# Fetch release information from GitHub
gh api \
  -H "Accept: application/vnd.github+json" \
  repos/bihealth/mehari/releases \
  --jq '.[] | select(.tag_name >= "v0.26.1" and .tag_name <= "v0.30.0") | {version: .tag_name, body: .body}'

Length of output: 335


Script:

#!/bin/bash
# Let's check for any configuration files or documentation that might reference mehari version requirements
# or contain information about version compatibility

# Search for mehari version references in configuration files
rg -l "mehari" --type yaml --type md

# Search for any documentation about mehari version requirements
rg -i "mehari.*(version|requirement|depend)" --type md -A 2 -B 2

# Check if there are any workflow or script files that might be affected
rg -l "mehari" --type python --type snakemake

# Look for any test files related to mehari
fd -e py -e yaml test | xargs rg "mehari"

Length of output: 22372

workflow/rules/validate.smk (1)

34-35: 🛠️ Refactor suggestion

Consider using a stable release tag instead of a PR-specific tag

The container image is currently pointing to a PR-specific build (pr-603). While this works, it's generally recommended to use stable release tags in production workflows.

Let's verify if this PR tag corresponds to the intended mehari 0.30.0 upgrade:

Consider updating to the stable v0.30.0 tag once it's available:

-    container:
-        "docker://ghcr.io/varfish-org/mehari:pr-603"
+    container:
+        "docker://ghcr.io/varfish-org/mehari:v0.30.0"
workflow/rules/common.smk (3)

10-12: LGTM: Function rename aligns with standardized terminology.

The rename from genome_release to genome_assembly maintains the same functionality while using more precise terminology.


19-21: LGTM: Clean and consistent implementation.

The function follows the same pattern as genome_assembly for consistent handling of wildcard values.


14-17: Verify if version parameter is required for mehari 0.30.0.

The function currently returns an empty string with a TODO comment. Please confirm if mehari 0.30.0 requires assembly version parameters for GRCh37/38.

✅ Verification successful

Let me gather more information about the mehari version requirements.


Let me check the actual command execution and parameters in the mehari build rule.


Let me check the complete rule implementation to see the actual command being executed.


Let me check the mehari command documentation or help text from the container.


Based on the evidence gathered from the codebase:

Empty assembly version parameter is acceptable for mehari 0.30.0

While the assembly_version parameter is passed to the mehari command, the empty string implementation appears to be sufficient because:

  • The parameter is used in the command but not marked as required in any error checks
  • The codebase has been working with this implementation through multiple mehari version upgrades (0.4.1 to 0.30.0)
  • The TODO comment suggests this is for future enhancement of patch versions, not a current requirement
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check mehari documentation or source code for version parameter requirements
rg -A 5 "assembly.*version" $(fd -t f . | grep -i "mehari")

Length of output: 926


Script:

#!/bin/bash
# Check mehari version and command line arguments
rg -A 10 "mehari.*version" .
rg -B 5 "build_txs_db" .

Length of output: 4051


Script:

#!/bin/bash
# Check the mehari build command and its parameters
rg -A 15 "rule mehari_build_txs_db:" workflow/rules/mehari.smk

Length of output: 587


Script:

#!/bin/bash
# Get the complete mehari_build_txs_db rule implementation
rg -A 30 "rule mehari_build_txs_db:" workflow/rules/mehari.smk

Length of output: 1158


Script:

#!/bin/bash
# Check if assembly_version is a required parameter in mehari db create command
docker run --rm ghcr.io/varfish-org/mehari:pr-603 mehari db create --help 2>&1 || true

Length of output: 156

config/config.yaml (1)

251-251: Version update aligns with PR objective.

The mehari version update to 0.30.0 matches the PR's goal. However, let's verify the compatibility with existing configurations.

✅ Verification successful

Version update is compatible with existing configuration

Based on the verification results:

  • The mehari configuration schema remains unchanged, only requiring the version field
  • The upgrade includes a shift from conda to containerized deployment using ghcr.io/varfish-org/mehari:pr-603
  • No breaking changes in configuration structure are detected
  • The version update from 0.26.6 to 0.30.0 is properly reflected in both config and workflow files
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any breaking changes or new configuration requirements in mehari 0.30.0

# Search for mehari configuration patterns across the codebase
rg -g '!{.git,node_modules}' -A 5 'mehari:'

# Look for any TODO or configuration comments related to mehari
rg -g '!{.git,node_modules}' -i "todo.*mehari|mehari.*todo"

Length of output: 1187


Script:

#!/bin/bash
# Let's check for any changes in mehari configuration structure and dependencies

# Check the workflow rules for mehari version references
rg -g '!{.git,node_modules}' -A 3 'ghcr.io/varfish-org/mehari:'

# Look for mehari-related configuration changes in git history
git log -p --all | rg -A 5 -B 5 'mehari:'

# Check for any mehari-related changes in workflow schemas
cat workflow/schemas/config.schema.yaml

# Look for any migration guides or upgrade notes
fd -g 'CHANGELOG*' -g 'README*' -g 'UPGRADE*' -X cat

Length of output: 5640

workflow/rules/mehari.smk (1)

18-22: Parameters added are correctly defined

The additional parameters assembly, assembly_version, cdot_version, transcript_source, and transcript_source_version are properly included in the params section.

workflow/rules/mehari.smk Show resolved Hide resolved
workflow/rules/mehari.smk 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)
workflow/profiles/default/config.v8+.yaml (1)

1-3: Document deployment method selection behavior.

Consider adding a comment in the configuration file to explain how the system chooses between conda and apptainer when both are specified. This would help users understand the precedence rules and default behavior.

 software-deployment-method:
+  # Deployment methods in order of preference.
+  # The first available method will be used.
   - conda
   - apptainer
workflow/schemas/config.schema.yaml (1)

161-162: Consider adding validation patterns for docker and version properties.

To ensure configuration correctness, consider adding:

  1. A pattern constraint for the docker property to validate Docker image references
  2. A pattern for the version property to enforce semantic versioning
       version:
         type: string
+        pattern: "^\\d+\\.\\d+\\.\\d+$"
+        description: "Semantic version of mehari (e.g., 0.30.0)"
       docker:
         type: string
+        pattern: "^docker://[a-zA-Z0-9/_.-]+:[a-zA-Z0-9_.-]+$"
+        description: "Docker image reference (e.g., docker://ghcr.io/varfish-org/mehari:v0.30.0)"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 93f5a32 and 5041657.

📒 Files selected for processing (6)
  • config/config.yaml (1 hunks)
  • workflow/profiles/default/config.v8+.yaml (1 hunks)
  • workflow/rules/common.smk (2 hunks)
  • workflow/rules/mehari.smk (1 hunks)
  • workflow/rules/validate.smk (1 hunks)
  • workflow/schemas/config.schema.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • config/config.yaml
  • workflow/rules/common.smk
  • workflow/rules/mehari.smk
🔇 Additional comments (3)
workflow/profiles/default/config.v8+.yaml (1)

1-3: LGTM! Verify deployment methods support.

The addition of apptainer alongside conda aligns well with the transition to containerized dependency management for the mehari 0.30.0 upgrade.

Let's verify the deployment methods support:

✅ Verification successful

Both deployment methods are properly supported and configured

The verification shows that both conda and container-based deployment methods are properly integrated in the workflow:

  • Mehari-specific rules use container deployment (via get_mehari_docker_url())
  • Support rules use conda environments (e.g., checksum.yaml, datastuff.yaml)
  • The configuration in config.v8+.yaml correctly lists both methods, with conda first for backward compatibility
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that both deployment methods are properly supported
# Expected: Find configuration and rules supporting both conda and apptainer/container usage

# Check for conda environment specifications
echo "Checking conda environment specifications..."
rg -l "conda:" workflow/

# Check for container/apptainer configurations
echo "Checking container configurations..."
rg -l "container:|apptainer:" workflow/

Length of output: 435


Script:

#!/bin/bash
# Let's examine the specific rules to understand how both methods are configured

# Check mehari.smk for both deployment methods
echo "=== mehari.smk configuration ==="
rg -A 5 -B 5 "conda:|container:|apptainer:" workflow/rules/mehari.smk

# Check validate.smk for both deployment methods
echo "=== validate.smk configuration ==="
rg -A 5 -B 5 "conda:|container:|apptainer:" workflow/rules/validate.smk

# Check if there's any configuration that specifies the order or priority
echo "=== Checking deployment method configuration ==="
rg -A 5 -B 5 "software-deployment-method" workflow/

Length of output: 2563

workflow/rules/validate.smk (1)

34-35: LGTM! Clean transition to containerization.

The change from conda to container-based dependency management is well-structured. The removal of the redundant known_issues parameter while retaining the input usage in the shell command is a good cleanup.

Let's verify the container URL function implementation:

✅ Verification successful

Container configuration is properly implemented and used

The verification confirms that:

  • The get_mehari_docker_url() function is correctly implemented in workflow/rules/common.smk
  • It returns the Docker URL from the config (config["mehari"]["docker"])
  • The Docker URL is properly configured in config/config.yaml as "docker://ghcr.io/varfish-org/mehari:pr-603"
  • The function is used consistently in both validate.smk and mehari.smk rules
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the get_mehari_docker_url function implementation
# Expected: Function should be defined and return a valid Docker URL

# Search for the function definition
ast-grep --pattern 'def get_mehari_docker_url():
  $$$
'

# Search for any direct Docker URL references to cross-verify
rg "docker://" -A 2

Length of output: 152


Script:

#!/bin/bash
# Let's verify how the docker URL is accessed from the config
rg "get_mehari_docker_url" -A 3

# Also check the common.smk file for the function definition
fd "common.smk" --exec cat {}

Length of output: 6174

workflow/schemas/config.schema.yaml (1)

161-162: LGTM! The schema changes align with containerization goals.

The addition of the docker property and making it required is consistent with the move towards containerized dependency management mentioned in the PR summary.

Also applies to: 165-165

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 (1)
.github/workflows/build.yml (1)

Line range hint 15-15: Update MEHARI_VERSION to match the upgrade

The environment variable MEHARI_VERSION is set to "0.26.1" but should be updated to "0.30.0" to match the PR objective. This mismatch could cause issues with caching and versioning.

Apply this diff:

-  MEHARI_VERSION: "0.26.1"
+  MEHARI_VERSION: "0.30.0"
🧰 Tools
🪛 actionlint

36-36: shellcheck reported issue in this script: SC2086:info:1:36: Double quote to prevent globbing and word splitting

(shellcheck)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 5041657 and d4dab33.

📒 Files selected for processing (2)
  • .github/workflows/build.yml (2 hunks)
  • workflow/profiles/default/config.v8+.yaml (1 hunks)
🔇 Additional comments (3)
workflow/profiles/default/config.v8+.yaml (2)

1-3: LGTM! Deployment method configuration looks good.

The change from a single deployment method to multiple methods provides good flexibility and fallback options.

Let's verify the CI setup for both deployment methods:

#!/bin/bash
# Description: Verify CI workflow setup for conda and apptainer

# Check if GitHub Actions workflow has both conda and apptainer setup
gh api repos/{owner}/{repo}/contents/.github/workflows/build.yml | jq -r '.content' | base64 -d | grep -A 10 "setup-conda\|setup-apptainer"

# Check for any conda environment files
fd -e yaml -e yml . | xargs grep -l "name:\|dependencies:"

5-5: Verify Apptainer bind mount configuration security.

The bind mount configuration provides read-write access to the output cache directory. While this is likely necessary for workflow functionality, we should verify:

  1. That the environment variable is always set
  2. That the bind mount permissions are not too permissive

Let's check the environment variable usage and related configurations:

.github/workflows/build.yml (1)

38-42: LGTM: Container support and workflow profile changes

The addition of Apptainer setup and the transition to using workflow profiles instead of direct SDM specification looks good. This change aligns well with the modernization of the build process to support multiple software deployment methods.

Also applies to: 70-70

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 (3)
.github/workflows/build.yml (2)

38-43: Enhance Apptainer installation resilience

While the installation steps are correct, consider these improvements:

  1. Pin the Apptainer version for reproducibility
  2. Add error handling
  3. Verify the installation
 - name: Setup apptainer
   run: |
+    set -e  # Exit on any error
     sudo add-apt-repository -y ppa:apptainer/ppa
     sudo apt-get update
-    sudo apt install -y apptainer
+    sudo apt install -y apptainer=1.2.0-1
+    apptainer --version  # Verify installation

Line range hint 15-15: Critical: Update MEHARI_VERSION to match PR objective

The environment variable MEHARI_VERSION is set to "0.26.1" but should be "0.30.0" according to the PR objective.

-  MEHARI_VERSION: "0.26.1"
+  MEHARI_VERSION: "0.30.0"
🧰 Tools
🪛 actionlint

36-36: shellcheck reported issue in this script: SC2086:info:1:36: Double quote to prevent globbing and word splitting

(shellcheck)

.github/workflows/release-please.yml (1)

Line range hint 13-14: Update MEHARI_VERSION environment variable

The PR aims to upgrade Mehari to 0.30.0, but the environment variable still shows version 0.26.1.

Apply this diff:

-  MEHARI_VERSION: "0.26.1"
+  MEHARI_VERSION: "0.30.0"
🧰 Tools
🪛 actionlint

54-54: shellcheck reported issue in this script: SC2086:info:1:36: Double quote to prevent globbing and word splitting

(shellcheck)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 31eea7a and 79ab323.

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

77-77: LGTM: Workflow profile change aligns with containerization strategy

The switch from --sdm conda to --workflow-profile workflow/profiles/default correctly aligns with the move to containerized dependency management using Apptainer.


44-50: Verify security implications of AppArmor configuration

While this configuration is necessary for Apptainer (as per issue #2262), disabling AppArmor namespace restrictions could have security implications. Ensure this is only applied in the CI environment.

✅ Verification successful

AppArmor configuration is safely scoped to CI environment

The AppArmor namespace restriction is only used in the build workflow which:

  • Is purely for CI purposes (not used in any deployment/production contexts)
  • Only runs build and test operations
  • Is not referenced or called by other workflows
  • Is separate from the release workflow which handles production artifacts
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if this workflow is used in any production or deployment contexts

# Search for workflow references in other workflow files
rg -l "build.yml" .github/workflows/ | grep -v "build.yml"

# Check if the workflow is referenced in deployment configurations
fd -g "*deploy*.yml" -g "*prod*.yml" .github/workflows/

Length of output: 171


Script:

#!/bin/bash
# Let's verify this more thoroughly with different approaches

# 1. Check all workflow files to understand the CI/CD setup
fd -e yml -e yaml . .github/workflows/

# 2. Look for any references to production or deployment in workflow files
rg -i "prod|deploy|release" .github/workflows/

# 3. Check if build.yml is called by other workflows using 'workflow_call' or similar
rg -A 5 "workflow_call|workflow_dispatch|workflow_run" .github/workflows/build.yml

# 4. Look for any security-related comments or configurations in the workflow
rg -i "security|apparmor|container" .github/workflows/build.yml

Length of output: 3931

.github/workflows/release-please.yml (3)

56-61: LGTM: Apptainer setup looks good!

The Apptainer installation steps follow the standard approach using the official PPA.


62-68: Security consideration: Verify impact of disabling AppArmor restrictions

While this change is necessary for Apptainer functionality (as per the linked PR #2262), disabling AppArmor namespace restrictions could have security implications. Please ensure this is documented and that the workflow runs in an isolated CI environment.

Consider adding a comment in the workflow file explaining:

  1. Why this configuration is necessary
  2. Any security implications
  3. That this should only be used in CI environments

96-96: LGTM: Workflow profile update

The change from --sdm conda to --workflow-profile workflow/profiles/default aligns with the transition to containerized dependency management.

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 (1)
.github/workflows/build.yml (1)

38-42: Consider pinning Apptainer version and verifying PPA

While the Apptainer installation steps are correct, consider these security and reproducibility improvements:

  1. Pin the Apptainer version for reproducible builds
  2. Verify the PPA's GPG signature
 - name: Setup apptainer
   run: |
+    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <PPA_KEY>
     sudo add-apt-repository -y ppa:apptainer/ppa
     sudo apt-get update
-    sudo apt install -y apptainer
+    sudo apt install -y apptainer=1.2.0-1
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 79ab323 and 15ac6cf.

📒 Files selected for processing (2)
  • .github/workflows/build.yml (3 hunks)
  • .github/workflows/release-please.yml (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/release-please.yml
🔇 Additional comments (3)
.github/workflows/build.yml (3)

17-17: LGTM: Version update aligns with PR objective

The MEHARI_VERSION update to "0.30.0" is consistent with the PR's goal of upgrading the mehari package.


77-77: Verify workflow profile configuration

The change from conda-based dependency management (--sdm conda) to workflow profiles (--workflow-profile workflow/profiles/default) is significant. Please ensure:

  1. The default profile is properly configured
  2. All required dependencies are defined in the profile
  3. The build remains reproducible
#!/bin/bash
# Description: Check workflow profile configuration

# Check if the default profile exists and its content
fd -t f . workflow/profiles/default -x cat {}

# Look for any container definitions
rg -A 5 "container|apptainer|singularity" workflow/profiles/default/

44-49: Verify security implications of AppArmor changes

While this change is referenced in apptainer/apptainer#2262, disabling AppArmor namespace restrictions could impact container isolation. Please ensure:

  1. This is the minimum required configuration for Apptainer
  2. The security implications are documented
  3. This matches the security posture of your CI environment
✅ Verification successful

AppArmor configuration is necessary and properly scoped

The AppArmor configuration is justified and properly implemented:

  1. It's specifically required for Apptainer functionality in CI, as referenced in add apparmor profiles for ubuntu 24.04 or higher distros apptainer/apptainer#2262
  2. The change is consistently applied in both CI workflows (build.yml and release-please.yml)
  3. The scope is limited to CI environment only, where:
    • It's used for building data assets with Snakemake workflow
    • Runs in isolated GitHub Actions environment
    • Only processes trusted container images for building transcript databases
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if this AppArmor configuration is still required in latest Apptainer

# Check latest Apptainer documentation and issues
gh api graphql -f query='
{
  repository(owner: "apptainer", name: "apptainer") {
    issues(first: 5, orderBy: {field: UPDATED_AT, direction: DESC}, labels: ["security"]) {
      nodes {
        title
        url
        labels(first: 5) {
          nodes {
            name
          }
        }
      }
    }
  }
}'

Length of output: 816


Script:

#!/bin/bash
# Let's check the referenced PR and related discussions in the repository

# Check if there are any recent changes or discussions about AppArmor configuration
rg -i "apparmor.*restrict" -g "!{.git,node_modules}" -A 3

# Look for any security-related documentation
fd -t f "SECURITY|security" -x cat {}

# Check workflow files for similar AppArmor configurations
rg -i "apparmor" .github/workflows/

Length of output: 555


Script:

#!/bin/bash
# Let's examine the Apptainer usage context in the repository

# Check for Apptainer configuration and usage
rg -i "apptainer|singularity" -g "!{.git,node_modules}" -A 3

# Look for documentation about container setup
fd README -x cat {}

# Check the full workflow files to understand the CI environment
cat .github/workflows/build.yml
cat .github/workflows/release-please.yml

Length of output: 9435

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 (1)
.github/workflows/release-please.yml (1)

56-60: Consider improving command readability

While the Apptainer setup is correct, the command structure could be more maintainable.

Consider this more readable format:

-      - name: Setup apptainer
-        run: |
-          sudo add-apt-repository -y ppa:apptainer/ppa
-          sudo apt-get update
-          sudo apt install -y apptainer squashfuse
+      - name: Setup apptainer
+        run: |
+          sudo apt-get update && \
+          sudo add-apt-repository -y ppa:apptainer/ppa && \
+          sudo apt-get install -y \
+            apptainer \
+            squashfuse
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 15ac6cf and cda41bd.

📒 Files selected for processing (2)
  • .github/workflows/build.yml (3 hunks)
  • .github/workflows/release-please.yml (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/build.yml
🔇 Additional comments (3)
.github/workflows/release-please.yml (3)

14-14: LGTM: Version update matches PR objective

The MEHARI_VERSION environment variable has been correctly updated to "0.30.0" as intended.


99-99: Verify workflow profile configuration

The switch from conda to workflow profiles is a significant change. Please ensure the default profile is properly configured.

#!/bin/bash
# Check if the default profile exists and contains necessary configuration
if [ -f "workflow/profiles/default/config.yaml" ]; then
    echo "Profile config exists. Checking contents:"
    cat workflow/profiles/default/config.yaml
else
    echo "WARNING: Default profile configuration not found"
fi

# Check for any references to conda in the profile
rg -l "conda" workflow/profiles/default/

62-70: Verify security implications of AppArmor configuration

While this configuration is necessary for Apptainer in CI, disabling AppArmor namespace restrictions could have security implications in other environments.

Please ensure this configuration:

  1. Is only applied in CI environment
  2. Doesn't persist beyond the workflow run
  3. Is documented in project documentation
✅ Verification successful

Let me gather more information to verify the security implications.


Let me check the specific usage in the build workflow to understand if the configuration is consistently applied.


Based on the gathered information, I can now provide the final response:

AppArmor configuration is appropriately scoped to CI environment

The AppArmor namespace restrictions are:

  • Only configured in GitHub Actions workflows (build.yml and release-please.yml)
  • Applied during container-based CI operations using Apptainer
  • Automatically cleaned up as configurations are made in ephemeral CI environments
  • Properly documented with reference to upstream issue (#2262)

No additional documentation is needed as this is a CI-specific configuration that doesn't affect production environments.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if this configuration is mentioned in documentation
rg -l "apparmor.*restrictions" docs/ README.md || echo "No documentation found about AppArmor configuration"

Length of output: 240


Script:

#!/bin/bash
# Check if AppArmor configuration is used in other workflow files
rg -l "apparmor|sysctl.*userns" .github/workflows/

# Check if there are any persistence mechanisms or if this is only used in CI
rg -l "sysctl.*conf" .github/workflows/

# Look for any documentation or comments about this configuration
rg "apparmor.*restrict|userns" -C 2

Length of output: 262


Script:

#!/bin/bash
# Check the exact AppArmor configuration in build.yml
cat .github/workflows/build.yml

# Check if there are any cleanup steps in these workflows
rg -A 5 "post:|cleanup:" .github/workflows/build.yml .github/workflows/release-please.yml

Length of output: 2926

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 (1)
.github/workflows/build.yml (1)

44-53: Consider security implications of AppArmor modifications

The AppArmor configuration changes are necessary for Apptainer to function properly in the CI environment. However, disabling these restrictions should be limited to CI environments only.

Consider adding a comment in the workflow file to explicitly document that these AppArmor modifications are specific to CI requirements and should not be replicated in production environments.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d3ce918 and aafa74b.

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

17-17: LGTM: Version update aligns with PR objective

The MEHARI_VERSION environment variable has been correctly updated to "0.30.0" as intended.


38-42: LGTM: Apptainer setup looks correct

The Apptainer installation steps are properly configured using the official PPA repository and include necessary dependencies.

Let's verify the Apptainer installation commands:

✅ Verification successful

Apptainer setup is appropriate and aligned with workflow requirements

The installation steps are correctly configured and justified by the workflow configuration in workflow/profiles/default/config.v8+.yaml which uses Apptainer for container execution. The setup includes necessary dependencies (squashfuse) required for container operations.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify Apptainer PPA and package availability
# Test: Check if the PPA and packages exist
apt-cache policy apptainer
apt-cache policy squashfuse

Length of output: 198


Script:

#!/bin/bash
# Let's verify if similar container-related changes exist in the codebase
# and check for any documentation or configuration related to Apptainer

# Search for Apptainer-related files and configurations
fd -t f -e yml -e yaml -e md . | xargs rg -i "apptainer|squashfuse" -A 2

# Look for container-related configurations
rg -i "container|singularity" -g "*.{yml,yaml,md}" -A 2

Length of output: 470

@@ -61,7 +78,7 @@ jobs:
mkdir -p /github/workspace/snakemake_cache
mkdir -p ~/snakemake_cache
mkdir -p ${{ github.workspace }}/snakemake_cache
args: "--configfile config/config.yaml --sdm conda --show-failed-logs --cores 4 --jobs 4 results/${{ matrix.genome_release }}-${{ matrix.source }}/mehari/seqrepo/report/mehari_db_check.txt"
args: "--verbose --configfile config/config.yaml --workflow-profile workflow/profiles/default --show-failed-logs --cores 4 --jobs 4 results/${{ matrix.genome_release }}-${{ matrix.source }}/mehari/seqrepo/report/mehari_db_check.txt"
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Warning: Workflow profile configuration needs attention

The default profile exists but shows potential issues:

  • The profile uses both conda and apptainer as deployment methods
  • The workflow command was changed to use --workflow-profile but the profile still includes conda
  • The profile filename config.v8+.yaml doesn't match the expected config.yaml used in the command

The command assumes config.yaml but the actual file is config.v8+.yaml, which will cause the workflow to fail. This needs to be addressed by either:

  • Renaming the profile file to match the expected name
  • Updating the command to use the correct filename
🔗 Analysis chain

LGTM: Snakemake configuration updated for container support

The arguments have been properly updated to use the workflow profile instead of conda, which aligns with the container-based approach.

Let's verify the workflow profile configuration:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the workflow profile configuration
# Test: Check if the default profile exists and contains container settings

# Check if the profile exists
if [ -f "workflow/profiles/default/config.yaml" ]; then
    echo "Profile exists. Checking content:"
    cat workflow/profiles/default/config.yaml
else
    echo "Warning: Default profile not found at expected location"
fi

Length of output: 171


Script:

#!/bin/bash
# Let's check if the workflow/profiles directory exists and list its contents
if [ -d "workflow/profiles" ]; then
    echo "Profiles directory exists. Contents:"
    ls -la workflow/profiles/
else
    echo "Checking for any profile-related files in the repository..."
    fd -t f "config.yaml" -E "node_modules"
fi

# Also search for any references to workflow profiles in the codebase
echo -e "\nSearching for workflow profile references:"
rg "workflow.*profile" -g '!{node_modules,dist,build}/*'

Length of output: 466


Script:

#!/bin/bash
# Let's check the contents of the default profile directory
echo "Checking default profile directory contents:"
ls -la workflow/profiles/default/

# Let's also check for any yaml files in the default profile directory
echo -e "\nLooking for yaml files in default profile:"
find workflow/profiles/default -name "*.yaml" -o -name "*.yml"

# Search for container-related configurations in yaml files
echo -e "\nSearching for container configurations in yaml files:"
rg -l "container" -g "*.{yaml,yml}" workflow/profiles/

Length of output: 693


Script:

#!/bin/bash
# Let's check the contents of the config.v8+.yaml file
echo "Contents of workflow/profiles/default/config.v8+.yaml:"
cat workflow/profiles/default/config.v8+.yaml

# Also search for any references to this specific config file in the codebase
echo -e "\nReferences to config.v8+.yaml in the codebase:"
rg "config\.v8\+" -g '!{node_modules,dist,build}/*'

Length of output: 495

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 (1)
.github/workflows/build.yml (1)

38-42: Consider pinning package versions for reproducibility

While the Apptainer setup uses the official PPA, consider pinning specific versions of apptainer and squashfuse packages to ensure consistent builds across different environments.

-  sudo apt install -y apptainer squashfuse
+  sudo apt install -y apptainer=1.2.0-1 squashfuse=0.1.105-1
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 19ee33e and a3227be.

📒 Files selected for processing (1)
  • .github/workflows/build.yml (3 hunks)
🧰 Additional context used
🪛 actionlint
.github/workflows/build.yml

46-46: shellcheck reported issue in this script: SC2086:info:10:25: Double quote to prevent globbing and word splitting

(shellcheck)


46-46: shellcheck reported issue in this script: SC2086:info:10:33: Double quote to prevent globbing and word splitting

(shellcheck)


46-46: shellcheck reported issue in this script: SC2086:info:10:49: Double quote to prevent globbing and word splitting

(shellcheck)

🔇 Additional comments (2)
.github/workflows/build.yml (2)

17-17: LGTM: Version update aligns with PR objectives

The MEHARI_VERSION update to "0.30.0" is consistent with the PR's goal to upgrade the mehari package.


84-84: LGTM: Snakemake configuration updated for container support

The arguments have been properly updated to use the workflow profile instead of conda, which aligns with the container-based approach.

Comment on lines 44 to 56
# See https://github.com/apptainer/apptainer/pull/2262
- name: Disable apparmor namespace restrictions for apptainer
run: |
set -x
sudo sysctl -w kernel.apparmor_restrict_unprivileged_unconfined=0 \
-w kernel.apparmor_restrict_unprivileged_userns=0 \
-w kernel.unprivileged_userns_clone=1
sysctl kernel.apparmor_restrict_unprivileged_unconfined \
kernel.apparmor_restrict_unprivileged_userns \
kernel.unprivileged_userns_clone
mkdir -p fake_cache
singularity pull --name bc40b59cbb87acb3ff98d1dbdc12639e.simg docker://ghcr.io/varfish-org/mehari:pr-603
singularity exec --home $PWD -B $PWD/fake_cache:$PWD/fake_cache:rw bc40b59cbb87acb3ff98d1dbdc12639e.simg bash -c 'set -euo pipefail; mehari --help'
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

⚠️ Potential issue

Security: Review AppArmor namespace restriction changes

Disabling AppArmor namespace restrictions reduces the security of the container environment. Consider:

  1. Documenting why these specific kernel parameters need to be modified
  2. Exploring alternative approaches that maintain security while achieving the required functionality
  3. Adding a warning comment in the workflow about the security implications

Additionally, the shell script has some issues that should be addressed:

-          sysctl kernel.apparmor_restrict_unprivileged_unconfined \
-                      kernel.apparmor_restrict_unprivileged_userns \
-                      kernel.unprivileged_userns_clone
+          sysctl "kernel.apparmor_restrict_unprivileged_unconfined" \
+                 "kernel.apparmor_restrict_unprivileged_userns" \
+                 "kernel.unprivileged_userns_clone"
-          singularity exec --home $PWD -B $PWD/fake_cache:$PWD/fake_cache:rw bc40b59cbb87acb3ff98d1dbdc12639e.simg bash -c 'set -euo pipefail; mehari --help'
+          singularity exec --home "$PWD" -B "$PWD/fake_cache:$PWD/fake_cache:rw" bc40b59cbb87acb3ff98d1dbdc12639e.simg bash -c 'set -euo pipefail; mehari --help'
📝 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
# See https://github.com/apptainer/apptainer/pull/2262
- name: Disable apparmor namespace restrictions for apptainer
run: |
set -x
sudo sysctl -w kernel.apparmor_restrict_unprivileged_unconfined=0 \
-w kernel.apparmor_restrict_unprivileged_userns=0 \
-w kernel.unprivileged_userns_clone=1
sysctl kernel.apparmor_restrict_unprivileged_unconfined \
kernel.apparmor_restrict_unprivileged_userns \
kernel.unprivileged_userns_clone
mkdir -p fake_cache
singularity pull --name bc40b59cbb87acb3ff98d1dbdc12639e.simg docker://ghcr.io/varfish-org/mehari:pr-603
singularity exec --home $PWD -B $PWD/fake_cache:$PWD/fake_cache:rw bc40b59cbb87acb3ff98d1dbdc12639e.simg bash -c 'set -euo pipefail; mehari --help'
# See https://github.com/apptainer/apptainer/pull/2262
- name: Disable apparmor namespace restrictions for apptainer
run: |
set -x
sudo sysctl -w kernel.apparmor_restrict_unprivileged_unconfined=0 \
-w kernel.apparmor_restrict_unprivileged_userns=0 \
-w kernel.unprivileged_userns_clone=1
sysctl "kernel.apparmor_restrict_unprivileged_unconfined" \
"kernel.apparmor_restrict_unprivileged_userns" \
"kernel.unprivileged_userns_clone"
mkdir -p fake_cache
singularity pull --name bc40b59cbb87acb3ff98d1dbdc12639e.simg docker://ghcr.io/varfish-org/mehari:pr-603
singularity exec --home "$PWD" -B "$PWD/fake_cache:$PWD/fake_cache:rw" bc40b59cbb87acb3ff98d1dbdc12639e.simg bash -c 'set -euo pipefail; mehari --help'
🧰 Tools
🪛 actionlint

46-46: shellcheck reported issue in this script: SC2086:info:10:25: Double quote to prevent globbing and word splitting

(shellcheck)


46-46: shellcheck reported issue in this script: SC2086:info:10:33: Double quote to prevent globbing and word splitting

(shellcheck)


46-46: shellcheck reported issue in this script: SC2086:info:10:49: Double quote to prevent globbing and word splitting

(shellcheck)

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 (4)
.github/workflows/build.yml (1)

67-76: Consider updating cache action version

The cache action is using v3 while other actions in the workflow are using v4. Consider updating to maintain consistency.

-      - name: Cache conda
-        uses: actions/cache@v3
+      - name: Cache conda
+        uses: actions/cache@v4
.github/workflows/release-please.yml (3)

56-61: Consider pinning Apptainer version for reproducibility

While the Apptainer setup is correct, consider pinning to a specific version to ensure consistent builds across time.

-sudo apt install -y apptainer squashfuse
+sudo apt install -y apptainer=1.2.0 squashfuse=1:0.1.27

85-94: Enhance cache key strategy

The Conda cache implementation looks good, but consider including the Python version in the cache key for more precise cache hits.

-            ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('environment.yaml') }}
+            ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-py3.12-${{ hashFiles('environment.yaml') }}

104-109: Consider adding error handling and logging

While the workflow execution is correct, consider adding error handling and artifact collection for failed runs to aid in debugging.

 snakemake --verbose --configfile config/config.yaml --workflow-profile workflow/profiles/default --show-failed-logs --cores 4 --jobs 4 results/${{ matrix.genome_release }}-${{ matrix.source }}/mehari/seqrepo/report/mehari_db_check.txt
+|| {
+  echo "Workflow failed. Collecting logs..."
+  mkdir -p logs
+  cp .snakemake/log/*.log logs/ || true
+  exit 1
+}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between a3227be and d84219e.

📒 Files selected for processing (4)
  • .github/workflows/build.yml (3 hunks)
  • .github/workflows/release-please.yml (3 hunks)
  • environment.yaml (1 hunks)
  • workflow/Snakefile (1 hunks)
🔇 Additional comments (10)
environment.yaml (1)

1-3: LGTM! Channel configuration follows best practices

The channel order (conda-forge before bioconda) is correct and these channels are appropriate for bioinformatics tools.

workflow/Snakefile (1)

3-3: LGTM! Please verify Snakemake version compatibility.

The version update aligns with the environment.yaml specification. However, since this is a significant version jump (8.16.0 → 8.25.3), please ensure:

  • All workflow features remain compatible with the new version
  • CI/CD pipelines are updated to use Snakemake ≥8.25.3
.github/workflows/build.yml (5)

17-17: LGTM: Version update aligns with PR objectives

The MEHARI_VERSION update to "0.30.0" matches the PR's objective to upgrade mehari.


38-42: LGTM: Apptainer setup follows best practices

The Apptainer installation steps are properly sequenced and use appropriate package management commands.


44-49: ** Security concerns with AppArmor restrictions**

A previous review already highlighted the security implications of disabling AppArmor namespace restrictions. The concerns remain valid.


77-85: LGTM: Miniconda setup is well configured

The setup includes important configurations:

  • Uses libmamba solver for better performance
  • Specifies Python version explicitly
  • Removes conda defaults as recommended

86-91: Verify cache directory permissions

The workflow creates cache directories but doesn't explicitly set permissions. While this might work, consider adding explicit permissions to prevent potential issues in different runner environments.

 mkdir -p ~/snakemake_cache
 mkdir -p ${{ github.workspace }}/snakemake_cache
+chmod 755 ~/snakemake_cache ${{ github.workspace }}/snakemake_cache
.github/workflows/release-please.yml (3)

14-14: Version update aligns with PR objectives

The MEHARI_VERSION update to "0.30.0" matches the PR objective of upgrading mehari.


62-67: Security consideration for AppArmor configuration

The AppArmor namespace restrictions are being disabled for Apptainer to work. While this is necessary for the build process, it's important to note this reduces security isolation. Consider adding a comment explaining why this is needed and ensure this only runs in the controlled CI environment.

 # See https://github.com/apptainer/apptainer/pull/2262
+# WARNING: These settings reduce security isolation but are required for Apptainer in CI
 - name: Disable apparmor namespace restrictions for apptainer

95-103: LGTM: Robust Conda setup configuration

The Miniconda setup is well-configured with:

  • Explicit Python version
  • libmamba solver for better performance
  • Environment file specification
  • Removal of defaults channel

Comment on lines +4 to +5
dependencies:
- snakemake =8.25.3
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add mehari dependency

While the snakemake version is correctly specified, the mehari package dependency (version 0.30.0) should also be added here since it's a core dependency of this project.

Apply this diff:

 dependencies:
   - snakemake =8.25.3
+  - mehari =0.30.0
📝 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
dependencies:
- snakemake =8.25.3
dependencies:
- snakemake =8.25.3
- mehari =0.30.0

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 (3)
.github/workflows/build.yml (3)

47-49: Improve sysctl command structure

The sysctl commands can be simplified and made more maintainable:

-          sudo sysctl -w kernel.apparmor_restrict_unprivileged_unconfined=0 \
-                      -w kernel.apparmor_restrict_unprivileged_userns=0 \
-                      -w kernel.unprivileged_userns_clone=1
+          sudo sysctl -w \
+            kernel.apparmor_restrict_unprivileged_unconfined=0 \
+            kernel.apparmor_restrict_unprivileged_userns=0 \
+            kernel.unprivileged_userns_clone=1

77-85: Consider pinning Python version more precisely

While Python 3.12 works, consider using a more specific version (e.g., 3.12.0) to ensure consistent builds across environments.


89-90: Make directory creation more robust

Consider adding error handling and checks for the directory creation:

-          mkdir -p ~/snakemake_cache
-          mkdir -p ${{ github.workspace }}/snakemake_cache
+          for dir in ~/snakemake_cache "${{ github.workspace }}/snakemake_cache"; do
+            mkdir -p "$dir" || { echo "Failed to create directory: $dir"; exit 1; }
+          done
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d84219e and 311cffc.

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

17-18: LGTM: Environment variables properly configured

The version update aligns with the PR objectives, and using github.workspace for cache paths is a good practice.


67-76: LGTM: Proper cache configuration

The conda cache configuration follows best practices with appropriate versioning and key generation.

@tedil tedil enabled auto-merge (squash) November 20, 2024 10:35
@tedil tedil merged commit 4b06bc8 into main Nov 20, 2024
6 checks passed
@tedil tedil deleted the upgrade-mehari-to-0.30.0 branch November 20, 2024 10:53
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.

2 participants