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

cherry-pick changes for build systems manually #261

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/python-poetry/poetry
rev: '1.4.2'
hooks:
- id: poetry-check
- id: poetry-lock
args: [ "--no-update" ]
- id: poetry-export
args: [ "-E", "ray", "--with", "dev", "-f", "requirements.txt", "-o", "requirements.txt" ]
85 changes: 85 additions & 0 deletions docs/environment_setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Setting Up Acto for Kubernetes Operator Testing

Acto is a Python project that provides a fully automatic end-to-end testing tool for Kubernetes operators/controllers. Setting up Acto involves preparing your environment with the necessary dependencies. There are three methods for setting up the Acto environment:

## Method 1: Installing Dependencies from `requirements.txt` (Provided for Backward Compatibility)

This method is meant for backward compatibility and relies on the `requirements.txt` file, which is generated by a pre-commit hook that exports dependencies managed by Poetry.

1. Clone the Acto repository:
```
git clone https://github.com/xlab-uiuc/acto
cd acto
```

2. Create and activate a virtual environment (optional but recommended):
```
python3 -m venv venv
source venv/bin/activate
```

3. Install dependencies using `requirements.txt`:
```
pip install -r requirements.txt
```

## Method 2: Using Poetry for Dependency Management (Recommended)

Poetry provides a modern approach to managing dependencies in Python projects. It uses the `pyproject.toml` and `poetry.lock` files.

1. Clone the Acto repository:
```
git clone https://github.com/xlab-uiuc/acto
cd acto
```

2. Install Poetry (if not already installed):
```
# see https://python-poetry.org/docs/ for more information
curl -sSL https://install.python-poetry.org | python3 -
```

3. Use Poetry to install dependencies:
```
poetry install
```

## Method 3: Using Nix (Recommended for Nix Users)

If you are using Nix, Acto provides a `flake.nix` file that defines a development environment. This method can take some time initially due to building certain packages from scratch.

1. Clone the Acto repository:
```
git clone https://github.com/xlab-uiuc/acto
cd acto
```

2. Install Nix (if not already installed).

3. Enter the Nix develop shell to set up the environment:
```
nix develop
```

Note: Some packages may build from scratch, and the initial installation might take around 20 minutes. However, you can reuse the build cache on other nodes.

## For Acto Developers: Installing Pre-commit Hook

If you are a developer contributing to Acto, it's essential to keep the `requirements.txt` file up-to-date. You can use the pre-commit hook to automate this process.

1. Install the `pre-commit` tool (if not already installed):
```
pip install pre-commit
```

2. Configure the pre-commit hook for Acto repository:
```
cd /path/to/acto/repository
pre-commit install
```

This will ensure that the `requirements.txt` file is updated for every commit.

For more information on using the `pre-commit` tool, visit [pre-commit.com](https://pre-commit.com).

Now you're all set to start using Acto for fully automatic end-to-end testing of your Kubernetes operators/controllers. Happy testing!
152 changes: 152 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
description = "Push-Button End-to-End Testing of Kubernetes Operators";

inputs.flake-utils.url = "github:numtide/flake-utils/919d646de7be200f3bf08cb76ae1f09402b6f9b4";
inputs.poetry2nixFlake.url = "github:nix-community/poetry2nix/e7a88dfc2c5aa0c660a3ec4661a695c1c2380a8a";

outputs = { self, nixpkgs, flake-utils, poetry2nixFlake }:
flake-utils.lib.eachDefaultSystem
(system:
let pkgs = nixpkgs.legacyPackages.${system}; in
{
devShells.default = import ./shell.nix { pkgs = pkgs // { poetry2nix = poetry2nixFlake.legacyPackages.${system}; }; };
}
);
}
Loading
Loading