Skip to main content

A Python framework for building Spacelift plugins

Project description

Spacelift Plugins

A monorepo for Spacelift plugins built with the spaceforge framework.

Overview

This repository contains:

  • spaceforge/ - The core Python framework for building Spacelift plugins
  • plugins/wiz/ - Wiz security scanning plugin
  • Plugin management and generation tools

Quick Start

Installation

# Install the spaceforge framework
pip install -e .

Creating a Plugin

  1. Create a new directory for your plugin
  2. Implement your plugin by inheriting from SpacepyPlugin:
from spaceforge import SpaceforgePlugin, Parameter, Variable, Context

class MyPlugin(SpaceforgePlugin):
    __plugin_name__ = "my-plugin"
    __version__ = "1.0.0" 
    __author__ = "Your Name"
    
    # Define parameters using pydantic dataclasses
    __parameters__ = [
        Parameter(
            name="api_key",
            description="API key for authentication",
            required=True,
            sensitive=True
        )
    ]
    
    # Define contexts using pydantic dataclasses
    __contexts__ = [
        Context(
            name="main",
            description="Main plugin context",
            env=[
                Variable(
                    key="API_KEY",
                    value_from_parameter="api_key",
                    sensitive=True
                )
            ]
        )
    ]
    
    def after_plan(self):
        self.logger.info("Running after plan hook")
  1. Generate the plugin YAML:
python -m spaceforge generate my_plugin.py

Testing Plugins

# Set plugin parameters
export SPACEFORGE_PARAM_NAME="value"

# Test specific hooks
python -m spaceforge runner after_plan

Architecture

The spaceforge framework uses a hook-based architecture where plugins:

  • Inherit from SpaceforgePlugin base class
  • Override hook methods (after_plan, before_apply, etc.)
  • Define parameters, contexts, webhooks, and policies using pydantic dataclasses
  • Include automatic validation of data structures (e.g., Variables must have either value or value_from_parameter)
  • Are automatically converted to Spacelift plugin YAML format with JSON schema validation

Available Plugins

  • wiz - Security scanning plugin for infrastructure as code

Development

Commands

# Generate plugin YAML
python -m spaceforge generate [plugin_file.py] [-o output.yaml]

# Test plugin execution
python -m spaceforge runner [--plugin-file plugin.py] hook_name

# Get help
python -m spaceforge --help

Framework Documentation

See spaceforge/README.md for detailed framework documentation.

Contributing

  1. Create your plugin in a new directory
  2. Follow the plugin development patterns shown in existing plugins
  3. Generate and test your plugin YAML
  4. Submit a pull request

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spaceforge-0.0.2.tar.gz (35.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spaceforge-0.0.2-py3-none-any.whl (32.8 kB view details)

Uploaded Python 3

File details

Details for the file spaceforge-0.0.2.tar.gz.

File metadata

  • Download URL: spaceforge-0.0.2.tar.gz
  • Upload date:
  • Size: 35.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for spaceforge-0.0.2.tar.gz
Algorithm Hash digest
SHA256 8a322a10a2193317d3b403ba9126f794ce0bc389712f50890d1a7eed4ce037a2
MD5 a83903b2c98532f1fb8b91a00e7f6cfb
BLAKE2b-256 2a0d62e7f4d8f2a3040370df0917e646efe16fe0dc9b842e029d6b49c7ae2b9d

See more details on using hashes here.

Provenance

The following attestation bundles were made for spaceforge-0.0.2.tar.gz:

Publisher: release.yml on spacelift-io/plugins

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spaceforge-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: spaceforge-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 32.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for spaceforge-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 19f760752842d58152d56295e98b4e0e4e76bd0bf4882e9b94d0a9a82b7b4270
MD5 b07c3f27cb1c5558e4dde14d1dc77712
BLAKE2b-256 5e7f1d7b6b6163275cc6c0e77ca19ae65deb293b28b55173ac234aba3200de81

See more details on using hashes here.

Provenance

The following attestation bundles were made for spaceforge-0.0.2-py3-none-any.whl:

Publisher: release.yml on spacelift-io/plugins

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page