-
Notifications
You must be signed in to change notification settings - Fork 234
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
Problem: testground image not pushed to registry #1479
Conversation
Solution: - build the current version of the image in root flake - push to github container registry
Warning Rate limit exceeded@yihuang has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 31 minutes and 41 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe recent modifications introduce a comprehensive GitHub Actions workflow to automate building and pushing a Testground Docker image, integrate Nix and Poetry for Python benchmarks, and improve the test environment configuration. These changes bolster the automation, interoperability, and maintainability across the CI/CD pipelines and the development environment. Changes
Sequence DiagramsequenceDiagram
participant Developer
participant GitHub Actions
participant Docker Registry
participant Nix
participant Poetry
Developer->>GitHub: Push to main branch or tag version
GitHub->>GitHub Actions: Trigger workflow
GitHub Actions->>Nix: Download Nix packages and overlays
GitHub Actions->>Poetry: Install Python dependencies
GitHub Actions->>GitHub Actions: Build Docker image
GitHub Actions->>Docker Registry: Push Docker image
Docker Registry->>Developer: Notify that image is available
Poem
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this 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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (2)
flake.lock
is excluded by!**/*.lock
testground/benchmark/flake.lock
is excluded by!**/*.lock
Files selected for processing (5)
- .github/workflows/container.yml (1 hunks)
- flake.nix (1 hunks)
- nix/benchmark.nix (1 hunks)
- nix/testground-image.nix (1 hunks)
- testground/benchmark/overlay.nix (1 hunks)
Additional comments not posted (12)
nix/testground-image.nix (3)
1-8
: The Docker image configuration for "cronos-testground" is correctly set with appropriate contents for the test environment.
9-11
: The exposed ports and command configuration are well-defined, ensuring the Docker container is properly set up for network interactions and execution.
12-14
: SettingPYTHONUNBUFFERED=1
in the environment variables is a good practice for Docker environments, aiding in better log management.nix/benchmark.nix (2)
3-20
: The build system overrides in the benchmark configuration are well-defined, ensuring that each component has the necessary build tools and libraries.
22-31
: The Poetry application configuration is correctly set up with an appropriate project directory, Python version, and overrides. The use ofgitignoreSourcePure
for managing source files is commendable.testground/benchmark/overlay.nix (2)
3-28
: The overrides for Python project builds are appropriately defined, ensuring that the necessary build tools and libraries are included. The source management usinggitignoreSourcePure
is effectively utilized.
29-45
: The function calls for benchmark, image, and environment setups are well-organized and correctly linked to their respective configurations, promoting modularity and maintainability..github/workflows/container.yml (3)
1-12
: The workflow configuration for triggers and environment variables is correctly set up, ensuring that the Docker image is built and pushed automatically on relevant events.
13-20
: The job configuration and permissions are appropriately set, ensuring the workflow has the necessary access rights to perform its tasks.
21-51
: The steps for building and pushing the Docker image are well-defined, utilizing Nix and Docker commands effectively to ensure the image is correctly built and pushed to the registry.flake.nix (2)
42-42
: Ensure thattestground-image
is properly defined and available in the Nix environment, as it is now being inherited in the package set.Verification successful
The
testground-image
is correctly defined innix/testground-image.nix
and is properly included in the Nix environment. The definition usesdockerTools.buildLayeredImage
to build a Docker image with the necessary components and configurations.
flake.nix
properly inheritstestground-image
.testground-image
is defined intestground/benchmark/overlay.nix
.- The actual definition of
testground-image
innix/testground-image.nix
is valid and correctly set up.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that `testground-image` is properly defined in the Nix environment. # Test: Search for the definition of `testground-image` to ensure it is available. rg --type nix $'testground-image'Length of output: 203
Script:
#!/bin/bash # Description: Verify the contents of `../../nix/testground-image.nix` to ensure `testground-image` is correctly defined. # Locate and display the contents of `../../nix/testground-image.nix`. cat $(fd testground-image.nix)Length of output: 437
34-36
: Ensure that the new overlay fromtestground/benchmark/overlay.nix
is correctly implemented and does not conflict with existing configurations.Verification successful
Ensure that the new overlay from
testground/benchmark/overlay.nix
is correctly implemented and does not conflict with existing configurations.
- The new overlay in
testground/benchmark/overlay.nix
provides specific configurations for benchmarking, including overrides and environment setup for Python packages.- Existing overlays, such as
poetry2nix
andgomod2nix
, have distinct purposes and configurations.Based on the provided content, there are no apparent conflicts between the new overlay and the existing overlays. The new overlay is focused on Python benchmarking, whereas
gomod2nix
deals with Go module configurations.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the new overlay does not conflict with existing configurations. # Test: Check for potential conflicts in overlay definitions. rg --type nix $'overlays.default'Length of output: 220
Script:
#!/bin/bash # Description: Display the content of the new overlay and existing overlays for comparison. # Display content of the new overlay echo "Content of testground/benchmark/overlay.nix:" cat testground/benchmark/overlay.nix # Display content of existing overlays echo "Content of poetry2nix overlay:" cat $(fd poetry2nix) echo "Content of gomod2nix overlay:" cat $(fd gomod2nix)Length of output: 33648
not sure it's a issue on arm64 only, but I get
|
There was a problem hiding this 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)
testground/benchmark/benchmark/main.py (1)
Line range hint
42-45
: Refactor the exception handling to usecontextlib.suppress
for a cleaner and more Pythonic approach.- try: - proc.wait(5) - except subprocess.TimeoutExpired: - pass + with contextlib.suppress(subprocess.TimeoutExpired): + proc.wait(5)
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
testground/benchmark/flake.lock
is excluded by!**/*.lock
Files selected for processing (7)
- flake.nix (2 hunks)
- nix/testground-image.nix (1 hunks)
- testground/benchmark/benchmark/context.py (2 hunks)
- testground/benchmark/benchmark/main.py (1 hunks)
- testground/benchmark/flake.nix (2 hunks)
- testground/benchmark/overlay.nix (1 hunks)
- testground/benchmark/pyproject.toml (1 hunks)
Files skipped from review due to trivial changes (1)
- testground/benchmark/pyproject.toml
Files skipped from review as they are similar to previous changes (3)
- flake.nix
- nix/testground-image.nix
- testground/benchmark/overlay.nix
Additional context used
Ruff
testground/benchmark/benchmark/main.py
42-45: Use
contextlib.suppress(subprocess.TimeoutExpired)
instead oftry
-except
-pass
(SIM105)Replace with
contextlib.suppress(subprocess.TimeoutExpired)
Additional comments not posted (6)
testground/benchmark/benchmark/main.py (1)
49-54
: The newinfo
function is a simple utility to print runtime configuration. This is a good practice for debugging and verifying the image build process. However, consider adding a more descriptive function name or a detailed docstring to clarify its specific purpose in the context of testground.testground/benchmark/flake.nix (3)
5-6
: Addingpoetry2nix
as a dependency is appropriate for managing Python dependencies. Make sure all necessary configurations are updated to accommodate this change.
66-70
: The configuration for the newtestground-testcase
package and application is well-defined. However, verify that the executable path matches the actual location in the Docker container to avoid runtime errors.
58-60
: The addition of overlays in the Nix configuration is crucial for extending functionality. Ensure that the overlays are correctly configured and tested, especially since they can significantly alter the behavior of the packages.testground/benchmark/benchmark/context.py (2)
15-21
: Convertingsync
to a lazy-initialized property is a good practice for resource management, ensuring that theSyncService
is only initialized when needed. This change enhances the efficiency of theContext
class.
116-117
: Properly handling resource cleanup in the__exit__
method is crucial. Ensure that all resources are appropriately released to prevent leaks.
works now, you can test the image like this:
|
Can also run the cronosd like this:
|
Solution:
test run on my personal repo: https://github.com/yihuang/cronos/pkgs/container/cronos-testground
👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻
PR Checklist:
make
)make test
)go fmt
)golangci-lint run
)go list -json -m all | nancy sleuth
)Thank you for your code, it's appreciated! :)
Summary by CodeRabbit
New Features
Enhancements
BenchmarkContext
class with lazy initialization forsync
attribute.Documentation
main.py
file.Refactor
pyproject.toml
.