This is an example project demonstrating how to set up continuous integration (CI) for a Q8S project. The project includes a simple Python environment configuration and CI workflows to automate building of images used to execute workloads in Qubernetes clusters.
Create a virtual environment and activate it:
python -m venv .venv
source .venv/bin/activateInstall the q8sctl command-line tool:
pip install -r requirements-dev.txtinstall pre-commit hooks:
pre-commit install --hook-type post-checkoutInitialize the project:
q8sctl init --imagesLogin into the Qubernetes Console select the Settings -> General option and download the kubeconfig file for your cluster. Save it as kubeconfig.yaml in the project root directory.
To execute workloads that have images in GitHub Container Registry (GHCR), you need a Personal Access Token (PAT) with the read:packages scope. Follow GitHub’s guide on creating a Personal Access Token (classic) to create one.
To execute workloads in your Qubernetes cluster, use the following command:
q8sctl execute --registry-pat YOUR_GHCR_PAT --target cpu src/workloads/sample_workload.pyInstall Jupyter Lab if you haven't already:
pip install jupyterTo execute workloads from notebooks, start Jupyter Lab with the following command:
q8sctl jupyter --registry-pat YOUR_GHCR_PAT --target cpu --installOpen the notebook.ipynb file in Jupyter Lab. Select the kernel Q8s kernel.
The image build workflow is defined in .github/workflows/build-images.yaml. It is triggered when a new branch is created or when a commit with a modified Q8Sproject file is pushed.