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

Update devcontainer image: v1.0.0-rc2 #2670

Closed
wants to merge 1 commit into from
Closed

Conversation

tarrencev
Copy link
Contributor

@tarrencev tarrencev commented Nov 10, 2024

Automated changes by create-pull-request GitHub action

Summary by CodeRabbit

  • New Features

    • Updated Docker image version to v1.0.0-rc2 across various workflows, enhancing the development and testing environments.
    • Added a new step in the CI workflow to create and upload a directory containing built binaries for easier access in subsequent jobs.
  • Bug Fixes

    • Ensured necessary binaries are available for testing by modifying the CI workflow.
  • Documentation

    • Updated workflow configurations to reflect the changes in Docker image versions.

Copy link

coderabbitai bot commented Nov 10, 2024

Walkthrough

Ohayo, sensei! This pull request updates the Docker image version across several configuration files used in the development and CI/CD environments. Specifically, the image version has been changed from v1.0.0-rc.1 to v1.0.0-rc2 in .devcontainer/devcontainer.json, .github/workflows/bench.yml, .github/workflows/ci.yml, and .github/workflows/release-dispatch.yml. Additionally, the CI configuration introduces a new step for managing built binaries, while the other workflows maintain their existing structures.

Changes

File Path Change Summary
.devcontainer/devcontainer.json Updated Docker image from v1.0.0-rc.1 to v1.0.0-rc2.
.github/workflows/bench.yml Updated Docker image for bench-katana and bench-sozo jobs from v1.0.0-rc.1 to v1.0.0-rc2.
.github/workflows/ci.yml Updated Docker image for multiple jobs from v1.0.0-rc.1 to v1.0.0-rc2; added steps for managing binaries.
.github/workflows/release-dispatch.yml Updated Docker image for propose-release job from v1.0.0-rc.1 to v1.0.0-rc2.

Possibly related PRs

Suggested reviewers

  • glihm

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.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (4)
.devcontainer/devcontainer.json (1)

5-5: Consider standardizing the version format, sensei!

The version format changed from using a dot separator (rc.1) to no separator (rc2). This might cause confusion or issues with version parsing. Consider maintaining consistency in the version format across all references.

Suggested format (choose one consistently):

  • With dot: v1.0.0-rc.2
  • Without dot: v1.0.0-rc2
.github/workflows/ci.yml (3)

Line range hint 13-21: Ohayo sensei! Consider using predefined paths for better maintainability.

The binary management looks good, but we can improve the path handling:

 build:
   runs-on: ubuntu-latest-4-cores
+  env:
+    BINS_DIR: bins
+    RELEASE_DIR: target/release
   steps:
     - uses: actions/checkout@v3
     - uses: Swatinem/rust-cache@v2
     - run: |
         cargo build -r --bin katana
         cargo build -r --bin sozo
-        mkdir -p bins
-        cp ./target/release/katana bins/
-        cp ./target/release/sozo bins/
+        mkdir -p $BINS_DIR
+        cp $RELEASE_DIR/{katana,sozo} $BINS_DIR/
     - uses: actions/upload-artifact@v4
       with:
         name: dojo-bins
-        path: bins
+        path: $BINS_DIR
🧰 Tools
🪛 actionlint

32-32: label "ubuntu-latest-32-cores" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-22.04", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-14.0", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "macos-13.0", "macos-12-xl", "macos-12-xlarge", "macos-12-large", "macos-12", "macos-12.0", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file

(runner-label)


Line range hint 41-47: Enhance test setup reliability with error handling.

The test setup could be more robust:

 - run: |
     export PATH=/tmp/bins:$PATH
     chmod +x /tmp/bins/katana
     chmod +x /tmp/bins/sozo
     bash scripts/build_cairo_projects.sh /tmp/bins/sozo
-    tar -xzf spawn-and-move-db.tar.gz -C /tmp/
-    tar -xzf types-test-db.tar.gz -C /tmp/
+    for db in spawn-and-move-db.tar.gz types-test-db.tar.gz; do
+      echo "Extracting $db..."
+      if ! tar -xzf "$db" -C /tmp/; then
+        echo "Failed to extract $db"
+        exit 1
+      fi
+      # Verify critical files exist
+      test -f "/tmp/${db%.tar.gz}/critical_file" || { echo "$db extraction incomplete"; exit 1; }
+    done
🧰 Tools
🪛 actionlint

32-32: label "ubuntu-latest-32-cores" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-22.04", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-14.0", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "macos-13.0", "macos-12-xl", "macos-12-xlarge", "macos-12-large", "macos-12", "macos-12.0", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file

(runner-label)


Line range hint 89-102: Enhance Katana binary verification.

The current verification could be more robust:

 - run: |
+    # Set timeout for Katana startup
+    TIMEOUT=30
+    START_TIME=$(date +%s)
     chmod +x ./katana
     ./katana &
     KATANA_PID=$!
-    sleep 2
-    if ! kill -0 $KATANA_PID; then
-      echo "Katana exited with an error"
-      exit 1
-    fi
+    # Wait for Katana to start or timeout
+    while true; do
+      if ! kill -0 $KATANA_PID 2>/dev/null; then
+        echo "Katana failed to start"
+        exit 1
+      fi
+      if curl -s http://localhost:5050 >/dev/null; then
+        echo "Katana started successfully"
+        break
+      fi
+      if [ $(($(date +%s) - START_TIME)) -gt $TIMEOUT ]; then
+        echo "Timeout waiting for Katana"
+        kill $KATANA_PID
+        exit 1
+      fi
+      sleep 1
+    done
     kill $KATANA_PID
🧰 Tools
🪛 actionlint

32-32: label "ubuntu-latest-32-cores" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-22.04", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-14.0", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "macos-13.0", "macos-12-xl", "macos-12-xlarge", "macos-12-large", "macos-12", "macos-12.0", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file

(runner-label)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 0b7d862 and 0e74379.

📒 Files selected for processing (4)
  • .devcontainer/devcontainer.json (1 hunks)
  • .github/workflows/bench.yml (2 hunks)
  • .github/workflows/ci.yml (7 hunks)
  • .github/workflows/release-dispatch.yml (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • .github/workflows/bench.yml
  • .github/workflows/release-dispatch.yml
🔇 Additional comments (1)
.devcontainer/devcontainer.json (1)

5-5: Ohayo sensei! Let's verify the container image availability.

The version bump from rc.1 to rc2 looks good, but we should ensure the new image is published and accessible.

✅ Verification successful

Ohayo sensei! The container image is verified and ready to roll! ✨

The v1.0.0-rc2 image is published and available in the GitHub Container Registry. It was created on November 10th, 2024, and is also tagged as latest, indicating it's the most recent stable version.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the new container image exists and is accessible
# Note: This only checks if the image manifest can be retrieved, not if it can be pulled

gh api \
  -H "Accept: application/vnd.oci.image.index.v1+json" \
  /repos/dojoengine/dojo/pkgs/container/dojo-dev/versions \
  | jq -r '.[] | select(.metadata.container.tags[] == "v1.0.0-rc2")'

Length of output: 372


Script:

#!/bin/bash
# Let's try a different approach using the GitHub Container Registry API
# First, let's check if the package exists and get its details

gh api \
  -H "Accept: application/vnd.github+json" \
  /orgs/dojoengine/packages/container/dojo-dev/versions \
  | jq -r '.[] | select(.metadata.container.tags | contains(["v1.0.0-rc2"])) | {tags: .metadata.container.tags, created_at: .created_at}'

Length of output: 330

@@ -31,7 +31,7 @@ jobs:
needs: ensure-docker
runs-on: ubuntu-latest-32-cores
container:
image: ghcr.io/dojoengine/dojo-dev:v1.0.0-rc.1
image: ghcr.io/dojoengine/dojo-dev:v1.0.0-rc2
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Centralize Docker image version management.

The Docker image version is duplicated across multiple jobs. Consider using a workflow-level environment variable:

 name: ci
 
 env:
   CARGO_TERM_COLOR: always
   RUST_VERSION: 1.79.0
+  DOJO_IMAGE_VERSION: v1.0.0-rc2
 
 jobs:
   test:
     container:
-      image: ghcr.io/dojoengine/dojo-dev:v1.0.0-rc2
+      image: ghcr.io/dojoengine/dojo-dev:${{ env.DOJO_IMAGE_VERSION }}

Also, consider adding a version verification step:

    - name: Verify Docker image version
      run: |
        if ! docker run --rm ${{ env.DOJO_IMAGE }} cat /version.txt | grep -q "^${{ env.DOJO_IMAGE_VERSION }}$"; then
          echo "Docker image version mismatch"
          exit 1
        fi

Also applies to: 59-59, 126-126, 142-142, 157-157, 166-166, 175-175

@glihm glihm closed this Nov 10, 2024
Copy link

codecov bot commented Nov 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 57.42%. Comparing base (0b7d862) to head (0e74379).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2670      +/-   ##
==========================================
+ Coverage   57.41%   57.42%   +0.01%     
==========================================
  Files         403      403              
  Lines       50818    50818              
==========================================
+ Hits        29177    29183       +6     
+ Misses      21641    21635       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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