Skip to content

[BB-5230] Implements the Grove CLI package with a Test Pipeline

Arunmozhi P requested to merge arunmozhi/bb-5230-grove-cli into main

Description

The MR deals with creation of the files and folder structure for the proposed grove-cli[1] along with configuration for automatically running linting and testing checks on Gitlab CI using Black and PyTest.

It also implements the grove new <instance_name> command that can be executed by calling CLI script.

Supporting information

[1] - Discovery Document

Testing information

Testing the Gitlab CI setup for the CLI

  • Make changes to files and commit
  • Push to Gitlab
  • Gitlab CI pipeline will should start with stages "CLI Lint" and "CLI Test"

Previous Runs for example: https://gitlab.com/opencraft/dev/grove/-/pipelines/425266371

Test the CLI

As Grove is used as the sub-module of Grove Template, testing can be done by cloning the Grove Template repository and copying the files.

# Clone the template as a new cluster - my-cluster
git clone git@gitlab.com:opencraft/dev/grove-template.git my-cluster

# Let's remove the sub-module and replace it with this branch
cd my-cluster
rm -rf grove

# Clone Grove and checkout to this branch
git clone --branch arunmozhi/bb-5230-grove-cli  git@gitlab.com:opencraft/dev/grove.git

# Setup a virtual environment for testing
python3 -m venv venv
source venv/bin/activate

# install the dependencies for the cli
pip install -r grove/tools-container/grove-cli/requirements.txt

# Set the Project directory to the "my-cluster" directory
export CI_PROJECT_DIR=.

# Test the grove-cli "new" command
python3 grove/tools-container/grove-cli/cli.py new my-instance

Now a copy of the folder defaults should be available inside the instances folder under the name my-instance

$ ls instances
example my-cluster

Deadlines

None

Other information

The GitLab CI setup for PyTest is also setup with Coverage, so test coverage will be available in the MR's diff view (including this MR) sample

Edited by Arunmozhi P

Merge request reports