Thanks to visit codestin.com
Credit goes to github.com

Skip to content

cirunlabs/cirun-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

56 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

cirun-agent

Cirun logo

Cirun Linux macOS Rust License Documentation

A robust Rust agent for provisioning and managing CI/CD runners through the Cirun platform, offering automated VM lifecycle management with Lume virtualization.

✨ Features

  • Automatic VM Provisioning: Clone and configure runner VMs from templates
  • Lifecycle Management: Provision and delete CI/CD runners on demand
  • Template-based Deployment: Use a base template for consistent runner configurations
  • Continuous Communication: Regular status reporting to the Cirun API
  • Persistent Agent Identity: Maintains a consistent identifier across restarts
  • Environment Detection: Auto-detects system information and capabilities

πŸ“¦ Installation

Using binary (recommended)

curl --proto '=https' --tlsv1.2 -LsSf https://raw.githubusercontent.com/cirunlabs/cirun-agent/refs/heads/main/install.sh | sh

Using Cargo

cargo install cirun-agent

From Source

git clone https://github.com/cirun-io/cirun-agent
cd cirun-agent
cargo build --release

πŸš€ Quick Start

Checkout docs for quick start guide: https://docs.cirun.io/on-prem

βš™οΈ Configuration

Command Line Arguments

Argument Short Description Default
--api-token -a API token for authentication (Required)
--interval -i Polling interval in seconds 10
--id-file -f Agent ID file path .agent_id

Environment Variables

Variable Description Default
CIRUN_API_URL Base URL for Cirun API https://api.cirun.io/api/v1

πŸ”Œ Lume Virtualization

Cirun-agent relies on Lume for VM provisioning and management. Lume is a lightweight virtualization platform that enables efficient cloning and management of virtual machines.

Note: The cirun-agent automatically manages the Lume process, so there's no need to install or configure Lume separately. The agent handles all interactions with Lume internally.

πŸ’‘ Usage Scenarios

Self-Hosted CI/CD Runners

Set up the agent on any machine with virtualization capabilities to automatically provision CI/CD runners when needed, and clean them up after use.

# Run with custom polling interval (30 seconds)
cirun-agent --api-token YOUR_API_TOKEN --interval 30

Custom Runner Templates

  1. Create a VM named cirun-runner-template using Lume
  2. Configure it with your required tools and settings
  3. Start the agent - it will clone this template when provisioning new runners

πŸ—οΈ Architecture

The agent works by:

  1. Registering itself with the Cirun API using a persistent UUID
  2. Polling the API at regular intervals for runner provisioning/deletion requests
  3. Using Lume to clone VMs from a template and run provisioning scripts
  4. Reporting VM status back to the Cirun platform

πŸ‘¨β€πŸ’» Development

Prerequisites

  • Rust 1.54 or later
  • Access to Lume virtualization
  • Cirun API credentials

Building

cargo build

Testing

cargo test

Linting and Formatting

The project uses Clippy for linting and rustfmt for code formatting.

Install Linting Tools

rustup component add clippy rustfmt

Run Linter

cargo clippy

To automatically fix some linting issues:

cargo clippy --fix

Format Code

cargo fmt

Pre-commit Checks

Run both linting and formatting checks before committing:

cargo fmt -- --check && cargo clippy

πŸ” Troubleshooting

Debug Logging

Enable detailed logs by setting the RUST_LOG environment variable:

RUST_LOG=debug cirun-agent --api-token YOUR_API_TOKEN

πŸ“š Documentation

For comprehensive documentation about Cirun and the on-premises deployment options, visit:

πŸ’¬ Support

πŸ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.

🚒 Release Process

  • Update the version in Cargo.toml
  • Make sure all changes are staged for commit
  • Run the release script: ./release.sh

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

About

Cirun Agent to create on-demand VMs on your own infra using cirun.io's API

Resources

License

Stars

Watchers

Forks

Packages

No packages published