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
- Create a new directory for your plugin
- 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")
- 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
SpaceforgePluginbase 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
valueorvalue_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
- Create your plugin in a new directory
- Follow the plugin development patterns shown in existing plugins
- Generate and test your plugin YAML
- Submit a pull request
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a322a10a2193317d3b403ba9126f794ce0bc389712f50890d1a7eed4ce037a2
|
|
| MD5 |
a83903b2c98532f1fb8b91a00e7f6cfb
|
|
| BLAKE2b-256 |
2a0d62e7f4d8f2a3040370df0917e646efe16fe0dc9b842e029d6b49c7ae2b9d
|
Provenance
The following attestation bundles were made for spaceforge-0.0.2.tar.gz:
Publisher:
release.yml on spacelift-io/plugins
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spaceforge-0.0.2.tar.gz -
Subject digest:
8a322a10a2193317d3b403ba9126f794ce0bc389712f50890d1a7eed4ce037a2 - Sigstore transparency entry: 409469291
- Sigstore integration time:
-
Permalink:
spacelift-io/plugins@c99c9d7bbc5515f2e6dba965289b9ba2fe95eb71 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/spacelift-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c99c9d7bbc5515f2e6dba965289b9ba2fe95eb71 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19f760752842d58152d56295e98b4e0e4e76bd0bf4882e9b94d0a9a82b7b4270
|
|
| MD5 |
b07c3f27cb1c5558e4dde14d1dc77712
|
|
| BLAKE2b-256 |
5e7f1d7b6b6163275cc6c0e77ca19ae65deb293b28b55173ac234aba3200de81
|
Provenance
The following attestation bundles were made for spaceforge-0.0.2-py3-none-any.whl:
Publisher:
release.yml on spacelift-io/plugins
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spaceforge-0.0.2-py3-none-any.whl -
Subject digest:
19f760752842d58152d56295e98b4e0e4e76bd0bf4882e9b94d0a9a82b7b4270 - Sigstore transparency entry: 409469293
- Sigstore integration time:
-
Permalink:
spacelift-io/plugins@c99c9d7bbc5515f2e6dba965289b9ba2fe95eb71 -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/spacelift-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c99c9d7bbc5515f2e6dba965289b9ba2fe95eb71 -
Trigger Event:
push
-
Statement type: