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

ci: improve caching #2329

Merged
merged 42 commits into from
Nov 18, 2024
Merged

ci: improve caching #2329

merged 42 commits into from
Nov 18, 2024

Conversation

shumkov
Copy link
Member

@shumkov shumkov commented Nov 13, 2024

Issue being fixed or feature implemented

We not efficiently using different types of caching. Docker layer cache doesn't work.

What was done?

  • Use artifacts for build js
  • Store docker cache mounts in GHA cache
  • Store librocksdb in GHA cache
  • Store local network data in GHA cache
  • Store yarn unplugged in GHA cache
  • Remove unnecessary "Prebuild and cache some Rust dependencies" job
  • Improve sccache vars in Dockerfile

How Has This Been Tested?

Running CI

Breaking Changes

None

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • New Features

    • Improved caching mechanisms for various workflows, enhancing performance and reliability.
    • Introduced a new step to configure sccache for better caching management in Rust jobs.
    • Added a new input parameter for restoring local network data in the Dashmate tests workflow.
    • Enhanced handling of JavaScript build artifacts through updated workflows.
    • Introduced a new constant to track the last block time in the metrics module.
    • Updated workflows to ensure JavaScript packages are built before running end-to-end tests.
    • Updated workflows to utilize new actions for artifact downloading and checking.
    • Added a new input parameter for caching in the image build workflow.
    • Enhanced caching strategy for Docker images with new AWS integration.
    • Added new public modules in the Rust library for metrics and testing.
  • Bug Fixes

    • Ensured workflows fail gracefully if caches are not found by adding fail-on-cache-miss parameters.
  • Documentation

    • Updated action descriptions and parameters for clarity and improved usability.
  • Refactor

    • Streamlined caching processes by replacing outdated actions with the latest actions/cache@v4.
    • Simplified cache restoration configurations by removing unnecessary parameters related to S3 buckets.
    • Updated job dependencies to ensure proper execution order.
    • Enhanced artifact management by transitioning to new actions for downloading and checking artifacts.
    • Adjusted workflow configurations to remove outdated caching actions and improve artifact handling.
    • Updated Dockerfile to refine caching mechanisms and enhance build configurations.
  • Chores

    • Removed unnecessary parameters related to S3 buckets from caching configurations.
    • Updated workflows to utilize the latest actions for downloading and managing artifacts.
    • Deleted the obsolete workflow for rebuilding cached dependencies.

Copy link
Contributor

coderabbitai bot commented Nov 13, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The pull request introduces significant modifications to multiple GitHub Actions workflows, primarily focusing on enhancing caching mechanisms for various build processes. The changes include replacing strophy/actions-cache@opendal-update with actions/cache@v4 across several workflows, simplifying configurations by removing unnecessary parameters, and adding new inputs and outputs where applicable. Additionally, new steps for configuring sccache are introduced to streamline the caching process for Rust and JavaScript builds. Overall, these updates aim to improve the efficiency and reliability of the CI/CD pipelines.

Changes

File Path Change Summary
.github/actions/docker/action.yaml Removed cache_mounts, added cargo_profile, bucket, region, aws_access_key_id, aws_secret_access_key; updated to docker/build-push-action@v6.
.github/actions/librocksdb/action.yaml Replaced cache action from strophy/actions-cache@opendal-update to actions/cache@v4; modified bucket input default value to null.
.github/actions/local-network/action.yaml Updated cache actions to actions/download-artifact@v4 and actions/cache@v4; renamed steps and simplified parameters.
.github/actions/nodejs/action.yaml Replaced caching action from strophy/actions-cache@opendal-update to actions/cache@v4; removed S3 bucket parameters.
.github/actions/rust/action.yaml Updated caching for Cargo registry from strophy/actions-cache@opendal-update to actions/cache@v4; removed S3 bucket parameters.
.github/workflows/release.yml Updated release-npm job to use softwareforgood/check-artifact-v4-existence@v0 for artifact checks; added sccache configuration step.
.github/workflows/tests-build-js.yml Replaced caching action with actions/cache@v4; added sccache configuration step; streamlined conditional checks.
.github/workflows/tests-codeql.yml Updated caching action to actions/download-artifact@v4; removed bucket and root parameters; added artifact name parameter.
.github/workflows/tests-dashmate.yml Updated caching actions to actions/download-artifact@v4 and actions/cache@v4; added new input parameter for restoring local network data.
.github/workflows/tests-js-package.yml Replaced caching action with actions/download-artifact@v4; updated job definitions to reflect this change.
.github/workflows/tests-rs-package.yml Removed test-runner and lint-runner inputs; updated jobs to run on ubuntu-24.04; added sccache configuration step.
.github/workflows/tests.yml Added remove-artifacts job for cleaning up artifacts; updated dependencies and conditions for existing jobs.
packages/rs-drive-abci/src/metrics.rs Introduced COUNTER_LAST_BLOCK_TIME constant; modified Prometheus struct for error handling; added abci_last_block_time function.
Dockerfile Commented out --mount directives; added conditional checks for build profiles; enhanced handling of TARGETARCH variable; updated build commands and comments.
.github/workflows/cached.yml Removed workflow for rebuilding cached dependencies.
packages/wasm-dpp/src/lib.rs Changed visibility of modules; uncommented state_transition module for public export; added documentation comment.
.github/actions/s3-layer-cache-settings/action.yaml Updated region and bucket inputs to be required.
packages/rs-drive-abci/src/lib.rs Added metrics and test modules for metrics handling and testing, respectively.
.github/workflows/tests-build-image.yml Added new input parameter cache_to_name for caching logic based on event name.

Possibly related PRs

Suggested reviewers

  • QuantumExplorer
  • lklimek

🐰 "In the fields where the rabbits play,
We’ve streamlined builds in a brand new way.
With caching swift and actions bright,
Our workflows now take flight!
Hop along, let’s celebrate,
For smoother paths await our fate!" 🐇


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.

@shumkov shumkov changed the title ci: fix docker cache mounts ci: switch from s3 to github action cache Nov 13, 2024
@shumkov shumkov marked this pull request as ready for review November 13, 2024 15:19
# Conflicts:
#	.github/actions/docker/action.yaml
#	.github/workflows/release.yml
#	.github/workflows/tests-build-js.yml
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: 7

🧹 Outside diff range and nitpick comments (21)
.github/workflows/tests-codeql.yml (2)

33-40: Remove commented out S3 cache configuration.

Since we're transitioning to GitHub Actions cache, this commented-out configuration can be safely removed to maintain code cleanliness.


AWS credentials configuration can be safely removed

Looking at the workflow file content and its dependencies:

  • The AWS credentials were previously used for S3-based caching, which has been commented out and replaced with GitHub Actions cache
  • The workflow doesn't use any other AWS services or features
  • The tests-codeql.yml workflow only performs CodeQL analysis using GitHub's actions
🔗 Analysis chain

Line range hint 21-26: Verify if AWS credentials are still required.

Since the caching mechanism has been moved from S3 to GitHub Actions cache, please verify if the AWS credentials configuration step is still necessary for other parts of the workflow.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if AWS credentials are used elsewhere in the workflow

# Search for AWS-related actions or commands
rg -l 'aws-' .github/workflows/tests-codeql.yml

# Search for AWS service usage
rg -i 's3|aws|amazon' .github/workflows/tests-codeql.yml

Length of output: 1217


Script:

#!/bin/bash
# Let's check the entire workflow file content to understand AWS credentials usage
cat .github/workflows/tests-codeql.yml

# Also search for any AWS references in other workflow files
rg -i 'aws|s3|amazon' .github/workflows/

Length of output: 13090

.github/actions/librocksdb/action.yaml (2)

25-32: Remove commented out S3 caching implementation

Since we're migrating to GitHub Actions cache, we should remove the commented out S3 implementation to maintain code cleanliness.

-#    - name: Restore cached librocksdb from S3
-#      id: librocksdb-cache
-#      uses: strophy/actions-cache@opendal-update
-#      with:
-#        bucket: ${{ inputs.bucket }}
-#        path: /opt/rocksdb
-#        key: librocksdb/${{ inputs.version }}/${{ runner.os }}/${{ runner.arch }}

Line range hint 8-11: Remove unused bucket input parameter

Since we've migrated from S3 to GitHub Actions cache, the bucket input parameter is no longer needed.

-  bucket:
-    description: S3 bucket to use for caching
-    required: false
-    default: multi-runner-cache-x1xibo9c
.github/workflows/tests-js-package.yml (1)

38-45: Remove commented out S3 cache configuration code

Since we're transitioning to GitHub Actions cache, we should remove the commented-out code. The Git history will preserve this information if needed in the future.

-#      - name: Restore JS build artifacts
-#        uses: strophy/actions-cache@opendal-update
-#        with:
-#          bucket: multi-runner-cache-x1xibo9c
-#          root: actions-cache
-#          path: build-js-artifacts-${{ github.sha }}.tar
-#          key: build-js-artifacts/${{ github.sha }}

Also applies to: 82-89

.github/workflows/tests-build-js.yml (1)

Remove AWS credentials configuration step

The AWS credentials configuration step should be removed as it's no longer needed:

  • The workflow has migrated from S3-based caching to GitHub Actions cache (actions/cache@v4)
  • All S3-related configurations are commented out (SCCACHE_BUCKET, SCCACHE_S3_KEY_PREFIX)
  • No other AWS services or actions are being used in the workflow
🔗 Analysis chain

Line range hint 8-13: Verify if AWS credentials are still needed

Since we're transitioning from S3 to GitHub Actions cache, verify if the AWS credentials configuration step is still necessary. If it's not used elsewhere in the workflow, it should be removed.


Let's check the actual usage of AWS credentials in these workflows to determine if they're still necessary.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for AWS-related usage in the workflow
rg -l 'aws-access-key|AWS_ACCESS_KEY|aws-secret-access-key|AWS_SECRET_ACCESS_KEY|aws-region|AWS_REGION' .github/workflows/

Length of output: 567


Script:

#!/bin/bash
# Search for actual AWS service usage in workflows
rg -A 5 'aws-access-key|AWS_ACCESS_KEY|aws-secret-access-key|AWS_SECRET_ACCESS_KEY' .github/workflows/tests-build-js.yml

Length of output: 451


Script:

#!/bin/bash
# Search for S3 or other AWS service usage in the workflow
rg -i 's3|aws-actions|aws/' .github/workflows/tests-build-js.yml

Length of output: 192


Script:

#!/bin/bash
# Check if there are any other AWS-related steps or actions in the workflow
cat .github/workflows/tests-build-js.yml

Length of output: 3537

.github/actions/local-network/action.yaml (2)

Line range hint 104-110: Consider adding error handling for cache save failures

While the migration looks good, the cache save operation might fail silently. Consider adding error handling to notify when cache saves fail, as this could impact subsequent workflow runs.

 - name: Save local network data
   uses: actions/cache/save@v4
+  id: save-network-data
   with:
     path: |
       ${{ env.HOME }}/.dashmate
       **/.env
       dashmate_volumes_dump
     key: local-network-volumes/${{ steps.dashmate-fingerprint.outputs.sha }}
   if: steps.local-network-data.outputs.cache-hit != 'true'
+- name: Check cache save status
+  if: steps.local-network-data.outputs.cache-hit != 'true'
+  shell: bash
+  run: |
+    if [[ "${{ steps.save-network-data.outcome }}" != "success" ]]; then
+      echo "::warning::Failed to save network data to cache"
+    fi

42-42: Consider implementing the TODO comment

The comment suggests using upload artifacts action instead of caching. This might be a valid architectural consideration since artifacts are more suitable for passing data between jobs, while caching is better for improving performance across workflow runs.

Would you like me to help implement this change using actions/upload-artifact and actions/download-artifact actions?

.github/actions/rust/action.yaml (3)

102-116: Remove commented-out S3 cache configuration.

Since we're transitioning to GitHub Actions cache, this commented-out configuration should be removed to maintain code cleanliness. If needed, the history can be referenced through version control.

-#    - name: Cache cargo registry (S3 bucket cache)
-#      uses: strophy/actions-cache@opendal-update
-#      if: inputs.cache == 'true'
-#      with:
-#        bucket: multi-runner-cache-x1xibo9c
-#        root: actions-cache
-#        path: |
-#          ${{ env.HOME }}/.cargo/registry/index
-#          ${{ env.HOME }}/.cargo/registry/cache
-#          ${{ env.HOME }}/.cargo/git
-#        key: ${{ runner.os }}/cargo/registry/${{ hashFiles('**/Cargo.lock') }}
-#        restore-keys: |
-#          ${{ runner.os }}/cargo/registry/${{ hashFiles('**/Cargo.lock') }}
-#          ${{ runner.os }}/cargo/registry/

Line range hint 89-91: Good use of complementary caching mechanisms!

The combination of sccache for compilation artifacts and cargo registry caching for dependencies provides comprehensive caching coverage. The pinned sccache version matching the Dockerfile is a good practice.

Consider documenting the caching strategy in the repository's documentation to help other contributors understand:

  • The role of sccache vs cargo registry cache
  • When each cache is invalidated
  • How to troubleshoot cache issues

⚠️ Potential cache configuration overlap detected

The cache configuration in the Rust action looks good on its own, but there's an overlapping cache configuration in the Docker action that targets the same Cargo paths using buildkit-cache-dance. This could lead to:

  • Redundant caching of the same artifacts
  • Potential race conditions or inconsistencies between the two caching mechanisms

Suggested actions:

  • Either consolidate the caching strategy to use a single mechanism
  • Or ensure the two actions are never used in the same workflow to prevent conflicts
🔗 Analysis chain

Line range hint 117-129: The cache configuration looks good!

The transition to actions/cache@v4 is well-implemented with:

  • Appropriate cache paths for Cargo registry
  • Good cache key strategy using OS and Cargo.lock
  • Proper fallback with restore-keys

Let's verify the cache effectiveness:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for other Cargo-related caching in the repository
# to ensure we're not duplicating cache configurations

# Look for other cargo cache configurations
echo "Checking for other cargo cache configurations..."
rg -l 'cargo/registry|\.cargo/git' .github/

Length of output: 220


Script:

#!/bin/bash
# Let's check the content of the docker action to see if there's any duplicate caching
echo "Content of docker action cargo caching:"
rg -A 5 -B 5 'cargo/registry|\.cargo/git' .github/actions/docker/action.yaml

Length of output: 809

.github/workflows/tests-dashmate.yml (2)

44-57: LGTM! Consider cleaning up commented code.

The transition from S3 to GitHub Actions cache is implemented correctly. The fail-on-cache-miss parameter ensures the workflow fails fast if artifacts are missing, which is appropriate since these are required for the workflow to function.

Consider removing the commented-out S3 cache configuration (lines 44-51) since we're committing to GitHub Actions cache. If needed, this history will be preserved in git.


97-117: LGTM! Clean up commented configuration.

The transition of local network data caching to GitHub Actions cache is implemented correctly, maintaining the same paths and conditional logic.

Remove the commented-out S3 configuration (lines 97-108) and the commented S3 parameters (lines 113-114) to keep the workflow file clean.

.github/actions/docker/action.yaml (2)

Line range hint 19-33: Remove unused AWS-related inputs

Since we're transitioning from S3 to GitHub Actions cache, the following inputs are no longer needed and should be removed:

  • bucket
  • region
  • aws_access_key_id
  • aws_secret_access_key

S3 dependencies still present in action inputs and workflow files

The action still contains S3-related input parameters and commented-out S3 configurations that should be removed since the migration to GitHub Actions cache is complete:

  • .github/actions/docker/action.yaml:
    • Remove unused input parameters: bucket, region, aws_access_key_id, aws_secret_access_key
    • Clean up commented-out S3 configurations (lines with SCCACHE_BUCKET, SCCACHE_S3_KEY_PREFIX, AWS_*)
🔗 Analysis chain

Line range hint 1-189: Verify complete removal of S3 dependencies

Let's ensure all S3-related configurations have been properly migrated to GitHub Actions cache.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining S3-related configurations in GitHub Actions

# Search for S3-related terms in GitHub Actions files
echo "Checking for remaining S3 configurations in GitHub Actions files..."
rg -i 's3|aws|bucket' .github/

Length of output: 16044

.github/workflows/release.yml (3)

43-58: Remove commented out code and approve cache configuration.

The switch to actions/cache/restore@v4 is appropriate for the PR's objective. The fail-on-cache-miss parameter is correctly set to ensure the job fails if required artifacts are missing.

Remove the commented-out configuration (lines 43-51) as it's no longer needed and clutters the workflow file.


100-103: Clean up S3-related environment variables.

The addition of SCCACHE_GHA_ENABLED is correct for enabling GitHub Actions cache support in sccache.

Remove the commented-out S3-related environment variables as they're no longer needed.


255-269: Remove commented out code and approve cache configuration.

The cache configuration is consistent with the earlier change in the workflow, correctly using actions/cache/restore@v4 with appropriate parameters.

Remove the commented-out configuration (lines 255-262) to maintain a clean workflow file.

.github/workflows/tests-rs-package.yml (3)

48-54: Consider cleaning up commented S3 configuration

The transition from S3 to GitHub Actions cache is implemented consistently across all jobs. However, the commented-out S3 configuration (SCCACHE_BUCKET, SCCACHE_REGION, SCCACHE_S3_KEY_PREFIX) is retained in multiple places. This creates unnecessary noise in the workflow file.

Consider either:

  1. Removing the commented configuration if the transition is permanent
  2. Adding a comment explaining why it's kept (e.g., for fallback purposes)
-#          SCCACHE_BUCKET: multi-runner-cache-x1xibo9c
-#          SCCACHE_REGION: ${{ secrets.AWS_REGION }}
-#          SCCACHE_S3_KEY_PREFIX: ${{ runner.os }}/sccache/${{ runner.arch }}/linux-gnu

Also applies to: 60-63, 84-90, 94-97, 130-136, 141-144, 234-240, 245-248, 281-287, 291-294


Line range hint 29-34: Remove unused AWS credentials configuration

Since the caching mechanism has been moved to GitHub Actions, the AWS credentials configuration step appears to be unnecessary for the lint job unless it's required for other purposes.

If AWS credentials are not needed for other purposes in this job, consider removing the following configuration:

-      - name: Configure AWS credentials and bucket region
-        uses: aws-actions/configure-aws-credentials@v4
-        with:
-          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
-          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
-          aws-region: ${{ secrets.AWS_REGION }}

Line range hint 1-294: Consider optimizing workflow structure

The workflow contains repeated configuration blocks for sccache across multiple jobs. This could be optimized to reduce maintenance overhead and improve readability.

Consider these improvements:

  1. Create a reusable composite action for sccache configuration
  2. Move common environment variables to the workflow level
  3. Create a reusable job template for similar jobs

Example composite action:

# .github/actions/setup-sccache/action.yml
name: 'Setup sccache'
description: 'Configures sccache for GitHub Actions cache'
runs:
  using: "composite"
  steps:
    - uses: actions/github-script@v7
      with:
        script: |
          core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
          core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between f1f0470 and fad022e.

📒 Files selected for processing (11)
  • .github/actions/docker/action.yaml (2 hunks)
  • .github/actions/librocksdb/action.yaml (1 hunks)
  • .github/actions/local-network/action.yaml (3 hunks)
  • .github/actions/nodejs/action.yaml (1 hunks)
  • .github/actions/rust/action.yaml (2 hunks)
  • .github/workflows/release.yml (4 hunks)
  • .github/workflows/tests-build-js.yml (3 hunks)
  • .github/workflows/tests-codeql.yml (1 hunks)
  • .github/workflows/tests-dashmate.yml (2 hunks)
  • .github/workflows/tests-js-package.yml (2 hunks)
  • .github/workflows/tests-rs-package.yml (5 hunks)
🔇 Additional comments (13)
.github/actions/nodejs/action.yaml (1)

Line range hint 31-37: LGTM! Clean implementation of GitHub Actions cache.

The implementation correctly:

  • Uses the latest actions/cache@v4
  • Maintains the same cache paths and key structure
  • Aligns with the PR objective of switching from S3 to GitHub Actions cache
.github/workflows/tests-codeql.yml (1)

41-46: LGTM! Cache configuration looks good.

The transition to actions/cache/restore@v4 is implemented correctly with appropriate parameters. The fail-on-cache-miss: 'true' ensures the workflow fails early if the build artifacts are missing, which is a good practice.

#!/bin/bash
# Description: Verify cache key consistency across workflows

# Check if the cache key pattern is consistent across other workflow files
rg 'key: build-js-artifacts/\$\{\{ github.sha \}\}' .github/workflows/
.github/actions/librocksdb/action.yaml (1)

39-39: Verify cache-hit output variable compatibility

Let's verify that steps.librocksdb-cache.outputs.cache-hit is the correct output variable for actions/cache@v4.

✅ Verification successful

Cache output variable is correctly used

The verification shows that steps.librocksdb-cache.outputs.cache-hit is the correct output variable:

  • Multiple workflows in the repository consistently use the same cache-hit output pattern with actions/cache@v4
  • The pattern is used across different workflow files (.github/workflows/) and actions (.github/actions/)
  • All cache step conditions follow the same format: steps.<step-id>.outputs.cache-hit
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check actions/cache@v4 documentation for correct output variables

# Fetch the latest actions/cache documentation
gh api repos/actions/cache/contents/README.md | jq -r '.content' | base64 -d | grep -A 5 "### Outputs"

Length of output: 176


Script:

#!/bin/bash
# Let's try searching for cache-hit usage patterns in GitHub Actions workflows
rg -U "cache-hit.*'true'" .github/

Length of output: 2768


Script:

#!/bin/bash
# Search for any cache step ID references
rg "id:\s*.*cache" .github/

Length of output: 429


Script:

#!/bin/bash
# Look for cache action usage patterns
rg "uses:\s*actions/cache@" .github/

Length of output: 496

.github/workflows/tests-js-package.yml (2)

47-51: LGTM! Cache configuration looks good

The new GitHub Actions cache configuration is well structured:

  • Uses the latest v4 of actions/cache
  • Appropriate use of fail-on-cache-miss since build artifacts are required
  • Good cache key strategy using the commit SHA

Also applies to: 91-95


Line range hint 28-32: Verify if AWS credentials are still needed

Since we're transitioning from S3 to GitHub Actions cache, we should verify if the AWS credentials configuration is still necessary for other purposes in this workflow.

Also applies to: 68-72

✅ Verification successful

Let me analyze the results. The search shows that AWS credentials are still actively used in several workflows for purposes beyond S3:

  1. In tests-test-suite.yml and tests-packges-functional.yml, AWS credentials are used for ECR (Elastic Container Registry) login:
- name: Login to ECR
  run: aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ env.ECR_HOST }}
  1. In tests-build-image.yml, AWS credentials are used for ECR authentication:
- name: Login to ECR
  run: aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com

AWS credentials configuration is still required

The AWS credentials are necessary for Docker image operations with Amazon ECR, even though we're moving away from S3 to GitHub Actions cache. The credentials are used for authenticating with ECR to pull/push Docker images.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for AWS-related usage in the workflow files
echo "Searching for AWS usage in workflow files..."
rg -l 'aws-' .github/workflows/ | while read -r file; do
  echo "=== $file ==="
  # Show AWS-related content with context
  rg -A 5 -B 5 'aws-' "$file"
done

Length of output: 9919

.github/actions/local-network/action.yaml (1)

Line range hint 56-64: LGTM! Clean migration of restore logic

The migration from S3 to GitHub Actions cache maintains the same paths and keys while removing S3-specific configuration. The conditional logic for volume restoration remains intact.

.github/workflows/tests-dashmate.yml (2)

Line range hint 1-140: Verify complete migration from S3 cache.

To ensure a complete migration, we should verify that no other parts of the codebase still reference the S3-based caching solution.

#!/bin/bash
# Search for remaining references to the S3 cache action
rg -l 'strophy/actions-cache' .github/workflows/
# Search for references to the S3 bucket
rg -l 'multi-runner-cache-x1xibo9c' .github/workflows/
🧰 Tools
🪛 actionlint

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

(shellcheck)


Line range hint 28-33: Verify if AWS credentials are still required.

Since we're moving away from S3 to GitHub Actions cache, verify if the AWS credentials configuration step is still necessary. It might only be needed for ECR access.

✅ Verification successful

AWS credentials are required for ECR access

The AWS credentials configuration is still necessary as it's being used to access Amazon Elastic Container Registry (ECR):

  • The workflow uses AWS credentials to authenticate with ECR (aws ecr get-login-password)
  • Docker images are pulled from and pushed to ECR (${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com)
  • Multiple container images are managed: drive, dapi, and dashmate-helper
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for AWS credential usage in the workflow
rg -l 'aws-access-key-id|AWS_ACCESS_KEY_ID' .github/workflows/
# Then check each file for AWS service usage beyond S3
rg -A 5 'aws ' .github/workflows/tests-dashmate.yml

Length of output: 603


Script:

#!/bin/bash
# Let's check for AWS credential configuration and usage in the workflow
cat .github/workflows/tests-dashmate.yml

Length of output: 5248

.github/actions/docker/action.yaml (2)

89-154: Well-structured cache configuration

The implementation of both Cargo and Yarn caching is well-designed:

  • Uses the latest actions/cache@v4
  • Properly structured cache keys with fallback restore-keys
  • Correct integration with buildkit-cache-dance
  • Appropriate environment variable export for GitHub Actions cache

158-172: Well-implemented GitHub Actions cache integration

The Docker build configuration has been properly updated:

  • Correctly configured sccache with GitHub Actions cache
  • Appropriate cache-from/to configuration using type=gha
  • Well-structured build arguments

Also applies to: 181-183

.github/workflows/release.yml (1)

80-86: LGTM: Proper sccache configuration for GitHub Actions cache.

The configuration correctly exports the necessary environment variables for sccache to work with GitHub Actions cache.

.github/workflows/tests-rs-package.yml (2)

84-97: LGTM! Clean implementation of GitHub Actions cache

The formatting job's configuration is well-structured and correctly implements the new caching strategy without unnecessary AWS credentials configuration.


52-53: Verify security implications of token exports

While the token export is using existing environment variables, it's important to ensure that:

  1. These tokens are not logged or exposed in job outputs
  2. The scope of token usage is limited to the caching functionality

Run the following script to check for potential token exposure in workflow logs:

✅ Verification successful

Token exports are properly scoped and secure

The token exports are secure because:

  1. The set -ex usage is in a different job and not where tokens are handled
  2. The tokens are only exported for sccache configuration and used by subsequent steps with proper environment isolation
  3. There's no direct logging or exposure of these tokens in any workflow steps
  4. The tokens are properly scoped with id-token: write permissions where needed
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for potential token exposure patterns in the workflow

# Check for debug or set -x usage that might expose tokens
rg "set -x|set -ex" .github/workflows/

# Check for echo or logging of environment variables
rg "echo.*\$ACTIONS_" .github/workflows/

Length of output: 193


Script:

#!/bin/bash
# Let's analyze the workflow files more comprehensively

# Check the context where set -x is used and if it's in the same job where tokens are exported
rg -B 5 -A 5 "set -[e]?x" .github/workflows/tests-rs-package.yml

# Check how these environment variables are used in the workflow
rg -B 5 -A 5 "ACTIONS_CACHE_URL|ACTIONS_RUNTIME_TOKEN" .github/workflows/tests-rs-package.yml

# Check for any direct token usage or exposure
rg "token|TOKEN" .github/workflows/tests-rs-package.yml

Length of output: 3493

.github/actions/nodejs/action.yaml Outdated Show resolved Hide resolved
.github/actions/librocksdb/action.yaml Outdated Show resolved Hide resolved
.github/workflows/tests-build-js.yml Outdated Show resolved Hide resolved
.github/workflows/tests-build-js.yml Outdated Show resolved Hide resolved
.github/workflows/tests-build-js.yml Outdated Show resolved Hide resolved
.github/actions/local-network/action.yaml Outdated Show resolved Hide resolved
.github/actions/docker/action.yaml Outdated Show resolved Hide resolved
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

🧹 Outside diff range and nitpick comments (5)
.github/workflows/tests-codeql.yml (1)

33-40: Remove commented-out code

Since the migration to GitHub Actions cache is complete, we should remove this commented-out section to maintain code cleanliness.

-#      - name: Restore JS build artifacts archive
-#        uses: strophy/actions-cache@opendal-update
-#        with:
-#          bucket: multi-runner-cache-x1xibo9c
-#          root: actions-cache
-#          path: build-js-artifacts-${{ github.sha }}.tar
-#          key: build-js-artifacts/${{ github.sha }}
.github/workflows/release.yml (4)

43-58: Remove commented out S3 cache configuration.

The transition to GitHub Actions cache looks good. However, the commented-out S3 configuration should be removed since we're committing to the new caching system.

-#      - name: Retrieve JS build artifacts
-#        uses: strophy/actions-cache@opendal-update
-#        id: cache
-#        with:
-#          bucket: multi-runner-cache-x1xibo9c
-#          root: actions-cache
-#          path: build-js-artifacts-${{ github.sha }}.tar
-#          key: build-js-artifacts/${{ github.sha }}

100-103: Remove commented out S3-specific environment variables.

The addition of SCCACHE_GHA_ENABLED is correct for GitHub Actions cache. The S3-specific environment variables should be removed since they're no longer needed.

           SCCACHE_GHA_ENABLED: true
-#          SCCACHE_BUCKET: multi-runner-cache-x1xibo9c
-#          SCCACHE_REGION: ${{ secrets.AWS_REGION }}
-#          SCCACHE_S3_KEY_PREFIX: ${{ runner.os }}/sccache/wasm/wasm32

255-269: Remove commented out S3 cache configuration in dashmate packages job.

The GitHub Actions cache configuration is correct, but the commented-out S3 configuration should be removed for consistency.

-#      - name: Retrieve JS build artifacts
-#        uses: strophy/actions-cache@opendal-update
-#        with:
-#          bucket: multi-runner-cache-x1xibo9c
-#          root: actions-cache
-#          path: build-js-artifacts-${{ github.sha }}.tar
-#          key: build-js-artifacts/${{ github.sha }}

Migration from S3 to GitHub Actions cache is incomplete

Several workflow files still contain references to S3 caching:

  • tests-rs-package.yml: Contains SCCACHE_BUCKET and SCCACHE_S3_KEY_PREFIX configurations
  • tests-js-package.yml: Uses strophy/actions-cache with S3 bucket
  • tests-dashmate.yml: Uses strophy/actions-cache with S3 bucket
  • tests-codeql.yml: Uses strophy/actions-cache with S3 bucket
  • tests-build-js.yml: Contains both SCCACHE and strophy/actions-cache S3 configurations
  • tests-test-suite.yml, tests-packges-functional.yml, tests-build-image.yml, release-docker-image.yml: Still have AWS bucket configuration
🔗 Analysis chain

Line range hint 1-377: Verify complete migration from S3 to GitHub Actions cache.

The workflow changes look good overall, but let's verify we haven't missed any S3 cache references.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining S3 cache references in workflow files

# Look for S3-specific terms in workflow files
echo "Checking for remaining S3 cache references..."
rg -i "s3|bucket|strophy/actions-cache" .github/workflows/

Length of output: 4609

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between fad022e and 83f6659.

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

42-46: LGTM! Good security improvement

The switch to GitHub Actions cache is a positive change that:

  • Reduces attack surface by eliminating S3 dependency
  • Simplifies configuration
  • Properly fails on cache miss

Let's verify the cache key format consistency across workflows:

✅ Verification successful

Cache key format inconsistency detected in workflows

The search results show that there are two different cache key formats being used across workflows:

  • Old format with forward slash: build-js-artifacts/${{ github.sha }}
  • New format with hyphen: build-js-artifacts-${{ github.sha }}

Let's verify if these are commented out vs active configurations:


Cache key format is consistent across all active configurations

The verification shows that:

  • All active cache configurations use the new hyphenated format build-js-artifacts-${{ github.sha }}
  • The old format with forward slash only appears in commented-out code, likely kept for reference during migration
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check cache key format consistency across workflows
# Expect: All cache keys for JS artifacts should follow the same format

# Search for cache key patterns in workflow files
echo "Checking cache key patterns in workflows:"
rg -A 1 'key:.*build-js-artifacts' .github/workflows/

Length of output: 2216


Script:

#!/bin/bash
# Check for active (non-commented) cache key configurations
echo "Active cache key configurations:"
rg -N '^[^#].*key:.*build-js-artifacts' .github/workflows/

echo -e "\nCommented out cache key configurations:"
rg -N '^#.*key:.*build-js-artifacts' .github/workflows/

Length of output: 1517

.github/workflows/release.yml (1)

80-86: LGTM: Proper sccache configuration for GitHub Actions.

The configuration correctly exports the necessary environment variables for sccache to work with GitHub Actions cache, including proper handling of undefined variables.

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

🧹 Outside diff range and nitpick comments (1)
.github/workflows/tests-build-js.yml (1)

44-61: Optimize workflow structure and git checkout

Consider these improvements:

  1. Move the condition to the job level to reduce repetition
  2. Use shallow clone unless full history is needed
 jobs:
   build-js:
     name: Build JS
     runs-on: ubuntu-24.04
+    if: ${{ needs.check-artifacts.outputs.exists != 'true' }}
     steps:
       - name: Check out repo
         uses: actions/checkout@v4
         with:
-          fetch-depth: 0
+          fetch-depth: 1
-          if: ${{ steps.exists.outputs.result != 'true' }}

       - name: Login to DockerHub
         uses: docker/login-action@v3
         with:
           username: ${{ secrets.DOCKERHUB_USERNAME }}
           password: ${{ secrets.DOCKERHUB_TOKEN }}
-          if: ${{ steps.exists.outputs.result != 'true' }}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 83f6659 and 6a03bd3.

📒 Files selected for processing (1)
  • .github/workflows/tests-build-js.yml (2 hunks)

.github/workflows/tests-build-js.yml Outdated Show resolved Hide resolved
.github/workflows/tests-build-js.yml Outdated Show resolved Hide resolved
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: 1

🧹 Outside diff range and nitpick comments (11)
.github/workflows/tests-codeql.yml (1)

Line range hint 19-24: Remove unnecessary AWS credentials configuration

Since the workflow is being migrated from S3 to GitHub Actions artifacts, the AWS credentials configuration step is no longer needed and should be removed.

-      - name: Configure AWS credentials and bucket region
-        uses: aws-actions/configure-aws-credentials@v4
-        with:
-          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
-          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
-          aws-region: ${{ secrets.AWS_REGION }}
.github/workflows/tests-build-js.yml (3)

Line range hint 1-14: Remove unnecessary AWS credentials configuration

Since we're transitioning from S3 to GitHub Actions cache, the AWS credentials configuration step is no longer needed.

-      - name: Configure AWS credentials and bucket region
-        uses: aws-actions/configure-aws-credentials@v4
-        with:
-          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
-          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
-          aws-region: ${{ secrets.AWS_REGION }}
🧰 Tools
🪛 actionlint

71-71: shellcheck reported issue in this script: SC2129:style:2:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects

(shellcheck)


16-19: Use a stable version for the artifact existence check

The action is currently pinned to v0 which is considered unstable. Consider using a stable version or SHA for better reliability.

-      - uses: softwareforgood/check-artifact-v4-existence@v0
+      - uses: softwareforgood/check-artifact-v4-existence@v1

Line range hint 1-99: Consider streamlining the caching strategy

The current implementation mixes different caching approaches:

  1. GitHub Actions artifact storage for build outputs
  2. GitHub Actions cache for sccache
  3. Remnants of S3 configuration

Consider consolidating these into a more cohesive caching strategy:

  1. Use GitHub Actions cache for all Rust/WASM compilation artifacts via sccache
  2. Use GitHub Actions artifacts only for final build outputs
  3. Remove all S3-related configurations
  4. Consider implementing a composite action to encapsulate the caching logic for reuse across workflows

This would make the workflow more maintainable and easier to understand.

🧰 Tools
🪛 actionlint

71-71: shellcheck reported issue in this script: SC2129:style:2:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects

(shellcheck)

.github/actions/local-network/action.yaml (2)

33-44: Remove commented out code

The commented out code for the old S3-based cache implementation should be removed to improve maintainability. If needed, this code can be referenced from the git history.

-    # TODO: Use upload artifacts action instead
-#    - name: Restore local network data
-#      id: local-network-data
-#      uses: strophy/actions-cache/restore@opendal-update
-#      with:
-#        bucket: multi-runner-cache-x1xibo9c
-#        root: local-network-data
-#        path: |
-#          ${{ env.HOME }}/.dashmate
-#          **/.env
-#          dashmate_volumes_dump
-#        key: local-network-volumes/${{ steps.dashmate-fingerprint.outputs.sha }}

81-92: Remove commented out code

Similar to the previous comment, remove the commented out code for the old S3-based cache save implementation.

-#    - name: Save local network data
-#      uses: strophy/actions-cache/save@opendal-update
-#      with:
-#        bucket: multi-runner-cache-x1xibo9c
-#        root: local-network-data
-#        path: |
-#          ${{ env.HOME }}/.dashmate
-#          **/.env
-#          dashmate_volumes_dump
-#        key: local-network-volumes/${{ steps.dashmate-fingerprint.outputs.sha }}
-#      if: steps.local-network-data.outputs.cache-hit != 'true'
.github/workflows/tests-dashmate.yml (1)

98-104: Clean up unnecessary commented parameters

The cache configuration is correctly implemented using actions/cache@v4. However, the commented S3-specific parameters (bucket and root) should be removed as they're not relevant to the GitHub Actions cache.

      - name: Use test suite local network data to speed up dashmate local network tests
        id: local-network-data
        uses: actions/cache@v4
        with:
-#          bucket: multi-runner-cache-x1xibo9c
-#          root: local-network-data
          path: |
            ${{ env.HOME }}/.dashmate
            dashmate_volumes_dump
          key: local-network-volumes/${{ steps.dashmate-fingerprint.outputs.sha }}
.github/workflows/tests.yml (1)

246-249: Consider adding error handling for artifact deletion

The artifact deletion step might fail if:

  • Artifacts were never created
  • Previous deletion attempts occurred
  • GitHub API issues arise

Consider adding error handling:

   - uses: geekyeggo/delete-artifact@v5
     with:
       name: build-js-artifacts-${{ github.sha }}
+      failOnError: false
     if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || !github.event.pull_request.draft }}
.github/workflows/release.yml (2)

85-89: Remove commented S3 configuration

Since we're transitioning to GitHub Actions cache, the commented S3 configuration should be removed rather than left as comments.

-#          SCCACHE_BUCKET: multi-runner-cache-x1xibo9c
-#          SCCACHE_REGION: ${{ secrets.AWS_REGION }}
-#          SCCACHE_S3_KEY_PREFIX: ${{ runner.os }}/sccache/wasm/wasm32

Line range hint 1-324: Well-structured transition from S3 to GitHub Actions cache

The implementation successfully transitions from S3 to GitHub Actions cache while maintaining proper build artifact handling. The workflow maintains good separation of concerns between build, cache, and release stages.

Some architectural considerations:

  1. The caching strategy is more maintainable as it uses GitHub's native features
  2. The artifact handling includes proper error checking and retention policies
  3. The workflow maintains backward compatibility while removing S3 dependencies

Consider implementing a cleanup job to ensure artifacts are properly cleaned up even if the workflow fails.

.github/workflows/tests-rs-package.yml (1)

40-45: Consider adding cache fallback mechanism

While the migration to GitHub Actions cache is good, consider implementing a fallback mechanism in case the GitHub Actions cache fails or is unavailable. This could involve:

  1. Keeping S3 as a secondary cache
  2. Adding cache versioning
  3. Implementing cache warming strategies

Example implementation:

env:
  SCCACHE_GHA_ENABLED: true
  # Fallback to S3 if GitHub Actions cache fails
  SCCACHE_FALLBACK: s3
  SCCACHE_BUCKET: ${{ vars.CACHE_BUCKET }}
  SCCACHE_REGION: ${{ secrets.AWS_REGION }}
  # Add cache versioning
  SCCACHE_S3_KEY_PREFIX: v1/${{ runner.os }}/sccache/${{ runner.arch }}/linux-gnu

Also applies to: 52-55, 76-81, 86-89, 122-127, 133-136, 226-231, 237-240, 274-279, 284-287

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 6a03bd3 and 98232ef.

📒 Files selected for processing (8)
  • .github/actions/local-network/action.yaml (3 hunks)
  • .github/workflows/release.yml (3 hunks)
  • .github/workflows/tests-build-js.yml (2 hunks)
  • .github/workflows/tests-codeql.yml (1 hunks)
  • .github/workflows/tests-dashmate.yml (2 hunks)
  • .github/workflows/tests-js-package.yml (2 hunks)
  • .github/workflows/tests-rs-package.yml (7 hunks)
  • .github/workflows/tests.yml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/tests-js-package.yml
🔇 Additional comments (14)
.github/workflows/tests-codeql.yml (1)

33-36: LGTM! Successful migration to GitHub Actions artifacts

The change from S3 to GitHub Actions artifacts is implemented correctly:

  • Uses the official actions/download-artifact@v4 action
  • Includes SHA in artifact name for uniqueness
  • Maintains compatibility with the subsequent unpack step
.github/actions/local-network/action.yaml (3)

14-17: Ensure coordinated artifact name updates across workflows

The artifact name format has changed from build-js-artifacts/${{ github.sha }} to build-js-artifacts-${{ github.sha }}. This change requires coordinated updates across all workflows that produce or consume these artifacts.

#!/bin/bash
# Search for workflows still using the old artifact name format
rg 'name: build-js-artifacts/\$\{\{ github.sha \}\}' .github/workflows/

Line range hint 46-52: LGTM! Clean implementation using GitHub's official cache action

The transition to actions/cache/restore@v4 is well implemented, maintaining the same functionality while removing S3-specific complexity.


Line range hint 93-101: LGTM! Clean implementation using GitHub's official cache action

The transition to actions/cache/save@v4 is well implemented, maintaining the same functionality while removing S3-specific complexity. The conditional save on cache miss is correctly preserved.

.github/workflows/tests-dashmate.yml (1)

44-47: LGTM: Appropriate use of GitHub's artifact download action

The transition from S3-based caching to GitHub's native artifact system is well implemented. Using actions/download-artifact@v4 with the commit SHA in the artifact name ensures proper artifact versioning and isolation.

.github/workflows/tests.yml (2)

175-175: LGTM: Proper job dependency added

Adding build-js as a dependency ensures that JavaScript packages are built before running E2E tests, which is the correct order of operations.


234-242: LGTM: Well-structured artifact cleanup job

The job is properly configured to:

  • Run after all jobs that consume JS build artifacts
  • Execute even if dependent jobs are skipped (always())
  • Target specific artifacts using the commit SHA
.github/workflows/release.yml (4)

64-70: LGTM: Clean transition from S3 to GitHub Actions cache

The sccache configuration correctly switches from S3 to GitHub Actions cache by exporting the necessary environment variables.


148-155: LGTM: Robust artifact handling implementation

The artifact upload configuration is well-implemented with:

  • Proper error handling with if-no-files-found: error
  • Appropriate retention period
  • Correct conditional execution

249-252: LGTM: Consistent artifact handling

The artifact download configuration correctly matches the upload configuration, ensuring proper artifact flow between jobs.


43-46: Verify the reliability of the third-party action

The softwareforgood/check-artifact-v4-existence@v0 action is relatively new. Consider using the official actions/cache@v4 with cache key validation instead.

.github/workflows/tests-rs-package.yml (3)

Line range hint 1-11: LGTM! Workflow inputs simplified

The removal of dynamic runner inputs in favor of a static runner configuration simplifies the workflow without losing functionality.


16-16: LGTM! Standardized runner configuration

Standardizing on ubuntu-24.04 across all jobs improves workflow consistency and maintainability.

Also applies to: 207-207, 248-248


40-45: LGTM! Successfully migrated to GitHub Actions cache

The migration from S3 to GitHub Actions cache is implemented correctly with proper environment variable configuration.

Also applies to: 52-55

.github/workflows/tests-dashmate.yml Outdated Show resolved Hide resolved
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: 2

🧹 Outside diff range and nitpick comments (6)
.github/workflows/tests-build-js.yml (2)

16-19: Consider using a more maintainable artifact naming strategy

The current artifact naming strategy using SHA (js-build-${{ github.sha }}) could lead to storage management issues over time. Consider using a more sustainable naming scheme based on branch name or build type.

- name: js-build-${{ github.sha }}
+ name: js-build-${{ github.ref_name }}

89-96: Consider adding artifact compression and validation

While the artifact upload is functional, consider adding compression and validation steps to ensure reliable builds:

  1. The artifacts could be compressed before upload to save space
  2. A validation step could verify the integrity of the uploaded files
+ - name: Compress build artifacts
+   run: tar czf build-artifacts.tar.gz ${{ steps.diff.outputs.files }}
+   if: ${{ steps.check-artifact.outputs.exists != 'true' }}
+
  - name: Upload the archive of built files
    uses: actions/upload-artifact@v4
    with:
      name: js-build-${{ github.sha }}
-     path: ${{ steps.diff.outputs.files }}
+     path: build-artifacts.tar.gz
      retention-days: 1
      if-no-files-found: error
+     compression-level: 0  # Already compressed
    if: ${{ steps.check-artifact.outputs.exists != 'true' }}
+
+ - name: Validate uploaded artifact
+   run: |
+     gh api -H "Accept: application/vnd.github+json" \
+       /repos/${{ github.repository }}/actions/artifacts \
+       --jq ".artifacts[] | select(.name == \"js-build-${{ github.sha }}\")" \
+     || echo "::error::Artifact validation failed"
+   if: ${{ steps.check-artifact.outputs.exists != 'true' }}
.github/workflows/release.yml (4)

43-46: Consider pinning to a specific version hash.

The artifact checking implementation looks good, but for better reproducibility and security, consider pinning to a specific commit hash instead of using @v0.

-      - uses: softwareforgood/check-artifact-v4-existence@v0
+      - uses: softwareforgood/check-artifact-v4-existence@5c2c22cb66f7fb198f5f88b9d4c01c1a11a9a7d8

85-89: Remove commented S3-related environment variables.

Since we're transitioning to GitHub Actions cache, the commented S3-related environment variables should be removed rather than left in the file.

        env:
          CARGO_BUILD_PROFILE: release
          RUSTC_WRAPPER: sccache
          SCCACHE_GHA_ENABLED: true
-#          SCCACHE_BUCKET: multi-runner-cache-x1xibo9c
-#          SCCACHE_REGION: ${{ secrets.AWS_REGION }}
-#          SCCACHE_S3_KEY_PREFIX: ${{ runner.os }}/sccache/wasm/wasm32

145-155: Consider using a more robust archive creation approach.

The artifact handling looks good overall, but the archive creation could be improved to handle potential errors with empty input.

-        run: xargs -a artifacts_list.txt tar cvf js-build-${{ github.sha }}.tar
+        run: |
+          if [ -s artifacts_list.txt ]; then
+            xargs -a artifacts_list.txt tar cvf js-build-${{ github.sha }}.tar
+          else
+            echo "No files to archive"
+            exit 1
+          fi

Line range hint 1-324: Well-structured transition from S3 to GitHub Actions cache.

The migration from S3 to GitHub Actions cache has been implemented effectively. The workflow maintains proper separation of concerns and handles artifacts appropriately. The integration with sccache is well done, providing efficient caching for Rust builds.

A few architectural considerations:

  1. The workflow properly handles concurrent runs with the concurrency group
  2. The conditional execution based on artifact existence prevents unnecessary rebuilds
  3. The error handling is robust across all steps

Consider implementing a cleanup job to remove artifacts after they're no longer needed, as GitHub Actions has storage limits. This could be triggered by workflow_run events.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 98232ef and 9c79aec.

📒 Files selected for processing (7)
  • .github/actions/local-network/action.yaml (3 hunks)
  • .github/workflows/release.yml (3 hunks)
  • .github/workflows/tests-build-js.yml (2 hunks)
  • .github/workflows/tests-codeql.yml (1 hunks)
  • .github/workflows/tests-dashmate.yml (2 hunks)
  • .github/workflows/tests-js-package.yml (2 hunks)
  • .github/workflows/tests.yml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • .github/actions/local-network/action.yaml
  • .github/workflows/tests-codeql.yml
  • .github/workflows/tests-js-package.yml
  • .github/workflows/tests.yml
🧰 Additional context used
🪛 actionlint
.github/workflows/tests-build-js.yml

84-84: shellcheck reported issue in this script: SC2086:info:2:24: Double quote to prevent globbing and word splitting

(shellcheck)

🔇 Additional comments (6)
.github/workflows/tests-build-js.yml (3)

25-25: LGTM: Consistent conditional execution pattern

The conditional steps are well-structured and follow a consistent pattern for skipping redundant builds.

Also applies to: 32-32, 36-36, 42-42


44-50: Reiterating previous review: Improve error handling

Referring to the previous review comment about improving error handling in sccache configuration.


64-67: Reiterating previous review: Remove S3 configuration

Referring to the previous review comment about removing commented S3 configuration.

.github/workflows/tests-dashmate.yml (1)

44-47: LGTM: Artifact download step correctly updated

The transition to actions/download-artifact@v4 is appropriate and follows best practices with proper artifact naming using commit SHA.

.github/workflows/release.yml (2)

64-70: LGTM! Proper configuration of sccache with GitHub Actions cache.

The configuration correctly exports the necessary environment variables for GitHub Actions cache integration.


249-252: LGTM! Proper artifact download configuration.

The artifact download step is correctly configured and consistent with the upload step.

.github/workflows/tests-build-js.yml Outdated Show resolved Hide resolved
.github/workflows/tests-dashmate.yml Outdated Show resolved Hide resolved
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

🧹 Outside diff range and nitpick comments (3)
.github/workflows/tests-build-js.yml (3)

16-19: Consider using official GitHub Actions for artifact handling

Instead of using a third-party action for checking artifact existence, consider using the official actions/download-artifact@v4 which has built-in support for checking artifact existence through its outputs.

-      - uses: softwareforgood/check-artifact-v4-existence@v0
-        id: check-artifact
-        with:
-          name: js-build-${{ github.sha }}
+      - uses: actions/download-artifact@v4
+        id: check-artifact
+        with:
+          name: js-build-${{ github.sha }}
+          path: .
+        continue-on-error: true

89-96: Review artifact retention and error handling strategy

The current implementation has two potential issues:

  1. The 1-day retention period might be too short if the artifacts are needed for downstream workflows or debugging
  2. The error handling could be improved by adding explicit conditions

Consider these improvements:

       - name: Upload the archive of built files
         uses: actions/upload-artifact@v4
         with:
           name: js-build-${{ github.sha }}
           path: ${{ steps.diff.outputs.files }}
-          retention-days: 1
+          retention-days: 7
           if-no-files-found: error
-        if: ${{ steps.check-artifact.outputs.exists != 'true' }}
+        if: ${{ steps.check-artifact.outputs.exists != 'true' && steps.diff.outputs.files != '' }}

Line range hint 25-96: Optimize workflow structure to reduce redundancy

The workflow has multiple steps with the same condition if: ${{ steps.check-artifact.outputs.exists != 'true' }}. This could be simplified by moving the condition to the job level or using a composite action.

Consider either:

  1. Using job-level conditions:
jobs:
  build-js:
    name: Build JS
    runs-on: ubuntu-24.04
    steps:
      - name: Check artifact
        id: check-artifact
        uses: actions/download-artifact@v4
        with:
          name: js-build-${{ github.sha }}
          path: .
        continue-on-error: true

  build-js-if-needed:
    name: Build JS if needed
    needs: build-js
    if: needs.build-js.outputs.exists != 'true'
    runs-on: ubuntu-24.04
    steps:
      # All build steps without individual conditions
  1. Or creating a composite action to encapsulate the build logic
🧰 Tools
🪛 actionlint

71-71: shellcheck reported issue in this script: SC2129:style:2:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects

(shellcheck)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9c79aec and a12d16d.

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

84-84: shellcheck reported issue in this script: SC2086:info:2:24: Double quote to prevent globbing and word splitting

(shellcheck)

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

🧹 Outside diff range and nitpick comments (3)
.github/workflows/tests-build-js.yml (3)

90-97: Enhance artifact upload reliability

The current implementation relies on git command output for determining paths, which could miss important files or include unnecessary ones.

Consider using explicit path patterns for better control:

- uses: actions/upload-artifact@v4
  with:
    name: js-build
    path: |
      packages/**/dist/**
      packages/**/build/**
      !**/*.test.*
    retention-days: 1
    if-no-files-found: error

Line range hint 8-13: Remove unnecessary AWS configuration

Since we're transitioning from S3 to GitHub Actions cache, the AWS credentials configuration step is no longer needed.

Remove the entire Configure AWS credentials and bucket region step as it's not required for GitHub Actions cache.

🧰 Tools
🪛 actionlint

71-71: shellcheck reported issue in this script: SC2129:style:2:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects

(shellcheck)


Line range hint 25-88: Simplify workflow by moving conditions to job level

Multiple steps have the same condition if: ${{ steps.check-artifact.outputs.exists != 'true' }}. This creates unnecessary repetition and makes the workflow harder to maintain.

Consider restructuring the workflow to use job-level conditions:

jobs:
  build-js:
    name: Build JS
    runs-on: ubuntu-24.04
    steps:
      - uses: softwareforgood/check-artifact-v4-existence@v0
        id: check-artifact
        with:
          name: js-build

      - name: Build JS
        if: ${{ steps.check-artifact.outputs.exists != 'true' }}
        steps:
          # Move all build steps here without individual conditions
🧰 Tools
🪛 actionlint

71-71: shellcheck reported issue in this script: SC2129:style:2:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects

(shellcheck)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between a12d16d and 30111be.

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

84-84: shellcheck reported issue in this script: SC2129:style:1:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects

(shellcheck)


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

(shellcheck)


84-84: shellcheck reported issue in this script: SC2086:info:2:45: Double quote to prevent globbing and word splitting

(shellcheck)


84-84: shellcheck reported issue in this script: SC2086:info:3:15: Double quote to prevent globbing and word splitting

(shellcheck)

.github/workflows/tests-build-js.yml Show resolved Hide resolved
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

🧹 Outside diff range and nitpick comments (4)
.github/workflows/tests-build-js.yml (2)

90-98: Consider optimizing artifact upload configuration

While the implementation is functional, consider these improvements:

  1. Use a more maintainable naming scheme without SHA to prevent artifact proliferation
  2. Review if 1-day retention is sufficient for your CI/CD needs
  3. Consider using explicit path patterns instead of dynamic output from git command
 - name: Upload the archive of built files
   uses: actions/upload-artifact@v4
   with:
-    name: js-build-${{ github.sha }}
-    path: ${{ steps.diff.outputs.files }}
+    name: js-build
+    path: |
+      **/*
+      !.yarn/**
+      !target/**
+      !node_modules/**
+      !.nyc_output/**
+      !.idea/**
+      !.ultra.exists.json
+      !db/**
     retention-days: 1
     if-no-files-found: error
     include-hidden-files: true

Line range hint 1-98: Overall implementation successfully transitions to GitHub Actions cache

The workflow successfully moves away from S3 to GitHub Actions cache, aligning with the PR objectives. While the implementation is functional, consider addressing the existing review comments to:

  1. Use official GitHub Actions instead of third-party actions
  2. Improve error handling in sccache configuration
  3. Remove commented S3 configuration
  4. Simplify the artifact upload process
  5. Improve shell script reliability
  6. Optimize artifact naming and retention strategy
🧰 Tools
🪛 actionlint

71-71: shellcheck reported issue in this script: SC2129:style:2:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects

(shellcheck)

.github/workflows/release.yml (2)

64-89: Remove commented out S3 configuration

The switch to GitHub Actions cache is implemented correctly. However, the commented-out S3 configuration should be removed since it's no longer needed:

-#          SCCACHE_BUCKET: multi-runner-cache-x1xibo9c
-#          SCCACHE_REGION: ${{ secrets.AWS_REGION }}
-#          SCCACHE_S3_KEY_PREFIX: ${{ runner.os }}/sccache/wasm/wasm32

137-155: Consider optimizing artifact handling

The artifact creation and upload implementation is functional but could be improved:

  1. The two-step process could be simplified:
-      - name: Get modified files
-        id: diff
-        run: git ls-files --others --exclude-standard >> artifacts_list.txt
-
-      - name: Create an archive of built files
-        run: xargs -a artifacts_list.txt tar cvf js-build-${{ github.sha }}.tar
+      - name: Create archive of built files
+        run: git ls-files --others --exclude-standard | tar -cvf js-build-${{ github.sha }}.tar -T -
  1. Consider increasing the retention-days from 1 to match your release cycle length to ensure artifacts are available for potential rollbacks or debugging.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 30111be and 8aa56d9.

📒 Files selected for processing (6)
  • .github/actions/local-network/action.yaml (3 hunks)
  • .github/workflows/release.yml (3 hunks)
  • .github/workflows/tests-build-js.yml (2 hunks)
  • .github/workflows/tests-codeql.yml (1 hunks)
  • .github/workflows/tests-dashmate.yml (2 hunks)
  • .github/workflows/tests-js-package.yml (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • .github/actions/local-network/action.yaml
  • .github/workflows/tests-codeql.yml
  • .github/workflows/tests-dashmate.yml
  • .github/workflows/tests-js-package.yml
🧰 Additional context used
🪛 actionlint
.github/workflows/tests-build-js.yml

84-84: shellcheck reported issue in this script: SC2129:style:1:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects

(shellcheck)


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

(shellcheck)


84-84: shellcheck reported issue in this script: SC2086:info:2:45: Double quote to prevent globbing and word splitting

(shellcheck)


84-84: shellcheck reported issue in this script: SC2086:info:3:15: Double quote to prevent globbing and word splitting

(shellcheck)

🔇 Additional comments (3)
.github/workflows/tests-build-js.yml (1)

25-25: LGTM: Consistent conditional execution implementation

The conditional checks using if: ${{ steps.check-artifact.outputs.exists != 'true' }} are correctly implemented across all steps, ensuring efficient workflow execution by skipping unnecessary steps when artifacts exist.

Also applies to: 32-32, 36-36, 42-42

.github/workflows/release.yml (2)

43-46: LGTM: Efficient artifact existence checking implementation

Good optimization to avoid unnecessary rebuilds by checking for existing artifacts first.


249-253: LGTM: Clean artifact download implementation

The switch to actions/download-artifact@v4 is implemented correctly with proper path configuration.

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

🧹 Outside diff range and nitpick comments (4)
.github/workflows/tests-build-js.yml (1)

Line range hint 8-14: Remove unnecessary AWS credentials configuration

Since the workflow has been migrated to use GitHub Actions cache instead of S3, the AWS credentials configuration step is no longer needed and should be removed.

- - name: Configure AWS credentials and bucket region
-   uses: aws-actions/configure-aws-credentials@v4
-   with:
-     aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
-     aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
-     aws-region: ${{ secrets.AWS_REGION }}
🧰 Tools
🪛 actionlint

62-62: expecting a single ${{...}} expression or mapping value for "env" section, but found plain text node

(syntax-check)


70-70: shellcheck reported issue in this script: SC2129:style:2:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects

(shellcheck)

.github/actions/docker/action.yaml (1)

Line range hint 21-35: Remove unused S3-related inputs

Since we're switching from S3 to GitHub Actions cache, the following inputs should be removed as they're no longer used:

  • bucket
  • region
  • aws_access_key_id
  • aws_secret_access_key
packages/rs-drive-abci/src/metrics.rs (1)

Line range hint 249-251: Document timestamp overflow behavior

While the implementation is correct, consider adding documentation about timestamp overflow behavior for future maintainers.

Add the following documentation:

 /// Set time of last block into [COUNTER_LAST_BLOCK_TIME].
+///
+/// # Arguments
+///
+/// * `time` - Unix timestamp in seconds since epoch. Note that this value wraps around in 2038
+///   for 32-bit systems or in ~292 billion years for 64-bit systems.
 pub fn abci_last_block_time(time: u64) {
     counter!(COUNTER_LAST_BLOCK_TIME).absolute(time);
 }
.github/workflows/tests-rs-package.yml (1)

40-45: Consider creating a reusable action for sccache configuration

The sccache configuration step is duplicated across multiple jobs. Consider creating a reusable composite action to reduce duplication and simplify maintenance.

Create a new composite action at .github/actions/configure-sccache/action.yml:

name: 'Configure sccache'
description: 'Configures sccache for GitHub Actions cache'
runs:
  using: "composite"
  steps:
    - uses: actions/github-script@v7
      with:
        script: |
          core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
          core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');

Then replace the duplicated configuration with:

      - name: Configure sccache
        uses: ./.github/actions/configure-sccache

Also applies to: 75-80, 120-125, 223-228, 270-275

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 8aa56d9 and 71bddba.

📒 Files selected for processing (5)
  • .github/actions/docker/action.yaml (2 hunks)
  • .github/workflows/release.yml (3 hunks)
  • .github/workflows/tests-build-js.yml (2 hunks)
  • .github/workflows/tests-rs-package.yml (7 hunks)
  • packages/rs-drive-abci/src/metrics.rs (1 hunks)
🧰 Additional context used
🪛 actionlint
.github/workflows/tests-build-js.yml

62-62: expecting a single ${{...}} expression or mapping value for "env" section, but found plain text node

(syntax-check)


83-83: shellcheck reported issue in this script: SC2129:style:1:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects

(shellcheck)


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

(shellcheck)


83-83: shellcheck reported issue in this script: SC2086:info:2:45: Double quote to prevent globbing and word splitting

(shellcheck)


83-83: shellcheck reported issue in this script: SC2086:info:3:15: Double quote to prevent globbing and word splitting

(shellcheck)

.github/workflows/tests-rs-package.yml

83-83: expecting a single ${{...}} expression or mapping value for "env" section, but found plain text node

(syntax-check)

🔇 Additional comments (10)
.github/actions/docker/action.yaml (2)

89-120: Well-implemented caching strategy!

The new caching implementation:

  • Uses the latest actions/cache@v4
  • Has proper cache key construction using lock files
  • Implements efficient cache restoration with fallback keys
  • Correctly injects caches into Docker builds

Also applies to: 121-147


171-172: Verify registry cache configuration

The registry cache configuration looks correct, but let's verify that:

  1. The build-cache tag is not conflicting with any existing tags
  2. The registry has sufficient storage for the cache
✅ Verification successful

Registry cache configuration is correctly implemented

The registry cache configuration is properly set up:

  1. The build-cache tag is dedicated for caching and won't conflict with other tags as it's specifically used in the docker/build-push-action cache configuration
  2. The cache mode is set to max which is appropriate for build caching
  3. The registry cache replaces the commented out S3-based caching, which is a valid and common approach for Docker layer caching
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if build-cache tag exists and when it was last updated
gh api \
  -H "Accept: application/vnd.docker.distribution.manifest.v2+json" \
  "/v2/repositories/${{ inputs.image_org }}/${{ inputs.image_name }}/tags" | \
  jq '.[] | select(.name=="build-cache")'

Length of output: 178


Script:

#!/bin/bash
# Let's check the workflow files to understand the image organization and name patterns
fd -e yaml -e yml . .github/workflows/ -x cat {}

Length of output: 58765


Script:

#!/bin/bash
# Let's check the Docker build configuration files to understand the cache usage
fd -e yaml -e yml . .github/actions/docker/ -x cat {}

Length of output: 6423

.github/workflows/release.yml (4)

64-70: LGTM! Clean sccache configuration setup

The implementation correctly exports the required GitHub Actions cache variables and includes proper conditional execution.


136-154: LGTM! Well-implemented artifact handling

The implementation follows best practices with proper error handling, retention settings, and conditional execution.


Line range hint 1-324: Verify complete transition from S3 to GitHub Actions cache

Let's ensure all S3 references have been properly replaced with GitHub Actions cache equivalents.

#!/bin/bash
# Check for any remaining S3 references in workflow files
rg -i 's3|aws' .github/workflows/

43-46: Verify the reliability of the third-party action

The softwareforgood/check-artifact-v4-existence@v0 action is relatively new. Consider using the official actions/cache with cache key existence check instead for better long-term maintainability.

packages/rs-drive-abci/src/metrics.rs (2)

14-14: LGTM: Well-documented constant for block time tracking

The new constant follows the established naming convention and is appropriately documented.


Line range hint 182-187: LGTM: Proper metric registration with correct units

The block time metric is properly registered with:

  • Appropriate unit specification (metrics::Unit::Seconds)
  • Clear description
  • Thread-safe initialization
.github/workflows/tests-rs-package.yml (2)

Line range hint 1-11: LGTM: Simplified workflow inputs

The removal of dynamic runner inputs in favor of a standardized runner simplifies the workflow configuration.


16-16: LGTM: Standardized runner environment

The consistent use of ubuntu-24.04 across all jobs ensures a uniform build environment and simplifies workflow maintenance.

Also applies to: 204-204, 244-244

.github/workflows/release.yml Show resolved Hide resolved
.github/workflows/release.yml Outdated Show resolved Hide resolved
.github/workflows/tests-rs-package.yml Outdated Show resolved Hide resolved
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: 1

🧹 Outside diff range and nitpick comments (1)
.github/workflows/tests-build-js.yml (1)

Line range hint 8-14: Remove AWS credentials configuration

Since we're transitioning from S3 to GitHub Actions cache, the AWS credentials configuration step is no longer needed and should be removed.

-      - name: Configure AWS credentials and bucket region
-        uses: aws-actions/configure-aws-credentials@v4
-        with:
-          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
-          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
-          aws-region: ${{ secrets.AWS_REGION }}
🧰 Tools
🪛 actionlint

70-70: shellcheck reported issue in this script: SC2129:style:2:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects

(shellcheck)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 71bddba and 84852e4.

📒 Files selected for processing (2)
  • .github/workflows/tests-build-js.yml (2 hunks)
  • .github/workflows/tests-rs-package.yml (7 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/tests-rs-package.yml
🧰 Additional context used
🪛 actionlint
.github/workflows/tests-build-js.yml

83-83: shellcheck reported issue in this script: SC2129:style:1:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects

(shellcheck)


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

(shellcheck)


83-83: shellcheck reported issue in this script: SC2086:info:2:45: Double quote to prevent globbing and word splitting

(shellcheck)


83-83: shellcheck reported issue in this script: SC2086:info:3:15: Double quote to prevent globbing and word splitting

(shellcheck)

.github/workflows/tests-build-js.yml Outdated Show resolved Hide resolved
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

🧹 Outside diff range and nitpick comments (1)
packages/rs-drive-abci/src/metrics.rs (1)

Line range hint 266-268: Add documentation comments for consistency.

The function implementation is correct, but it lacks documentation comments. Consider adding documentation similar to other functions in the file.

Add documentation following the established pattern:

+/// Sets the time of the last block in seconds since epoch.
+///
+/// # Examples
+///
+/// ```
+/// use drive_abci::metrics::abci_last_block_time;
+///
+/// let time = 1699564800; // November 10, 2023 00:00:00 UTC
+/// abci_last_block_time(time);
+/// ```
 pub fn abci_last_block_time(time: u64) {
     counter!(COUNTER_LAST_BLOCK_TIME).absolute(time);
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 8aa56d9 and 5eab16c.

📒 Files selected for processing (1)
  • packages/rs-drive-abci/src/metrics.rs (1 hunks)
🔇 Additional comments (3)
packages/rs-drive-abci/src/metrics.rs (3)

14-14: LGTM: Well-documented metric constant.

The constant follows proper naming conventions and includes clear documentation.


Line range hint 173-177: LGTM: Proper metric registration with unit specification.

The metric is correctly registered with appropriate description and unit specification, ensuring consistent initialization through the Once guard.


Line range hint 1-268: Verify the relationship with PR objectives.

While the changes to add block time metrics are well-implemented, they seem unrelated to the PR's stated objective of switching from S3 to GitHub Action cache. Please clarify if these changes are necessary for the cache migration or if they should be in a separate PR.

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

🧹 Outside diff range and nitpick comments (5)
.github/actions/s3-layer-cache-settings/action.yaml (1)

Line range hint 41-57: Consider improving documentation for manifest naming strategy

While the implementation is solid, the relationship between the three manifest names and their specific purposes could be better documented:

  1. name_sha_[commit] - For builds of specific commit
  2. name_tag_[branch] - For builds of specific branch
  3. name - For all builds

Add this documentation to the action description:

 description: |
   This action generates string with s3-based cache configuration for docker buildx.
   It defines three manifests:
-    - name and current commit to hit all builds for this commit (restart) with this name
-    - name and head ref to hit all builds for this branch with this name
-    - just name to hit all builds for this name
+    - [name]_sha_[commit]: Caches specific to the current commit (useful for build restarts)
+    - [name]_tag_[branch]: Caches shared across all builds in a branch
+    - [name]: Global fallback cache for all builds with this name
.github/workflows/tests-build-js.yml (2)

Line range hint 8-14: Remove AWS configuration as part of S3 to GitHub Actions cache migration

Since we're transitioning from S3 to GitHub Actions cache, the AWS credentials configuration step and S3-related environment variables should be removed:

-      - name: Configure AWS credentials and bucket region
-        uses: aws-actions/configure-aws-credentials@v4
-        with:
-          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
-          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
-          aws-region: ${{ secrets.AWS_REGION }}

       - name: Build JS packages
         run: yarn build
         env:
           RUSTC_WRAPPER: sccache
-          SCCACHE_BUCKET: multi-runner-cache-x1xibo9c
-          SCCACHE_REGION: ${{ secrets.AWS_REGION }}
-          SCCACHE_S3_KEY_PREFIX: ${{ runner.os }}/sccache/wasm/wasm32

Also applies to: 54-58

🧰 Tools
🪛 actionlint

62-62: shellcheck reported issue in this script: SC2129:style:2:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects

(shellcheck)


25-25: Optimize workflow by using job-level conditions

The condition if: ${{ steps.check-artifact.outputs.exists != 'true' }} is repeated across multiple steps. Consider using a job-level condition to improve maintainability:

jobs:
  build-js:
    name: Build JS
    runs-on: ubuntu-24.04
    steps:
      - uses: softwareforgood/check-artifact-v4-existence@v0
        id: check-artifact
        with:
          name: js-build-${{ github.sha }}

  build-and-upload:
    name: Build and Upload JS
    needs: build-js
    if: ${{ needs.build-js.outputs.exists != 'true' }}
    runs-on: ubuntu-24.04
    steps:
      # Move all steps with the condition here
      # Remove individual conditions

Also applies to: 32-32, 36-36, 42-42, 46-46, 50-50, 59-59, 71-71, 79-79, 89-89

.github/actions/docker/action.yaml (2)

119-127: Well-structured Yarn caching with platform awareness

The Yarn cache implementation correctly handles platform-specific caching, which is crucial for cross-platform builds.

Consider adding a comment explaining why unplugged cache is specifically needed, as it's a less common Yarn feature.


87-146: Well-architected caching strategy

The implementation of GitHub Actions cache for both Cargo and Yarn dependencies is well-architected with:

  • Proper separation of concerns between caching and injection
  • Platform-aware caching strategy
  • Efficient cache key management
  • Proper integration with BuildKit

This provides a solid foundation for the transition from S3 to GitHub Actions cache.

Consider documenting the caching strategy in the repository's documentation to help other contributors understand the caching mechanism and its configuration.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 3321e15 and 163323c.

📒 Files selected for processing (5)
  • .github/actions/docker/action.yaml (2 hunks)
  • .github/actions/s3-layer-cache-settings/action.yaml (1 hunks)
  • .github/workflows/release.yml (4 hunks)
  • .github/workflows/tests-build-js.yml (2 hunks)
  • .github/workflows/tests-rs-package.yml (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/tests-rs-package.yml
🧰 Additional context used
🪛 actionlint
.github/workflows/release.yml

132-132: shellcheck reported issue in this script: SC2129:style:1:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects

(shellcheck)


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

(shellcheck)


132-132: shellcheck reported issue in this script: SC2086:info:2:45: Double quote to prevent globbing and word splitting

(shellcheck)


132-132: shellcheck reported issue in this script: SC2086:info:3:15: Double quote to prevent globbing and word splitting

(shellcheck)

.github/workflows/tests-build-js.yml

75-75: shellcheck reported issue in this script: SC2129:style:1:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects

(shellcheck)


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

(shellcheck)


75-75: shellcheck reported issue in this script: SC2086:info:2:45: Double quote to prevent globbing and word splitting

(shellcheck)


75-75: shellcheck reported issue in this script: SC2086:info:3:15: Double quote to prevent globbing and word splitting

(shellcheck)

🔇 Additional comments (9)
.github/actions/docker/action.yaml (6)

83-98: Well-structured Cargo caching implementation

The Cargo cache configuration is well-implemented with:

  • Proper cache key strategy using Cargo.lock
  • Appropriate restore-keys fallback
  • Well-organized cache paths for registry and git data

99-118: Well-implemented cache injection mechanism

The cache injection using buildkit-cache-dance is properly configured with:

  • Correct mapping of cache directories to Docker paths
  • Proper cache hit detection to skip extraction when possible

128-134: Clean architecture extraction implementation

The architecture extraction is implemented efficiently using GitHub Script.


135-146: Well-implemented Yarn cache injection

The Yarn cache injection follows the same robust pattern as the Cargo cache injection, with proper platform-specific cache IDs.


160-166: Remove commented S3-related configurations

As mentioned in a previous review, please remove all commented-out code related to S3 caching (sccache and registry cache configurations). This code can be retrieved from git history if needed in the future.

Also applies to: 169-170


62-64: Verify implications of disabled BuildKit garbage collection

Disabling garbage collection (gc = false) in the BuildKit configuration could lead to increased disk usage over time. While this might be intentional for caching purposes, please ensure that:

  1. The runner has sufficient disk space
  2. There's a cleanup mechanism in place for old cache data
✅ Verification successful

BuildKit garbage collection configuration is safe to disable

The disabled garbage collection in BuildKit is safe because:

  1. The action uses GitHub's actions/cache@v4 for both Cargo and Yarn caches, which has built-in cache management and size limits
  2. BuildKit's cache is scoped to individual workflow runs as the runner is ephemeral
  3. The docker/setup-buildx-action@v3 has cleanup: false which is consistent with the gc setting for maintaining cache during the build

The configuration aligns with the PR's objective of optimizing caching strategy and doesn't pose disk space risks since GitHub Actions runners are ephemeral.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if there are any cleanup jobs or disk space monitoring in the workflows
rg -l 'actions/github-runner-management|disk|cleanup|prune' .github/workflows/

Length of output: 80


Script:

#!/bin/bash
# Let's check for any GitHub Actions workflow that handles cache cleanup or maintenance
rg -i "cache.*cleanup|cleanup.*cache|cache.*prune|prune.*cache" .github/workflows/

# Also check if there are any cache expiration or size limit configurations
rg -i "max.*(size|age)|cache.*(size|age)|expir.*cache" .github/workflows/

# Check the Docker build action itself for any cache-related configurations
cat .github/actions/docker/action.yaml

Length of output: 6372

.github/workflows/release.yml (3)

43-46: LGTM: Proper artifact existence check implementation

The artifact check is correctly implemented using the GitHub Actions artifact API, which is more efficient than downloading artifacts to check existence.


Line range hint 53-80: LGTM: Proper conditional execution of build steps

The build steps are correctly conditioned on artifact existence, preventing unnecessary rebuilds when artifacts are available.


138-146: LGTM: Comprehensive artifact upload configuration

The artifact upload step is well-configured with:

  • Proper error handling (if-no-files-found: error)
  • Hidden files inclusion
  • Reasonable retention period
  • Conditional execution

.github/workflows/tests-build-js.yml Show resolved Hide resolved
.github/workflows/release.yml Show resolved Hide resolved
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: 2

🧹 Outside diff range and nitpick comments (2)
Dockerfile (2)

315-319: Enhance build profile configuration handling

The build profile configuration is well-implemented, but the configuration file handling could be more robust.

Consider this improvement:

-        mv .cargo/config-release.toml .cargo/config.toml; \
+        cp .cargo/config-release.toml .cargo/config.toml; \

This change:

  1. Preserves the original file
  2. Prevents potential issues if the build needs to be re-run with a different profile
  3. Makes the build process more idempotent

Also applies to: 338-355


354-355: Optimize target directory cleanup

While cleaning up the target directory helps reduce image size, the current implementation could be optimized.

Consider these improvements:

-    rm -rf target && \
+    if [ "${CI:-false}" = "true" ]; then
+        rm -rf target
+    fi && \

Benefits:

  1. Preserves the target directory for local development
  2. Only cleans up in CI environment where space is critical
  3. Improves build cache utilization in local development

Also applies to: 394-395

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 163323c and 9cdea04.

📒 Files selected for processing (3)
  • .github/actions/docker/action.yaml (3 hunks)
  • .github/actions/s3-layer-cache-settings/action.yaml (2 hunks)
  • Dockerfile (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/actions/s3-layer-cache-settings/action.yaml
🔇 Additional comments (4)
.github/actions/docker/action.yaml (3)

83-86: LGTM: Environment setup is correct

Setting the HOME variable in GITHUB_ENV is the proper way to ensure consistent path references for caching.


Line range hint 149-171: LGTM: Docker build configuration is well structured

The build configuration properly integrates sccache with appropriate AWS credentials and bucket configuration. The cache-from and cache-to settings are correctly configured to work with the GitHub Actions cache.


62-64: Verify implications of disabled garbage collection

Disabling garbage collection (gc = false) in the buildkitd configuration could lead to increased disk usage over time. While this might be intentional for caching purposes, it's important to ensure there's a cleanup strategy in place.

✅ Verification successful

Disabled garbage collection is acceptable with current cache management

The disabled garbage collection (gc = false) is not a concern because:

  • GitHub Actions has built-in cache management with 1-day retention policy for artifacts
  • The Docker build context is ephemeral within each workflow run
  • The buildkitd configuration is specific to the build step and doesn't persist between runs
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if there are any other cleanup mechanisms in place
rg -i "cleanup|prune|gc" .github/actions/

Length of output: 159


Script:

#!/bin/bash
# Check for cache cleanup configurations in GitHub Actions workflows
rg -i "actions/cache|cache-hit|post-cache|cache-cleanup" .github/workflows/

Length of output: 451


Script:

#!/bin/bash
# Check for any cache size limits or retention policies
rg -i "max-size|retention|days|cache-limit" .github/workflows/ .github/actions/

Length of output: 275


Script:

#!/bin/bash
# Look for GitHub Actions cache documentation or comments
rg -i "cache.*note|cache.*comment|cache.*doc" .github/workflows/ .github/actions/

Length of output: 960

Dockerfile (1)

184-184: Verify if S3 SSL configuration is still needed

The S3 SSL configuration is commented out. If S3 is still used as a fallback, this could potentially lead to insecure connections.

✅ Verification successful

S3 SSL configuration can be safely removed

The commented out SCCACHE_S3_USE_SSL line is part of a conditional block that only executes when using S3 cache. The codebase now primarily uses GitHub Actions cache, with S3 as an optional fallback. When S3 is used, SSL is enabled by default in recent versions of sccache, making this configuration redundant.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if S3 is still used anywhere in the codebase
rg -l 'SCCACHE_(BUCKET|S3)' --type yaml

Length of output: 315


Script:

#!/bin/bash
# Check the content of these files for S3 configuration
rg 'SCCACHE_(BUCKET|S3)' --type yaml -A 3 -B 3

Length of output: 4514


Script:

#!/bin/bash
# Check if there's a conditional setup for S3/GHA cache in the Dockerfile
rg 'SCCACHE_GHA_ENABLED|SCCACHE_BUCKET' Dockerfile -A 5 -B 5

Length of output: 2755

.github/actions/docker/action.yaml Outdated Show resolved Hide resolved
.github/actions/docker/action.yaml Outdated Show resolved Hide resolved
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

🧹 Outside diff range and nitpick comments (1)
.github/actions/s3-layer-cache-settings/action.yaml (1)

49-49: TODO comment indicates incomplete implementation

The TODO comment suggests that the generic manifest should only be used on the default branch. However, since we're transitioning to GitHub Actions cache, implementing this feature would be unnecessary work.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9cdea04 and 7aa6617.

📒 Files selected for processing (2)
  • .github/actions/s3-layer-cache-settings/action.yaml (2 hunks)
  • packages/rs-drive-abci/src/lib.rs (1 hunks)
🔇 Additional comments (4)
packages/rs-drive-abci/src/lib.rs (2)

33-34: LGTM! Clean addition of the metrics module.

The new metrics module is well-documented and properly placed in the module hierarchy.


33-34: Verify metrics module initialization and integration.

Please ensure that the metrics module is properly initialized and integrated with the application's metrics collection system.

Also applies to: 36-38

✅ Verification successful

Metrics module is properly implemented and integrated

The metrics module is well-structured and correctly integrated:

  • Prometheus server is properly initialized with configurable listen address
  • All metrics are registered using describe_* functions during initialization
  • Comprehensive set of metrics covering key areas:
    • ABCI request durations
    • Block heights and times
    • Query durations
    • State transition processing
    • Withdrawal limits
  • Metrics are actively used throughout the codebase with proper labeling and timing measurements
  • Implementation includes proper error handling and thread-safe initialization

The metrics subsystem is production-ready and no issues were found.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for metrics initialization and usage across the codebase

# Look for metrics initialization
ast-grep --pattern 'fn main() {
  $$$
  metrics::$_($$$)
  $$$
}'

# Check for metrics usage patterns
rg -A 3 "use.*metrics::" 

# Look for test coverage of metrics
rg -A 5 "#\[test\].*metrics" 

Length of output: 7171


Script:

#!/bin/bash
# Let's check the metrics module implementation and initialization

# Check the metrics module implementation
cat packages/rs-drive-abci/src/metrics.rs

# Check where Prometheus is initialized in main
rg -A 10 "Prometheus::new" 

# Check for metric registration and descriptions
rg "describe_(counter|gauge|histogram)"

# Look for actual metric usage
rg "(counter!|gauge!|histogram!)"

Length of output: 15308

.github/actions/s3-layer-cache-settings/action.yaml (2)

18-21: Remove this action as it's obsolete

Making S3 parameters required contradicts the PR objective of transitioning from S3 to GitHub Actions cache. Based on the PR objectives and past reviews, this entire action should be removed as it's no longer in use.


64-69: Code improvements are good but unnecessary

While the changes improve the code structure with better manifest handling and cleaner cache configuration generation, investing in S3 caching improvements contradicts the goal of migrating to GitHub Actions cache.

Let's verify if there are any remaining S3 cache dependencies:

@shumkov shumkov changed the title ci: switch from s3 to github action cache ci: enable caching Nov 15, 2024
@shumkov shumkov changed the title ci: enable caching ci: improve caching Nov 15, 2024
@shumkov shumkov added this to the v1.6.0 milestone Nov 15, 2024
.github/actions/docker/action.yaml Show resolved Hide resolved
.github/actions/s3-layer-cache-settings/action.yaml Outdated Show resolved Hide resolved
.github/workflows/tests.yml Show resolved Hide resolved
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

🧹 Outside diff range and nitpick comments (4)
.github/workflows/tests-build-image.yml (1)

51-51: Consider improving the cache condition readability.

Good practice using conditional caching based on event type. However, the condition could be more readable and type-safe.

Consider this alternative:

-          cache_to_name: ${{ github.event_name == 'push' && 'true' || 'false' }}
+          cache_to_name: ${{ github.event_name == 'push' }}

This change:

  1. Returns a proper boolean instead of string 'true'/'false'
  2. Is more concise and easier to understand
  3. Maintains the same functionality of only caching on push events
.github/actions/s3-layer-cache-settings/action.yaml (2)

59-85: Well-structured implementation, but consider strategic direction

The cache manifest generation logic is well-implemented with good practices:

  • Proper sanitization of head ref
  • Clear separation of concerns between cache_from and cache_to
  • Conditional name manifest generation

However, if we're transitioning away from S3 caching as per PR objectives, we should focus on implementing similar functionality using GitHub Actions cache instead.

Would you like assistance in implementing this using GitHub Actions cache?

🧰 Tools
🪛 yamllint

[error] 80-80: trailing spaces

(trailing-spaces)


80-80: Remove trailing spaces

There are trailing spaces on line 80 that should be removed for consistency.

-          
+
🧰 Tools
🪛 yamllint

[error] 80-80: trailing spaces

(trailing-spaces)

.github/actions/docker/action.yaml (1)

91-122: LGTM: Well-implemented Cargo caching strategy

The Cargo caching implementation is robust, using proper cache keys and paths. The cache injection into Docker is handled securely using buildkit-cache-dance.

Consider adding a comment explaining the cache injection mechanism for future maintainers:

+ # Inject cargo cache into docker using buildkit-cache-dance
+ # This allows sharing the host's cargo cache with the container
  - name: Inject cargo cache into docker
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9869252 and cd35f65.

📒 Files selected for processing (3)
  • .github/actions/docker/action.yaml (3 hunks)
  • .github/actions/s3-layer-cache-settings/action.yaml (2 hunks)
  • .github/workflows/tests-build-image.yml (1 hunks)
🧰 Additional context used
🪛 yamllint
.github/actions/s3-layer-cache-settings/action.yaml

[error] 80-80: trailing spaces

(trailing-spaces)

🔇 Additional comments (7)
.github/actions/s3-layer-cache-settings/action.yaml (1)

18-21: Consider removing this action as part of S3 cache migration

I agree with the previous review comment. Based on the PR objectives of transitioning from S3 to GitHub Actions cache, this action should be removed as it's no longer in use. Making S3 configuration mandatory (region and bucket) contradicts the migration goal.

Also applies to: 28-30

.github/actions/docker/action.yaml (6)

40-42: LGTM: Well-documented cache control parameter

The new cache_to_name input parameter is properly documented and safely configured with a default value of 'false'.


83-86: LGTM: Proper S3 cache configuration

The S3 layer cache configuration is properly set up with the necessary parameters for region, bucket, and cache control.


87-90: LGTM: Proper environment setup

Setting HOME in GITHUB_ENV is necessary for the subsequent caching steps and is implemented correctly.


123-149: LGTM: Proper Yarn unplugged caching implementation

The Yarn unplugged caching is well-implemented with platform-specific cache keys and proper Docker injection.


Line range hint 153-173: LGTM with security verification needed

The Docker build configuration is well-structured with proper cache settings and build arguments.

Let's verify the security of the AWS credentials handling:

#!/bin/bash
# Check if AWS credentials are masked in logs
rg -A 5 "AWS_.*_KEY" .github/workflows/
rg -A 5 "secrets\.AWS_" .github/workflows/

65-68: Verify implications of disabled garbage collection

Disabling garbage collection (gc = false) for the OCI worker could potentially lead to increased disk usage over time.

Let's verify if this is documented in BuildKit:

✅ Verification successful

Let me try another search strategy to find information about BuildKit's garbage collection configuration.


Let me check the content of the Docker documentation file that mentions worker.oci configuration.


BuildKit GC disabled: Intentional for CI/CD caching

Based on the documentation, disabling garbage collection (gc = false) in the BuildKit configuration is intentional for CI/CD environments. This setting helps maintain build caches between workflow runs, which is crucial for:

  • Preserving Docker layer caches
  • Maintaining cache mounts for Rust dependencies and target directories
  • Optimizing build times in CI/CD pipelines

The documentation shows that for local development, GC should be enabled with appropriate size limits, but CI/CD environments often require persistent caches to speed up builds.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for documentation about gc configuration
rg -A 5 "gc.*=.*false" .
rg -A 5 "worker.oci" .

Length of output: 26385


Script:

#!/bin/bash
# Search for BuildKit configuration and gc settings
rg -i "buildkit.*gc" .
rg -i "worker.oci" .
rg -i "buildkitd.*config" .

Length of output: 146


Script:

#!/bin/bash
# Check Docker documentation for BuildKit GC configuration
cat ./docs/DOCKER.md

Length of output: 4771

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

🧹 Outside diff range and nitpick comments (1)
.github/actions/s3-layer-cache-settings/action.yaml (1)

80-80: Remove trailing whitespace

There's a trailing whitespace on this line.

-          
+
🧰 Tools
🪛 yamllint

[error] 80-80: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9869252 and 72539f4.

📒 Files selected for processing (3)
  • .github/actions/docker/action.yaml (3 hunks)
  • .github/actions/s3-layer-cache-settings/action.yaml (2 hunks)
  • .github/workflows/tests-build-image.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/actions/docker/action.yaml
🧰 Additional context used
🪛 yamllint
.github/actions/s3-layer-cache-settings/action.yaml

[error] 80-80: trailing spaces

(trailing-spaces)

🔇 Additional comments (2)
.github/actions/s3-layer-cache-settings/action.yaml (2)

18-30: Consider removing this action as it appears to be obsolete

Based on the PR objectives and recent commits, we're transitioning from S3 to GitHub Actions cache. This action appears to be obsolete as:

  1. No workflow files reference this action anymore
  2. Recent commits show removal of S3-based caching:
    • febf93eb build: remove target and s3 for layercache
    • 71bddbab ci: layer to registry, disable sccache

Line range hint 1-85: Verify if this action can be safely removed

Let's verify that this action is truly obsolete and can be safely removed.

🧰 Tools
🪛 yamllint

[error] 80-80: trailing spaces

(trailing-spaces)

.github/workflows/tests-build-image.yml Show resolved Hide resolved
.github/actions/s3-layer-cache-settings/action.yaml Outdated Show resolved Hide resolved
lklimek
lklimek previously approved these changes Nov 18, 2024
.github/actions/docker/action.yaml Show resolved Hide resolved
@shumkov shumkov merged commit ff2a831 into v1.6-dev Nov 18, 2024
117 of 119 checks passed
@shumkov shumkov deleted the ci/fix-docker-cache-mounts branch November 18, 2024 15:33
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